mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-18 12:25:12 +00:00
cc4a249e99
In mkfs_btrfs(), we have a btrfs_mkfs_block array to store how many tree blocks we need to reserve for the initial btrfs image. Currently we have two very similar arrays, extent_tree_v1_blocks and extent_tree_v2_blocks. The only difference is just v2 has an extra block for block group tree. This patch will add two helpers, mkfs_blocks_add() and mkfs_blocks_remove() to properly add/remove one block dynamically from the array. This allows 3 things: - Merge extent_tree_v1_blocks and extent_tree_v2_blocks into one array The new array will be the same as extent_tree_v1_blocks. For extent-tree-v2, we just dynamically add MKFS_BLOCK_GROUP_TREE. - Remove free space tree block on-demand This only works for extent-tree-v1 case, as v2 has a hard requirement on free space tree. But this still make code much cleaner, not doing any special hacks. - Allow future expansion without introduce new array I strongly doubt why this is not properly done in extent-tree-v2 preparation patches. We should not allow bad practice to sneak in just because it's some preparation patches for a larger feature. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com> |
||
---|---|---|
.. | ||
common.c | ||
common.h | ||
main.c | ||
Makefile | ||
rootdir.c | ||
rootdir.h |