btrfs-progs: pass root_id for btrfs_free_tree_block

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>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Josef Bacik 2023-04-19 17:23:55 -04:00 committed by David Sterba
parent 888a2b6a0c
commit 6da52f41c7
4 changed files with 8 additions and 12 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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))

View File

@ -2139,13 +2139,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);
}