summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tests/free-space-tests.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2021-11-05 21:45:51 +0100
committerDavid Sterba <dsterba@suse.com>2022-01-03 15:09:50 +0100
commitabed4aaae4f71a7bcdbe90a65319b6e772a2689d (patch)
tree29786ead465fab93bcd5bbe5ae4cec7fd02cb8d6 /fs/btrfs/tests/free-space-tests.c
parentbtrfs: remove useless WARN_ON in record_root_in_trans (diff)
downloadlinux-abed4aaae4f71a7bcdbe90a65319b6e772a2689d.tar.xz
linux-abed4aaae4f71a7bcdbe90a65319b6e772a2689d.zip
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/tests/free-space-tests.c')
-rw-r--r--fs/btrfs/tests/free-space-tests.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/tests/free-space-tests.c b/fs/btrfs/tests/free-space-tests.c
index 13428dec04d3..5930cdcae5cb 100644
--- a/fs/btrfs/tests/free-space-tests.c
+++ b/fs/btrfs/tests/free-space-tests.c
@@ -1036,7 +1036,10 @@ int btrfs_test_free_space_cache(u32 sectorsize, u32 nodesize)
goto out;
}
- root->fs_info->_extent_root = root;
+ root->root_key.objectid = BTRFS_EXTENT_TREE_OBJECTID;
+ root->root_key.type = BTRFS_ROOT_ITEM_KEY;
+ root->root_key.offset = 0;
+ btrfs_global_root_insert(root);
ret = test_extents(cache);
if (ret)