]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
common/dmlogwrites: add _require_log_writes_sized helper
authorDisha Goel <disgoel@linux.ibm.com>
Fri, 8 May 2026 14:47:00 +0000 (20:17 +0530)
committerZorro Lang <zlang@kernel.org>
Mon, 11 May 2026 16:18:14 +0000 (00:18 +0800)
Add a new helper function _require_log_writes_sized() to check if the
LOGWRITES_DEV meets a minimum size requirement.

This is useful for tests that use dm-log-writes with additional space
requirements, such as creating LVM snapshots during log replay or tests
that generate large amounts of logged I/O operations.

The function takes a size parameter in KB, calls _require_log_writes()
internally, and skips the test if LOGWRITES_DEV is smaller than the
required size.

Suggested-by: Darrick J. Wong <djwong@kernel.org>
Suggested-by: Anand Jain <anajain.sg@gmail.com>
Signed-off-by: Disha Goel <disgoel@linux.ibm.com>
Reviewed-by: Zorro Lang <zlang@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/dmlogwrites

index 278656269584b333f5db67d28e329ac11cfac48b..d4a4ba57040502934bcb5d2442d8eec8e76a772f 100644 (file)
@@ -14,6 +14,22 @@ _require_log_writes()
        _require_test_program "log-writes/replay-log"
 }
 
+# Require a log writes device of a minimum size
+# $1: minimum size in KB
+_require_log_writes_sized()
+{
+       local size=$1
+       local devsize
+
+       [ $# -eq 1 ] || _fail "_require_log_writes_sized: expected size param"
+
+       _require_log_writes
+
+       devsize=$(_get_device_size $LOGWRITES_DEV)
+       [ $devsize -lt $size ] && \
+               _notrun "LOGWRITES_DEV too small, ${devsize}KB < ${size}KB"
+}
+
 # Starting from v4.15-rc1, DAX support was added to dm-log-writes, but note
 # that it doesn't track the data that we write via the mmap(), so we can't do
 # any data integrity checking. We can only verify that the metadata writes for