* [PATCH v2] generic/793: limit number of overwrites
@ 2026-04-24 11:48 Johannes Thumshirn
2026-04-24 13:22 ` Christoph Hellwig
2026-04-27 8:14 ` Hans Holmberg
0 siblings, 2 replies; 3+ messages in thread
From: Johannes Thumshirn @ 2026-04-24 11:48 UTC (permalink / raw)
To: Zorro Lang
Cc: Naohiro Aota, fstests, linux-btrfs, Christoph Hellwig,
Hans Holmberg, Johannes Thumshirn, Shin'ichiro Kawasaki
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>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
tests/generic/793 | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tests/generic/793 b/tests/generic/793
index a59e84694309..fcfbc4983d7c 100755
--- a/tests/generic/793
+++ b/tests/generic/793
@@ -11,6 +11,7 @@
_begin_fstest auto quick zone
. ./common/filter
+. ./common/zoned
_require_scratch_size $((16 * 1024 * 1024))
@@ -21,7 +22,6 @@ else
fi
_require_zoned_device "$zoned_dev"
-_require_command "$BLKZONE_PROG" blkzone
# This test requires specific data space usage, skip if we have compression
# enabled.
@@ -34,12 +34,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
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] generic/793: limit number of overwrites
2026-04-24 11:48 [PATCH v2] generic/793: limit number of overwrites Johannes Thumshirn
@ 2026-04-24 13:22 ` Christoph Hellwig
2026-04-27 8:14 ` Hans Holmberg
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2026-04-24 13:22 UTC (permalink / raw)
To: Johannes Thumshirn
Cc: Zorro Lang, Naohiro Aota, fstests, linux-btrfs, Christoph Hellwig,
Hans Holmberg, Shin'ichiro Kawasaki
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] generic/793: limit number of overwrites
2026-04-24 11:48 [PATCH v2] generic/793: limit number of overwrites Johannes Thumshirn
2026-04-24 13:22 ` Christoph Hellwig
@ 2026-04-27 8:14 ` Hans Holmberg
1 sibling, 0 replies; 3+ messages in thread
From: Hans Holmberg @ 2026-04-27 8:14 UTC (permalink / raw)
To: Johannes Thumshirn, Zorro Lang
Cc: Naohiro Aota, fstests@vger.kernel.org,
linux-btrfs@vger.kernel.org, Christoph Hellwig,
Shinichiro Kawasaki
On 24/04/2026 13:48, Johannes Thumshirn wrote:
> 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>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
> tests/generic/793 | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/tests/generic/793 b/tests/generic/793
> index a59e84694309..fcfbc4983d7c 100755
> --- a/tests/generic/793
> +++ b/tests/generic/793
> @@ -11,6 +11,7 @@
> _begin_fstest auto quick zone
>
> . ./common/filter
> +. ./common/zoned
>
> _require_scratch_size $((16 * 1024 * 1024))
>
> @@ -21,7 +22,6 @@ else
> fi
>
> _require_zoned_device "$zoned_dev"
> -_require_command "$BLKZONE_PROG" blkzone
_zone_capacity uses BLKZONE_PROG, so this needs to stay.
With that fixed, this looks good.
Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com>
>
> # This test requires specific data space usage, skip if we have compression
> # enabled.
> @@ -34,12 +34,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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-27 8:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-24 11:48 [PATCH v2] generic/793: limit number of overwrites Johannes Thumshirn
2026-04-24 13:22 ` Christoph Hellwig
2026-04-27 8:14 ` Hans Holmberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox