From: Catherine Hoang <catherine.hoang@oracle.com>
To: linux-xfs@vger.kernel.org, fstests@vger.kernel.org
Cc: djwong@kernel.org, john.g.garry@oracle.com,
ritesh.list@gmail.com, ojaswin@linux.ibm.com
Subject: [PATCH v5 1/3] common/atomicwrites: add helper for multi block atomic writes
Date: Mon, 16 Jun 2025 14:52:11 -0700 [thread overview]
Message-ID: <20250616215213.36260-2-catherine.hoang@oracle.com> (raw)
In-Reply-To: <20250616215213.36260-1-catherine.hoang@oracle.com>
Add a helper to check that we can perform multi block atomic writes. We will
use this in the following patches that add testing for large atomic writes.
This helper will prevent these tests from running on kernels that only support
single block atomic writes.
Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
---
common/atomicwrites | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/common/atomicwrites b/common/atomicwrites
index 391bb6f6..ac4facc3 100644
--- a/common/atomicwrites
+++ b/common/atomicwrites
@@ -24,6 +24,27 @@ _get_atomic_write_segments_max()
grep -w atomic_write_segments_max | grep -o '[0-9]\+'
}
+_require_scratch_write_atomic_multi_fsblock()
+{
+ _require_scratch
+
+ _scratch_mkfs > /dev/null 2>&1 || \
+ _notrun "cannot format scratch device for atomic write checks"
+ _try_scratch_mount || \
+ _notrun "cannot mount scratch device for atomic write checks"
+
+ local testfile=$SCRATCH_MNT/testfile
+ touch $testfile
+
+ local bsize=$(_get_file_block_size $SCRATCH_MNT)
+ local awu_max_fs=$(_get_atomic_write_unit_max $testfile)
+
+ _scratch_unmount
+
+ test $awu_max_fs -ge $((bsize * 2)) || \
+ _notrun "multi-block atomic writes not supported by this filesystem"
+}
+
_require_scratch_write_atomic()
{
_require_scratch
--
2.34.1
next prev parent reply other threads:[~2025-06-16 21:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-16 21:52 [PATCH v5 0/3] atomic writes tests (part 2) Catherine Hoang
2025-06-16 21:52 ` Catherine Hoang [this message]
2025-06-16 21:52 ` [PATCH v5 2/3] generic: various atomic write tests with hardware and scsi_debug Catherine Hoang
2025-06-17 10:18 ` John Garry
2025-06-18 9:25 ` Ojaswin Mujoo
2025-06-18 18:09 ` Zorro Lang
2025-06-20 23:02 ` Catherine Hoang
2025-06-21 12:20 ` Zorro Lang
2025-06-26 0:00 ` Catherine Hoang
2025-06-16 21:52 ` [PATCH v5 3/3] xfs: more multi-block atomic writes tests Catherine Hoang
2025-06-18 18:13 ` Zorro Lang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250616215213.36260-2-catherine.hoang@oracle.com \
--to=catherine.hoang@oracle.com \
--cc=djwong@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=john.g.garry@oracle.com \
--cc=linux-xfs@vger.kernel.org \
--cc=ojaswin@linux.ibm.com \
--cc=ritesh.list@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).