mirror of
https://github.com/kdave/btrfs-progs
synced 2025-01-20 20:50:50 +00:00
92d92e99b7
Add a runtime feature (-R) flag for the free space tree. A filesystem that is mkfs'd with -R free-space-tree then mounted with no options has the same contents as one mkfs'd without the option, then mounted with '-o space_cache=v2'. The only tricky thing is in exactly how to call the tree creation code. Using btrfs_create_free_space_tree as is did not quite work, because an extra reference to the eb (root->commit_root) is leaked, which mkfs complains about with a warning. I opted to follow how the uuid tree is created by adding it to the dirty roots list for cleanup by commit_tree_roots in commit_transaction. As a result, btrfs_create_free_space_tree no longer exactly matches the version in the kernel sources. Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Boris Burkov <boris@bur.io> Signed-off-by: David Sterba <dsterba@suse.com>
18 lines
537 B
Bash
Executable File
18 lines
537 B
Bash
Executable File
#!/bin/bash
|
|
# Basic check if mkfs supports the runtime feature free-space-tree
|
|
|
|
source "$TEST_TOP/common"
|
|
|
|
check_prereq mkfs.btrfs
|
|
check_prereq btrfs
|
|
|
|
setup_root_helper
|
|
prepare_test_dev
|
|
|
|
run_check_mkfs_test_dev -R free-space-tree
|
|
|
|
run_check_stdout $SUDO_HELPER "$TOP/btrfs" inspect-internal dump-super "$TEST_DEV" | \
|
|
grep -q FREE_SPACE_TREE || _fail "free space tree not created"
|
|
run_check_stdout $SUDO_HELPER "$TOP/btrfs" inspect-internal dump-super "$TEST_DEV" | \
|
|
grep -q FREE_SPACE_TREE_VALID || _fail "free space tree not valid"
|