diff mbox series

[16/19] btrfs: relocation: Open-code read_fs_root() for handle_one_tree_backref()

Message ID 20200303071409.57982-17-wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs: Move generic backref cache build functions to backref.c | expand

Commit Message

Qu Wenruo March 3, 2020, 7:14 a.m. UTC
The backref code is going to be moved to backref.c, and read_fs_root()
is just a simple wrapper, open-code it to prepare to the incoming code
move.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 fs/btrfs/relocation.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 2230ea8a3698..441d2b28d8e7 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -397,6 +397,7 @@  static int handle_one_tree_backref(struct backref_cache *cache,
 	struct backref_node *lower;
 	struct backref_edge *edge;
 	struct extent_buffer *eb;
+	struct btrfs_key root_key;
 	struct btrfs_root *root;
 	struct rb_node *rb_node;
 	bool need_check = true;
@@ -456,7 +457,10 @@  static int handle_one_tree_backref(struct backref_cache *cache,
 	 * ref_key.type == BTRFS_TREE_BLOCK_REF_KEY, ref_key->offset means the
 	 * root objectid. We need to search the tree to get its parent bytenr.
 	 */
-	root = read_fs_root(fs_info, ref_key->offset);
+	root_key.objectid = ref_key->offset;
+	root_key.type = BTRFS_ROOT_ITEM_KEY;
+	root_key.offset = (u64)-1;
+	root = btrfs_get_fs_root(fs_info, &root_key, false);
 	if (IS_ERR(root))
 		return PTR_ERR(root);
 	if (!test_bit(BTRFS_ROOT_REF_COWS, &root->state))