diff options
author | Naohiro Aota <naohiro.aota@wdc.com> | 2023-09-15 16:25:10 +0900 |
---|---|---|
committer | Zorro Lang <zlang@kernel.org> | 2023-09-20 15:49:54 +0800 |
commit | f4c7dbbb4f166996d8fefdebbceacd2f7d359dee (patch) | |
tree | f4cd8292fc8bb564d8022902c8763e786c52d499 | |
parent | 79650397e1d1884a981de33464bddd055d7c1143 (diff) | |
download | xfstests-dev-f4c7dbbb4f166996d8fefdebbceacd2f7d359dee.tar.gz |
btrfs/076: support smaller extent size limit
Running btrfs/076 on a zoned null_blk device will fail with the following error.
- output mismatch (see /host/results/btrfs/076.out.bad)
--- tests/btrfs/076.out 2021-02-05 01:44:20.000000000 +0000
+++ /host/results/btrfs/076.out.bad 2023-09-15 01:49:36.000000000 +0000
@@ -1,3 +1,3 @@
QA output created by 076
-80
-80
+83
+83
...
This is because the default value of zone_append_max_bytes is 127.5 KB
which is smaller than BTRFS_MAX_UNCOMPRESSED (128K). So, the extent size is
limited to 126976 (= ROUND_DOWN(127.5K, 4096)), which makes the number of
extents larger, and fails the test.
Instead of hard-coding the number of extents, we can calculate it using the
max extent size of an extent. It is limited by either
BTRFS_MAX_UNCOMPRESSED or zone_append_max_bytes.
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
-rwxr-xr-x | tests/btrfs/076 | 23 | ||||
-rw-r--r-- | tests/btrfs/076.out | 3 |
2 files changed, 22 insertions, 4 deletions
diff --git a/tests/btrfs/076 b/tests/btrfs/076 index 89e9672d09..52fe9e8822 100755 --- a/tests/btrfs/076 +++ b/tests/btrfs/076 @@ -28,13 +28,28 @@ _supported_fs btrfs _require_test _require_scratch +# An extent size can be up to BTRFS_MAX_UNCOMPRESSED +max_extent_size=$(( 128 * 1024 )) +if _scratch_btrfs_is_zoned; then + zone_append_max=$(cat "/sys/block/$(_short_dev $SCRATCH_DEV)/queue/zone_append_max_bytes") + if [[ $zone_append_max -gt 0 && $zone_append_max -lt $max_extent_size ]]; then + # Round down to PAGE_SIZE + max_extent_size=$(( $zone_append_max / 4096 * 4096 )) + fi +fi +file_size=$(( 1 * 1024 * 1024 )) +expect=$(( (file_size + max_extent_size - 1) / max_extent_size )) + _scratch_mkfs >> $seqres.full 2>&1 _scratch_mount "-o compress=lzo" $XFS_IO_PROG -f -c "pwrite 0 10M" -c "fsync" \ $SCRATCH_MNT/data >> $seqres.full 2>&1 -_extent_count $SCRATCH_MNT/data +res=$(_extent_count $SCRATCH_MNT/data) +if [[ $res -ne $expect ]]; then + _fail "Expected $expect extents, got $res" +fi $XFS_IO_PROG -f -c "pwrite 0 $((4096*33))" -c "fsync" \ $SCRATCH_MNT/data >> $seqres.full 2>&1 @@ -42,7 +57,11 @@ $XFS_IO_PROG -f -c "pwrite 0 $((4096*33))" -c "fsync" \ $XFS_IO_PROG -f -c "pwrite 0 10M" -c "fsync" \ $SCRATCH_MNT/data >> $seqres.full 2>&1 -_extent_count $SCRATCH_MNT/data +res=$(_extent_count $SCRATCH_MNT/data) +if [[ $res -ne $expect ]]; then + _fail "Expected $expect extents, got $res" +fi +echo "Silence is golden" status=0 exit diff --git a/tests/btrfs/076.out b/tests/btrfs/076.out index b99f7eb10a..248e095d91 100644 --- a/tests/btrfs/076.out +++ b/tests/btrfs/076.out @@ -1,3 +1,2 @@ QA output created by 076 -80 -80 +Silence is golden |