summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/free-space-tree.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2021-12-15 15:40:08 -0500
committerDavid Sterba <dsterba@suse.com>2022-03-14 13:13:49 +0100
commitf7238e5094048f20ab6f92d7c2f5ec50fc247f26 (patch)
tree424a7ed9cc73b2c7ecfe1973590b442ffcee6abf /fs/btrfs/free-space-tree.c
parent9c54e80ddc6bd89596a4046d451908700476fd14 (diff)
downloadlinux-f7238e5094048f20ab6f92d7c2f5ec50fc247f26.tar.gz
linux-f7238e5094048f20ab6f92d7c2f5ec50fc247f26.tar.bz2
linux-f7238e5094048f20ab6f92d7c2f5ec50fc247f26.zip
btrfs: add support for multiple global roots
With extent tree v2 you will be able to create multiple csum, extent, and free space trees. They will be used based on the block group, which will now use the block_group_item->chunk_objectid to point to the set of global roots that it will use. When allocating new block groups we'll simply mod the gigabyte offset of the block group against the number of global roots we have and that will be the block groups global id. >From there we can take the bytenr that we're modifying in the respective tree, look up the block group and get that block groups corresponding global root id. From there we can get to the appropriate global root for that bytenr. Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/free-space-tree.c')
-rw-r--r--fs/btrfs/free-space-tree.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/free-space-tree.c b/fs/btrfs/free-space-tree.c
index 655aad0f9e1c..0ae54d8c10d6 100644
--- a/fs/btrfs/free-space-tree.c
+++ b/fs/btrfs/free-space-tree.c
@@ -25,6 +25,8 @@ static struct btrfs_root *btrfs_free_space_root(
.offset = 0,
};
+ if (btrfs_fs_incompat(block_group->fs_info, EXTENT_TREE_V2))
+ key.offset = block_group->global_root_id;
return btrfs_global_root(block_group->fs_info, &key);
}