btrfs/304: skip the run if block size is not 4K
PATCH 1/1 btrfs/304: skip the run if block size is not 4K
[FALSE ALERT]
When running btrfs with block size larger than 4K (e.g. 8K in this case), the test case will fail like this:
FSTYP -- btrfs PLATFORM -- Linux/x86_64 btrfs-vm 6.17.0-rc4-custom+ #287 SMP PREEMPT_DYNAMIC Thu Sep 18 16:42:54 ACST 2025 MKFS_OPTIONS -- -s 8k /dev/mapper/test-scratch1
MOUNT_OPTIONS -- /dev/mapper/test-scratch1 /mnt/scratch
btrfs/304 1s ... - output mismatch (see /home/adam/xfstests/results//btrfs/304.out.bad)
--- tests/btrfs/304.out 2024-07-15 16:17:42.639999997 +0930
+++ /home/adam/xfstests/results//btrfs/304.out.bad 2025-09-18 18:44:13.761000000 +0930
@@ -10,7 +10,7 @@
leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1
fs uuid <UUID>
chunk uuid <UUID>
- item 0 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 16
+ item 0 key (XXXXXX RAID_STRIPE 8192) itemoff XXXXX itemsize 16
stripe 0 devid 1 physical XXXXXXXXX
total bytes XXXXXXXX
...
(Run 'diff -u /home/adam/xfstests/tests/btrfs/304.out /home/adam/xfstests/results//btrfs/304.out.bad' to see the entire diff)
In the above case it's the experimental support of block size larger than page size.
The feature is still under development.
[CAUSE]
That test case requires 4K block size, but it has no way to control that, as QA runners can specify MKFS_OPTIONS="-s 8k", to override the default block size.
Normally this is impossible as on x86_64 the only supported block size is 4K, already the minimal block size of btrfs. So there is no way to use other block size in that test case.
However with the experiemental bs > ps support, even on x86_64 it's possible to use 8K block size, and that breaks the 4K block size assumption of the test case.
[FIX]
Add quick scratch mkfs, and grab the block size of the resulted fs. If the block size is not 4K, skip the run.
Since we're here, also remove the page size check, since we have subpage block size support for a while, and replace it with a more accurate supported sectorsize check.
This more accurate sectorsize support now allows aarch64 (64K page size) to run btrfs/304 successfully, improving the subpage bs support coverage.
--- tests/btrfs/304 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tests/btrfs/304 +6 -1
@@ -20,8 +20,13 @@ _require_btrfs_fs_feature "raid_stripe_tree" _require_btrfs_fs_feature "free_space_tree" _require_btrfs_free_space_tree _require_btrfs_no_compress +_require_btrfs_support_sectorsize 4096 -test $(_get_page_size) -eq 4096 || _notrun "this tests requires 4k pagesize" +_scratch_mkfs >> /dev/null +blksz=$(_scratch_btrfs_sectorsize) +if [ $blksz -ne 4096 ]; then + _notrun "this tests require blocksize 4096, has $blocksize" +fi test_4k_write() {
Signature · 1 line
2.51.0
Looks good,
Quoted 33 lines · Qu Wenruo
[FALSE ALERT]
When running btrfs with block size larger than 4K (e.g. 8K in this case), the test case will fail like this:FSTYP -- btrfs PLATFORM -- Linux/x86_64 btrfs-vm 6.17.0-rc4-custom+ #287 SMP PREEMPT_DYNAMIC Thu Sep 18 16:42:54 ACST 2025 MKFS_OPTIONS -- -s 8k /dev/mapper/test-scratch1
MOUNT_OPTIONS--/dev/mapper/test-scratch1/mnt/scratchbtrfs/304 1s ... - output mismatch (see
/home/adam/xfstests/results//btrfs/304.out.bad)
--- tests/btrfs/304.out 2024-07-15 16:17:42.639999997 +0930
+++/home/adam/xfstests/results//btrfs/304.out.bad2025-09-18 18:44:13.761000000 +0930
@@ -10,7 +10,7 @@
leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1
fs uuid <UUID>
chunk uuid <UUID>
- item 0 key (XXXXXXRAID_STRIPE4096) itemoff XXXXX itemsize 16
+ item 0 key (XXXXXXRAID_STRIPE8192) itemoff XXXXX itemsize 16
stripe 0 devid 1 physical XXXXXXXXX
total bytes XXXXXXXX
...
(Run 'diff -u/home/adam/xfstests/tests/btrfs/304.out/home/adam/xfstests/results//btrfs/304.out.bad' to see the entire diff)In the above case it's the experimental support of block size larger than page size.
The feature is still under development.[CAUSE]
That test case requires 4K block size, but it has no way to control that, as QA runners can specify MKFS_OPTIONS="-s 8k", to override the default block size.
Quoted 5 lines
Normally this is impossible as on
x86_64the only supported block size is 4K, already the minimal block size of btrfs. So there is no way to use other block size in that test case.However with the experiemental bs > ps support, even on
x86_64it's
experiemental -> experimental
Quoted 5 lines
possible to use 8K block size, and that breaks the 4K block size assumption of the test case.
[FIX]
Add quick scratch mkfs, and grab the block size of the resulted fs.
resulted -> resulting
Quoted 19 lines
If the block size is not 4K, skip the run.
Since we're here, also remove the page size check, since we have subpage block size support for a while, and replace it with a more accurate supported sectorsize check.
This more accurate sectorsize support now allows aarch64 (64K page size) to run btrfs/304 successfully, improving the subpage bs support coverage.
Signed-off-by Qu Wenruo <[email protected]>--- tests/btrfs/304 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)tests/btrfs/304 +0
-0
tests/btrfs/304 _require_btrfs_fs_feature "raid_stripe_tree" · line 28
Quoted 10 lines
tests/btrfs/304 +5
-1@@ -20,8 +20,13 @@ _require_btrfs_fs_feature "raid_stripe_tree" _require_btrfs_fs_feature "free_space_tree" _require_btrfs_free_space_tree _require_btrfs_no_compress +_require_btrfs_support_sectorsize 4096 -test $(_get_page_size) -eq 4096 || _notrun "this tests requires 4k pagesize" +_scratch_mkfs >> /dev/null +blksz=$(_scratch_btrfs_sectorsize) +if [ $blksz -ne 4096 ]; then + _notrun "this tests require blocksize 4096, has $blocksize"
should be "this test requires block size 4096, have $blocksize"
So at least 3 of the raid stripe tree tests, from btrfs/304,305,306 require the same exact fix, why not combine all the fixes in a single patch?
I've sent patches for the other two that do exactly the same.
Thanks.
Quoted 8 lines
tests/btrfs/304 +1
-1+fi test_4k_write() { --2.51.0