diff mbox series

[04/18] btrfs-progs: pass root_id for btrfs_free_tree_block

Message ID 1f77ce90dbec9e4e26590b6ea83ff5e6f6df404a.1681939316.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: more prep work for syncing ctree.c | expand

Commit Message

Josef Bacik April 19, 2023, 9:23 p.m. UTC
In the kernel we pass in the root_id for btrfs_free_tree_block instead
of the root itself.  Update the btrfs-progs version of the helper to
match what we do in the kernel.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 cmds/rescue.c               | 3 ++-
 kernel-shared/ctree.h       | 6 ++----
 kernel-shared/disk-io.c     | 2 +-
 kernel-shared/extent-tree.c | 9 +++------
 4 files changed, 8 insertions(+), 12 deletions(-)
diff mbox series

Patch

diff --git a/cmds/rescue.c b/cmds/rescue.c
index b84166ea..5551374d 100644
--- a/cmds/rescue.c
+++ b/cmds/rescue.c
@@ -343,7 +343,8 @@  static int clear_uuid_tree(struct btrfs_fs_info *fs_info)
 	ret = btrfs_clear_buffer_dirty(uuid_root->node);
 	if (ret < 0)
 		goto out;
-	ret = btrfs_free_tree_block(trans, uuid_root, uuid_root->node, 0, 1);
+	ret = btrfs_free_tree_block(trans, btrfs_root_id(uuid_root),
+				    uuid_root->node, 0, 1);
 	if (ret < 0)
 		goto out;
 	free_extent_buffer(uuid_root->node);
diff --git a/kernel-shared/ctree.h b/kernel-shared/ctree.h
index 2f41b58d..c892d707 100644
--- a/kernel-shared/ctree.h
+++ b/kernel-shared/ctree.h
@@ -870,10 +870,8 @@  int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
 		  struct extent_buffer *buf, int record_parent);
 int btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
 		  struct extent_buffer *buf, int record_parent);
-int btrfs_free_tree_block(struct btrfs_trans_handle *trans,
-			  struct btrfs_root *root,
-			  struct extent_buffer *buf,
-			  u64 parent, int last_ref);
+int btrfs_free_tree_block(struct btrfs_trans_handle *trans, u64 root_id,
+			  struct extent_buffer *buf, u64 parent, int last_ref);
 int btrfs_free_extent(struct btrfs_trans_handle *trans,
 		      u64 bytenr, u64 num_bytes, u64 parent,
 		      u64 root_objectid, u64 owner, u64 offset);
diff --git a/kernel-shared/disk-io.c b/kernel-shared/disk-io.c
index 7bbcc381..9d93f331 100644
--- a/kernel-shared/disk-io.c
+++ b/kernel-shared/disk-io.c
@@ -2301,7 +2301,7 @@  int btrfs_delete_and_free_root(struct btrfs_trans_handle *trans,
 	ret = btrfs_clear_buffer_dirty(root->node);
 	if (ret)
 		return ret;
-	ret = btrfs_free_tree_block(trans, root, root->node, 0, 1);
+	ret = btrfs_free_tree_block(trans, btrfs_root_id(root), root->node, 0, 1);
 	if (ret)
 		return ret;
 	if (is_global_root(root))
diff --git a/kernel-shared/extent-tree.c b/kernel-shared/extent-tree.c
index 8d4483cd..5c33fd53 100644
--- a/kernel-shared/extent-tree.c
+++ b/kernel-shared/extent-tree.c
@@ -2140,13 +2140,10 @@  fail:
 	return ret;
 }
 
-int btrfs_free_tree_block(struct btrfs_trans_handle *trans,
-			  struct btrfs_root *root,
-			  struct extent_buffer *buf,
-			  u64 parent, int last_ref)
+int btrfs_free_tree_block(struct btrfs_trans_handle *trans, u64 root_id,
+			  struct extent_buffer *buf, u64 parent, int last_ref)
 {
-	return btrfs_free_extent(trans, buf->start, buf->len, parent,
-				 root->root_key.objectid,
+	return btrfs_free_extent(trans, buf->start, buf->len, parent, root_id,
 				 btrfs_header_level(buf), 0);
 }