diff --git a/Documentation/btrfstune.rst b/Documentation/btrfstune.rst index 40183fb2..d3543a47 100644 --- a/Documentation/btrfstune.rst +++ b/Documentation/btrfstune.rst @@ -24,16 +24,18 @@ means. Please refer to the *FILESYSTEM FEATURES* in :doc:`btrfs(5)` OPTIONS ------- ---enable-block-group-tree - (since kernel 6.1) - Enable block group tree feature (greatly reduce mount time), - enabled by mkfs feature *block-group-tree*. - ---disable-block-group-tree +--convert-to-block-group-tree (since kernel 6.1) - Disable block group tree feature and convert the filesystem to extent - tree. + Convert portions of extent tree that tracks block groups to a separate + block gruop tree. This greatly reduces mount time. Can be also enabled + at mkfs time. + +--convert-from-block-group-tree + (since kernel 6.1) + + Convert block groups tracked in standalone block group tree back to + extent tree and remove 'block-group-tree' feature bit from the filesystem. -f Allow dangerous changes, e.g. clear the seeding flag or change fsid. diff --git a/tests/mkfs-tests/026-extent-tree-to-bgt/test.sh b/tests/mkfs-tests/026-extent-tree-to-bgt/test.sh index 23406070..65ca23e7 100755 --- a/tests/mkfs-tests/026-extent-tree-to-bgt/test.sh +++ b/tests/mkfs-tests/026-extent-tree-to-bgt/test.sh @@ -13,13 +13,13 @@ run_check_umount_test_dev run_check "$TOP/btrfs" inspect-internal dump-tree "$TEST_DEV" run_check "$TOP/btrfs" inspect-internal dump-super "$TEST_DEV" -run_check "$TOP/btrfstune" --enable-block-group-tree "$TEST_DEV" +run_check "$TOP/btrfstune" --convert-to-block-group-tree "$TEST_DEV" _log "=== AFTER CONVERSION ===" run_check "$TOP/btrfs" inspect-internal dump-tree "$TEST_DEV" run_check "$TOP/btrfs" inspect-internal dump-super "$TEST_DEV" run_check "$TOP/btrfs" check "$TEST_DEV" _log "=== BACK CONVERSION ===" -run_check "$TOP/btrfstune" --disable-block-group-tree "$TEST_DEV" +run_check "$TOP/btrfstune" --convert-from-block-group-tree "$TEST_DEV" run_check "$TOP/btrfs" inspect-internal dump-tree "$TEST_DEV" run_check "$TOP/btrfs" inspect-internal dump-super "$TEST_DEV" run_check "$TOP/btrfs" check "$TEST_DEV" diff --git a/tune/main.c b/tune/main.c index 2a98c209..891bea14 100644 --- a/tune/main.c +++ b/tune/main.c @@ -70,8 +70,10 @@ static const char * const tune_usage[] = { OPTLINE("-x", "enable skinny metadata extent refs (mkfs: skinny-metadata)"), OPTLINE("-n", "enable no-holes feature (mkfs: no-holes, more efficient sparse file representation)"), OPTLINE("-S <0|1>", "set/unset seeding status of a device"), - OPTLINE("--enable-block-group-tree", "enable block group tree (mkfs: block-group-tree, for less mount time)"), - OPTLINE("--disable-block-group-tree", "disable block group tree (mkfs: ^block-group-tree)n"), + OPTLINE("--convert-to-block-group-tree", "convert filesystem to track block groups in " + "the separate block-group-tree instead of extent tree (sets the incompat bit)"), + OPTLINE("--convert-from-block-group-tree", + "convert the block group tree back to extent tree (remove the incompat bit)"), "", "UUID changes:", OPTLINE("-u", "rewrite fsid, use a random one"), @@ -120,9 +122,9 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) GETOPT_VAL_DISABLE_BLOCK_GROUP_TREE }; static const struct option long_options[] = { { "help", no_argument, NULL, GETOPT_VAL_HELP}, - { "enable-block-group-tree", no_argument, NULL, + { "convert-to-block-group-tree", no_argument, NULL, GETOPT_VAL_ENABLE_BLOCK_GROUP_TREE}, - { "disable-block-group-tree", no_argument, NULL, + { "convert-from-block-group-tree", no_argument, NULL, GETOPT_VAL_DISABLE_BLOCK_GROUP_TREE}, #if EXPERIMENTAL { "csum", required_argument, NULL, GETOPT_VAL_CSUM }, @@ -246,7 +248,7 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) if (to_bg_tree) { if (to_extent_tree) { - error("option --enable-block-group-tree conflicts with --disable-block-group-tree"); + error("option --convert-to-block-group-tree conflicts with --convert-from-block-group-tree"); ret = 1; goto out; } @@ -269,7 +271,7 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) } if (to_extent_tree) { if (to_bg_tree) { - error("option --enable-block-group-tree conflicts with --disable-block-group-tree"); + error("option --convert-to-block-group-tree conflicts with --convert-from-block-group-tree"); ret = 1; goto out; }