btrfs: test active zone tracking
A ZNS device limits the number of active zones, which is the number of
zones can be written at the same time. To deal with the limit, btrfs's
zoned mode tracks which zone (corresponds to a block group on the SINGLE
profile) is active, and finish a zone if necessary.
This test checks if the active zone tracking and the finishing of zones
works properly. First, it fills <number of max active zones> zones
mostly. And, run some data/metadata stress workload to force btrfs to use a
new zone.
This test fails on an older kernel (e.g, 5.18.2) like below.
btrfs/273
[failed, exit status 1]- output mismatch (see /host/btrfs/273.out.bad)
--- tests/btrfs/273.out 2022-09-15 07:52:18.
000000000 +0000
+++ /host/btrfs/273.out.bad 2022-09-15 07:59:14.
290967793 +0000
@@ -1,2 +1,5 @@
QA output created by 273
-Silence is golden
+stress_data_bgs failed
+stress_data_bgs_2 failed
+failed: '/bin/btrfs subvolume snapshot /mnt/scratch /mnt/scratch/snap825'
+(see /host/btrfs/273.full for details)
...
(Run 'diff -u /var/lib/xfstests/tests/btrfs/273.out /host/btrfs/273.out.bad' to see the entire diff)
The failure is fixed with a series "btrfs: zoned: fix active zone tracking
issues" [1] (upstream commits from
65ea1b66482f ("block: add bdev_max_segments()
helper") to
2ce543f47843 ("btrfs: zoned: wait until zone is finished when
allocation didn't progress")).
[1] https://lore.kernel.org/linux-btrfs/cover.
1657321126.git.naohiro.aota@wdc.com/
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
cleanup: remove left files after test finishes
Fix file leak in _get_max_file_size - This is obviously mostly
problematic for FS lacking support for sparse files.
There seems to be some seek_sanity_testfile files that are not
cleaned up and take up space:
-rwxr-xr-x. 1 root root 8.0G Sep 22 13:39 seek_sanity_testfile10
g/394: Clean up test files taking space:
-rwxr-xr-x. 1 root root 1.0G Sep 22 14:58 394.
1183899
-rwxr-xr-x. 1 root root 1.0G Sep 22 14:58 394.
1183899-1
-rwxr-xr-x. 1 root root 0 sep 22 14:58 394.
1183899+1
Signed-off-by: Pavel Reichl <preichl@redhat.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>