3c555beabf
There are two different subvolume/data reloc tree creation routines: - create_subvol() from convert/main.c * calls btrfs_copy_root() to create an empty root This is not safe, as it relies on the source root to be empty. * calls btrfs_read_fs_root() to add it to the cache and trace it properly * calls btrfs_make_root_dir() to initialize the empty new root - create_data_reloc_tree() from mkfs/main.c * calls btrfs_create_tree() to create an empty root * Manually add the root to fs_root cache This is only safe for data reloc tree as it's never updated inside btrfs-progs. But not safe for other subvolume trees. * manually setup the root dir Both have their good and bad aspects, so here we introduce a new helper, btrfs_make_subvolume(): - Calls btrfs_create_tree() to create an empty root - Calls btrfs_read_fs_root() to setup the cache and tracking properly - Calls btrfs_make_root_dir() to initialize the root dir - Calls btrfs_update_root() to reflect the rootdir change So this new helper can replace both create_subvol() and create_data_reloc_tree(). Signed-off-by: Qu Wenruo <wqu@suse.com> |
||
---|---|---|
.. | ||
common.h | ||
main.c | ||
mode-common.c | ||
mode-common.h | ||
mode-lowmem.c | ||
mode-lowmem.h | ||
mode-original.h | ||
qgroup-verify.c | ||
qgroup-verify.h | ||
repair.c | ||
repair.h |