btrfs/305: skip the run if block size is not 4K
PATCH 1/1 btrfs/305: 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/305 1s ... - output mismatch (see /home/adam/xfstests/results//btrfs/305.out.bad)
--- tests/btrfs/305.out 2024-07-15 16:17:42.639999997 +0930
+++ /home/adam/xfstests/results//btrfs/305.out.bad 2025-09-18 18:44:14.914196231 +0930
@@ -12,11 +12,9 @@
leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1
fs uuid <UUID>
chunk uuid <UUID>
- item 0 key (XXXXXX RAID_STRIPE 61440) itemoff XXXXX itemsize 16
+ item 0 key (XXXXXX RAID_STRIPE 65536) itemoff XXXXX itemsize 16
stripe 0 devid 1 physical XXXXXXXXX
- item 1 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 16
...
(Run 'diff -u /home/adam/xfstests/tests/btrfs/305.out /home/adam/xfstests/results//btrfs/305.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 a 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/305 successfully, improving the subpage bs support coverage.
--- tests/btrfs/305 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
tests/btrfs/305 +7 -1
@@ -22,7 +22,13 @@ _require_btrfs_fs_feature "free_space_tree" _require_btrfs_free_space_tree _require_btrfs_no_compress -test $(_get_page_size) -eq 4096 || _notrun "this tests requires 4k pagesize" +_require_btrfs_support_sectorsize 4096 + +_scratch_mkfs >> /dev/null +blksz=$(_scratch_btrfs_sectorsize) +if [ $blksz -ne 4096 ]; then + _notrun "this tests require blocksize 4096, has $blocksize" +fi test_8k_new_stripe() {
Signature · 1 line
2.51.0