public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
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 v3 1/3] common/atomicwrites: add helper for multi block atomic writes
Date: Wed,  4 Jun 2025 21:01:20 -0700	[thread overview]
Message-ID: <20250605040122.63131-2-catherine.hoang@oracle.com> (raw)
In-Reply-To: <20250605040122.63131-1-catherine.hoang@oracle.com>

Add a helper to check that we can perform multi block atomic writes.

Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
---
 common/atomicwrites | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/common/atomicwrites b/common/atomicwrites
index 391bb6f6..88f49a1a 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


  reply	other threads:[~2025-06-05  4:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-05  4:01 [PATCH v3 0/3] atomic writes tests (part 2) Catherine Hoang
2025-06-05  4:01 ` Catherine Hoang [this message]
2025-06-05 15:20   ` [PATCH v3 1/3] common/atomicwrites: add helper for multi block atomic writes John Garry
2025-06-09  4:23   ` Ritesh Harjani
2025-06-05  4:01 ` [PATCH v3 2/3] generic: various atomic write tests with scsi_debug Catherine Hoang
2025-06-05 15:27   ` John Garry
2025-06-05  4:01 ` [PATCH v3 3/3] xfs: more multi-block atomic writes tests Catherine Hoang
2025-06-05 15:29   ` John Garry

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=20250605040122.63131-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