]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
generic/793: limit number of overwrites
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Wed, 29 Apr 2026 20:46:24 +0000 (22:46 +0200)
committerZorro Lang <zlang@kernel.org>
Mon, 4 May 2026 02:57:17 +0000 (10:57 +0800)
Testcase generic/793 overwrites a 1GB file "number of sequential zones"
times in order to trigger a bug in zoned BTRFS' garbage collection. But on
scratch devices with a huge number of sequential zones (like SMR drives)
this can cause very long runtimes.

As the testcase also limits the filesystem size to 16GB, constraint the
number of overwrite loops to the number of sequential zones in the
filesystem. This still guarantees that the file will be overwritten often
enough to trigger the bug while not exploding the overall test runtime.

Reported-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/generic/793

index a59e84694309d2d526a825f5b86e97d73dfe141c..0d3b0bfcac5ef2891ec843433823529b4a3a667d 100755 (executable)
@@ -11,6 +11,7 @@
 _begin_fstest auto quick zone
 
 . ./common/filter
+. ./common/zoned
 
 _require_scratch_size $((16 * 1024 * 1024))
 
@@ -34,12 +35,14 @@ _fixed_by_fs_commit btrfs 258e46a6385c \
 _fixed_by_fs_commit btrfs e2a7fd22378f \
        "btrfs: zoned: add zone reclaim flush state for DATA space_info"
 
-_scratch_mkfs_sized $((16 * 1024 * 1024 * 1024)) &>>$seqres.full
+fssize=$((16 * 1024 * 1024 * 1024))
+_scratch_mkfs_sized ${fssize} &>>$seqres.full
 _scratch_mount
 
-# Overwrite the data "number of seq zones" times, this is arbitrarily chosen
+# Overwrite the data "number of zones in fs" times, this is arbitrarily chosen
 # but triggers the original bug reliably
-loops=$($BLKZONE_PROG report $zoned_dev | grep -c "SEQ_WRITE_REQUIRED")
+zsize=$(_zone_capacity 0 $zoned_dev)
+loops=$(( fssize/zsize))
 
 for (( i = 0; i < $loops; i++ )); do
        dd if=/dev/zero of=$SCRATCH_MNT/test bs=1M count=1024 status=none