* [PATCH 1/3] btrfs-progs: tests: disable bgt feature for ^no-holes and ^fst runs
2025-11-27 5:25 [PATCH 0/3] btrfs-progs: add block-group-tree to the default mkfs/convert features Qu Wenruo
@ 2025-11-27 5:25 ` Qu Wenruo
2025-11-27 5:25 ` [PATCH 2/3] btrfs-progs: misc-tests: check if free space tree is enabled after mount Qu Wenruo
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Qu Wenruo @ 2025-11-27 5:25 UTC (permalink / raw)
To: linux-btrfs
The no-so-new block-group-tree feature requires both no-holes and
free-space-tree features.
For the incoming default block-group-tree feature at mkfs and convert
time, this will cause errors and mkfs/convert will reject the run due to
missing dependency features.
Change test cases that uses ^no-holes or ^fst to also disable
block-group-tree feature to avoid such false alerts.
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
tests/cli-tests/009-btrfstune/test.sh | 2 +-
tests/misc-tests/001-btrfstune-features/test.sh | 9 +++++----
tests/misc-tests/057-btrfstune-free-space-tree/test.sh | 2 +-
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/tests/cli-tests/009-btrfstune/test.sh b/tests/cli-tests/009-btrfstune/test.sh
index c3d0f0254679..e01190a53070 100755
--- a/tests/cli-tests/009-btrfstune/test.sh
+++ b/tests/cli-tests/009-btrfstune/test.sh
@@ -20,7 +20,7 @@ run_check "$TOP/btrfstune" -r "$TEST_DEV"
run_check_mkfs_test_dev -O ^skinny-metadata
run_check "$TOP/btrfstune" -x "$TEST_DEV"
-run_check_mkfs_test_dev -O ^no-holes
+run_check_mkfs_test_dev -O ^no-holes,^block-group-tree
run_check "$TOP/btrfstune" -n "$TEST_DEV"
run_check_mkfs_test_dev
diff --git a/tests/misc-tests/001-btrfstune-features/test.sh b/tests/misc-tests/001-btrfstune-features/test.sh
index 081411107aab..ee4235ffb0ef 100755
--- a/tests/misc-tests/001-btrfstune-features/test.sh
+++ b/tests/misc-tests/001-btrfstune-features/test.sh
@@ -25,7 +25,7 @@ test_feature()
tuneopt="$2"
sbflag="$3"
- run_check_mkfs_test_dev ${mkfsfeatures:+-O ^"$mkfsfeatures"}
+ run_check_mkfs_test_dev ${mkfsfeatures:+-O "$mkfsfeatures"}
if run_check_stdout "$TOP/btrfs" inspect-internal dump-super "$TEST_DEV" | \
grep -q "$sbflag"; then
_fail "FAIL: feature $sbflag must not be set on the base image"
@@ -38,7 +38,8 @@ test_feature()
run_check $SUDO_HELPER "$TOP/btrfs" check "$TEST_DEV"
}
-test_feature extref -r EXTENDED_IREF
-test_feature skinny-metadata -x SKINNY_METADATA
-test_feature no-holes -n NO_HOLES
+test_feature '^extref' -r EXTENDED_IREF
+test_feature '^skinny-metadata' -x SKINNY_METADATA
+# block group tree feature relies on no-holes, thus have to disable block-group-tree too.
+test_feature '^no-holes,^block-group-tree' -n NO_HOLES
test_feature '' '-S 1' SEEDING
diff --git a/tests/misc-tests/057-btrfstune-free-space-tree/test.sh b/tests/misc-tests/057-btrfstune-free-space-tree/test.sh
index 8d9a858ddc2f..fe5b87a1fd38 100755
--- a/tests/misc-tests/057-btrfstune-free-space-tree/test.sh
+++ b/tests/misc-tests/057-btrfstune-free-space-tree/test.sh
@@ -12,7 +12,7 @@ setup_root_helper
prepare_test_dev
check_kernel_support_acl
-run_check_mkfs_test_dev -O ^free-space-tree
+run_check_mkfs_test_dev -O ^free-space-tree,^block-group-tree
run_check_mount_test_dev
populate_fs
run_check_umount_test_dev
--
2.52.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/3] btrfs-progs: misc-tests: check if free space tree is enabled after mount
2025-11-27 5:25 [PATCH 0/3] btrfs-progs: add block-group-tree to the default mkfs/convert features Qu Wenruo
2025-11-27 5:25 ` [PATCH 1/3] btrfs-progs: tests: disable bgt feature for ^no-holes and ^fst runs Qu Wenruo
@ 2025-11-27 5:25 ` Qu Wenruo
2025-11-27 5:25 ` [PATCH 3/3] btrfs-progs: add block-group-tree to the default mkfs features Qu Wenruo
2025-11-27 5:53 ` [PATCH 0/3] btrfs-progs: add block-group-tree to the default mkfs/convert features Qu Wenruo
3 siblings, 0 replies; 5+ messages in thread
From: Qu Wenruo @ 2025-11-27 5:25 UTC (permalink / raw)
To: linux-btrfs
For bs < ps cases, a mount will always enable free-space-tree due to the
limitation of v1 space cache.
Test case misc/057 will lead to false failure if the page size is larger
than the default 4K sector size.
Add an extra check on free-space-tree after fs population, and skip the
test case if so.
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
tests/misc-tests/057-btrfstune-free-space-tree/test.sh | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tests/misc-tests/057-btrfstune-free-space-tree/test.sh b/tests/misc-tests/057-btrfstune-free-space-tree/test.sh
index fe5b87a1fd38..f4099dd639e7 100755
--- a/tests/misc-tests/057-btrfstune-free-space-tree/test.sh
+++ b/tests/misc-tests/057-btrfstune-free-space-tree/test.sh
@@ -17,6 +17,14 @@ run_check_mount_test_dev
populate_fs
run_check_umount_test_dev
+# Check if the fs has free space tree already. Currently bs < ps mount
+# will always enable free-space-tree (no support for v1 free space cache)
+if run_check_stdout "$TOP/btrfs" inspect-internal dump-super "$TEST_DEV" |\
+ grep -q "FREE_SPACE_TREE"; then
+ _not_run "free-space-tree is always enabled for page size $(getconf PAGESIZE)"
+fi
+
run_check $SUDO_HELPER "$TOP/btrfstune" --convert-to-free-space-tree "$TEST_DEV"
+
run_check "$TOP/btrfs" check "$TEST_DEV"
--
2.52.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] btrfs-progs: add block-group-tree to the default mkfs features
2025-11-27 5:25 [PATCH 0/3] btrfs-progs: add block-group-tree to the default mkfs/convert features Qu Wenruo
2025-11-27 5:25 ` [PATCH 1/3] btrfs-progs: tests: disable bgt feature for ^no-holes and ^fst runs Qu Wenruo
2025-11-27 5:25 ` [PATCH 2/3] btrfs-progs: misc-tests: check if free space tree is enabled after mount Qu Wenruo
@ 2025-11-27 5:25 ` Qu Wenruo
2025-11-27 5:53 ` [PATCH 0/3] btrfs-progs: add block-group-tree to the default mkfs/convert features Qu Wenruo
3 siblings, 0 replies; 5+ messages in thread
From: Qu Wenruo @ 2025-11-27 5:25 UTC (permalink / raw)
To: linux-btrfs
The block-group-tree feature is already considered safe since v6.6
kernels, and btrfs-progs have also improved its off-line conversion
ability (btrfstune --convert-to|from-block-group-tree).
Now it's time to make bgt feature as the default mkfs features.
This affects both mkfs and btrfs-convert.
The target merge window is v6.18.
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
Documentation/mkfs.btrfs.rst | 2 +-
common/fsfeatures.c | 2 +-
common/fsfeatures.h | 3 ++-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/Documentation/mkfs.btrfs.rst b/Documentation/mkfs.btrfs.rst
index 7734354fd6da..b4e23cc1fb24 100644
--- a/Documentation/mkfs.btrfs.rst
+++ b/Documentation/mkfs.btrfs.rst
@@ -424,7 +424,7 @@ free-space-tree
.. _mkfs-feature-block-group-tree:
block-group-tree
- (kernel support since 6.1)
+ (default since btrfs-progs v6.19, kernel support since 6.1)
Enable a dedicated b-tree for block group items, this greatly reduces
mount time for large filesystems due to better data locality that
diff --git a/common/fsfeatures.c b/common/fsfeatures.c
index 69a1b3934099..389d19b4d416 100644
--- a/common/fsfeatures.c
+++ b/common/fsfeatures.c
@@ -219,7 +219,7 @@ static const struct btrfs_feature mkfs_features[] = {
.sysfs_name = "block_group_tree",
VERSION_TO_STRING2(compat, 6,1),
VERSION_TO_STRING2(safe, 6,6),
- VERSION_NULL(default),
+ VERSION_TO_STRING2(default, 6,19),
.desc = "block group tree, more efficient block group tracking to reduce mount time"
},
#if EXPERIMENTAL
diff --git a/common/fsfeatures.h b/common/fsfeatures.h
index 3559076ba5dc..3ae8d2a5eed7 100644
--- a/common/fsfeatures.h
+++ b/common/fsfeatures.h
@@ -46,7 +46,8 @@ struct btrfs_mkfs_features {
static const struct btrfs_mkfs_features btrfs_mkfs_default_features = {
.compat_ro_flags = BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE |
- BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID,
+ BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID |
+ BTRFS_FEATURE_COMPAT_RO_BLOCK_GROUP_TREE,
.incompat_flags = BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF |
BTRFS_FEATURE_INCOMPAT_NO_HOLES |
BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA,
--
2.52.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 0/3] btrfs-progs: add block-group-tree to the default mkfs/convert features
2025-11-27 5:25 [PATCH 0/3] btrfs-progs: add block-group-tree to the default mkfs/convert features Qu Wenruo
` (2 preceding siblings ...)
2025-11-27 5:25 ` [PATCH 3/3] btrfs-progs: add block-group-tree to the default mkfs features Qu Wenruo
@ 2025-11-27 5:53 ` Qu Wenruo
3 siblings, 0 replies; 5+ messages in thread
From: Qu Wenruo @ 2025-11-27 5:53 UTC (permalink / raw)
To: linux-btrfs
在 2025/11/27 15:55, Qu Wenruo 写道:
> I was planning to do this during v6.12 but forgot it and now the next
> LTS kernel release is not that far away, it's finally time to make the
> switch.
>
> The first patch is to update the existing test cases related to
> disabling no-holes/free-space-tree, which will lead to mkfs/convert
> failure as block-group-tree requires those two features.
>
> The second patch is a large page-size specific fix, where on 64K page
> size systems misc/057 will fail due to subpage mount always enables v2
> free space cache, resulting later conversion failure to fst.
>
> The final patch is the one enabling new default block-group-tree feature
> for mkfs and convert.
>
> Qu Wenruo (3):
> btrfs-progs: tests: disable bgt feature for ^no-holes and ^fst runs
Although we can fix the test case for progs selftests, it will be a much
more complex work to address all fstests test cases.
I do not think we will really deprecate explicit holes any time soon,
thus those fstests will stay.
I'll update the series to automatically disable bgt feature instead. So
that mkfs.btrfs -O ^no-holes can still work as expected (no no-holes nor
bgt).
Thanks,
Qu
> btrfs-progs: misc-tests: check if free space tree is enabled after
> mount
> btrfs-progs: add block-group-tree to the default mkfs features
>
> Documentation/mkfs.btrfs.rst | 2 +-
> common/fsfeatures.c | 2 +-
> common/fsfeatures.h | 3 ++-
> tests/cli-tests/009-btrfstune/test.sh | 2 +-
> tests/misc-tests/001-btrfstune-features/test.sh | 9 +++++----
> tests/misc-tests/057-btrfstune-free-space-tree/test.sh | 10 +++++++++-
> 6 files changed, 19 insertions(+), 9 deletions(-)
>
> --
> 2.52.0
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread