btrfs/305: skip the run if block size is not 4K
PATCH v2 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.
---
Changelog:
v2:
- Fix the _notrun message to use $blksz instead of the wrong $blocksize
--- 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 $blksz" +fi test_8k_new_stripe() {
Signature · 1 line
2.51.0
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/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.bad2025-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 (XXXXXXRAID_STRIPE61440) itemoff XXXXX itemsize 16
+ item 0 key (XXXXXXRAID_STRIPE65536) itemoff XXXXX itemsize 16
stripe 0 devid 1 physical XXXXXXXXX
- item 1 key (XXXXXXRAID_STRIPE4096) 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.
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
typo in experimental
Quoted 5 lines
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.
resulted -> resulting
Quoted 24 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/305 successfully, improving the subpage bs support coverage.
Signed-off-by Qu Wenruo <[email protected]>---
Changelog:
v2:
- Fix the_notrunmessage to use $blksz instead of the wrong $blocksize--- tests/btrfs/305 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)tests/btrfs/305 +0
-0@@ -22,7 +22,13 @@ _require_btrfs_fs_feature "free_space_tree" _require_btrfs_free_space_tree
tests/btrfs/305 _require_btrfs_fs_feature "free_space_tree" · line 31
Quoted 10 lines
tests/btrfs/305 +7
-1_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 $blksz" +fi
should be "this test requires a block size of 4096 bytes, 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 7 lines
tests/btrfs/305 +0
-1test_8k_new_stripe() { --2.51.0
Quoted 87 lines · Filipe Manana
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/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.bad2025-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 (XXXXXXRAID_STRIPE61440) itemoff XXXXX itemsize 16
+ item 0 key (XXXXXXRAID_STRIPE65536) itemoff XXXXX itemsize 16
stripe 0 devid 1 physical XXXXXXXXX
- item 1 key (XXXXXXRAID_STRIPE4096) 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.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'stypo in experimental
Quoted 5 lines
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.resulted -> resulting
Quoted 24 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/305 successfully, improving the subpage bs support coverage.
Signed-off-by Qu Wenruo <[email protected]>---
Changelog:
v2:
- Fix the_notrunmessage to use $blksz instead of the wrong $blocksize--- tests/btrfs/305 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)tests/btrfs/305 +0
-0@@ -22,7 +22,13 @@ _require_btrfs_fs_feature "free_space_tree" _require_btrfs_free_space_treetests/btrfs/305 _require_btrfs_fs_feature "free_space_tree" · line 31
Quoted 10 lines
tests/btrfs/305 +7
-1_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 $blksz" +fishould be "this test requires a block size of 4096 bytes, have $blocksize"
Quoted 4 lines
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.
Right, I'll combine them into one, so we don't need to duplicate the same grammar errors into 3...
Thanks,
Qu
Quoted 10 lines
Thanks.
Quoted 7 lines
tests/btrfs/305 +0
-1test_8k_new_stripe() { --2.51.0