summaryrefslogtreecommitdiff
path: root/fs/btrfs/disk-io.h
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2021-11-05 23:45:51 +0300
committerDavid Sterba <dsterba@suse.com>2022-01-03 17:09:50 +0300
commitabed4aaae4f71a7bcdbe90a65319b6e772a2689d (patch)
tree29786ead465fab93bcd5bbe5ae4cec7fd02cb8d6 /fs/btrfs/disk-io.h
parent7fcf8a0050df003776d10602c9c52b57212f3345 (diff)
downloadlinux-abed4aaae4f71a7bcdbe90a65319b6e772a2689d.tar.xz
btrfs: track the csum, extent, and free space trees in a rb tree
In the future we are going to have multiple copies of these trees. To facilitate this we need a way to lookup the different roots we are looking for. Handle this by adding a global root rb tree that is indexed on the root->root_key. Then instead of loading the roots at mount time with individually targeted keys, simply search the tree_root for anything with the specific objectid we want. This will make it straightforward to support both old style and new style file systems. Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/disk-io.h')
-rw-r--r--fs/btrfs/disk-io.h18
1 files changed, 6 insertions, 12 deletions
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h
index a4d1788acd24..5e8bef4b7563 100644
--- a/fs/btrfs/disk-io.h
+++ b/fs/btrfs/disk-io.h
@@ -71,6 +71,12 @@ struct btrfs_root *btrfs_get_new_fs_root(struct btrfs_fs_info *fs_info,
struct btrfs_root *btrfs_get_fs_root_commit_root(struct btrfs_fs_info *fs_info,
struct btrfs_path *path,
u64 objectid);
+int btrfs_global_root_insert(struct btrfs_root *root);
+void btrfs_global_root_delete(struct btrfs_root *root);
+struct btrfs_root *btrfs_global_root(struct btrfs_fs_info *fs_info,
+ struct btrfs_key *key);
+struct btrfs_root *btrfs_csum_root(struct btrfs_fs_info *fs_info, u64 bytenr);
+struct btrfs_root *btrfs_extent_root(struct btrfs_fs_info *fs_info, u64 bytenr);
void btrfs_free_fs_info(struct btrfs_fs_info *fs_info);
int btrfs_cleanup_fs_roots(struct btrfs_fs_info *fs_info);
@@ -103,18 +109,6 @@ static inline struct btrfs_root *btrfs_grab_root(struct btrfs_root *root)
return NULL;
}
-static inline struct btrfs_root *btrfs_extent_root(struct btrfs_fs_info *fs_info,
- u64 bytenr)
-{
- return fs_info->_extent_root;
-}
-
-static inline struct btrfs_root *btrfs_csum_root(struct btrfs_fs_info *fs_info,
- u64 bytenr)
-{
- return fs_info->_csum_root;
-}
-
static inline struct btrfs_root *btrfs_block_group_root(struct btrfs_fs_info *fs_info)
{
return btrfs_extent_root(fs_info, 0);