Commit 85bb9f54 authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

btrfs: drop unnecessary arguments from __btrfs_free_extent

We have all the information we need in our btrfs_delayed_ref_node, which
we already pass into __btrfs_free_extent.  Drop the extra arguments and
just extract the values from btrfs_delayed_ref_node.
Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent a502f112
...@@ -46,9 +46,7 @@ ...@@ -46,9 +46,7 @@
static int __btrfs_free_extent(struct btrfs_trans_handle *trans, static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
struct btrfs_delayed_ref_head *href, struct btrfs_delayed_ref_head *href,
struct btrfs_delayed_ref_node *node, u64 parent, struct btrfs_delayed_ref_node *node,
u64 root_objectid, u64 owner_objectid,
u64 owner_offset,
struct btrfs_delayed_extent_op *extra_op); struct btrfs_delayed_extent_op *extra_op);
static void __run_delayed_extent_op(struct btrfs_delayed_extent_op *extent_op, static void __run_delayed_extent_op(struct btrfs_delayed_extent_op *extent_op,
struct extent_buffer *leaf, struct extent_buffer *leaf,
...@@ -1586,9 +1584,7 @@ static int run_delayed_data_ref(struct btrfs_trans_handle *trans, ...@@ -1586,9 +1584,7 @@ static int run_delayed_data_ref(struct btrfs_trans_handle *trans,
} else if (node->action == BTRFS_ADD_DELAYED_REF) { } else if (node->action == BTRFS_ADD_DELAYED_REF) {
ret = __btrfs_inc_extent_ref(trans, node, extent_op); ret = __btrfs_inc_extent_ref(trans, node, extent_op);
} else if (node->action == BTRFS_DROP_DELAYED_REF) { } else if (node->action == BTRFS_DROP_DELAYED_REF) {
ret = __btrfs_free_extent(trans, href, node, parent, ret = __btrfs_free_extent(trans, href, node, extent_op);
node->ref_root, ref->objectid,
ref->offset, extent_op);
} else { } else {
BUG(); BUG();
} }
...@@ -1710,11 +1706,9 @@ static int run_delayed_tree_ref(struct btrfs_trans_handle *trans, ...@@ -1710,11 +1706,9 @@ static int run_delayed_tree_ref(struct btrfs_trans_handle *trans,
{ {
int ret = 0; int ret = 0;
struct btrfs_fs_info *fs_info = trans->fs_info; struct btrfs_fs_info *fs_info = trans->fs_info;
struct btrfs_delayed_tree_ref *ref;
u64 parent = 0; u64 parent = 0;
u64 ref_root = 0; u64 ref_root = 0;
ref = btrfs_delayed_node_to_tree_ref(node);
trace_run_delayed_tree_ref(trans->fs_info, node); trace_run_delayed_tree_ref(trans->fs_info, node);
if (node->type == BTRFS_SHARED_BLOCK_REF_KEY) if (node->type == BTRFS_SHARED_BLOCK_REF_KEY)
...@@ -1744,8 +1738,7 @@ static int run_delayed_tree_ref(struct btrfs_trans_handle *trans, ...@@ -1744,8 +1738,7 @@ static int run_delayed_tree_ref(struct btrfs_trans_handle *trans,
} else if (node->action == BTRFS_ADD_DELAYED_REF) { } else if (node->action == BTRFS_ADD_DELAYED_REF) {
ret = __btrfs_inc_extent_ref(trans, node, extent_op); ret = __btrfs_inc_extent_ref(trans, node, extent_op);
} else if (node->action == BTRFS_DROP_DELAYED_REF) { } else if (node->action == BTRFS_DROP_DELAYED_REF) {
ret = __btrfs_free_extent(trans, href, node, parent, ref_root, ret = __btrfs_free_extent(trans, href, node, extent_op);
ref->level, 0, extent_op);
} else { } else {
BUG(); BUG();
} }
...@@ -3077,9 +3070,7 @@ static int do_free_extent_accounting(struct btrfs_trans_handle *trans, ...@@ -3077,9 +3070,7 @@ static int do_free_extent_accounting(struct btrfs_trans_handle *trans,
*/ */
static int __btrfs_free_extent(struct btrfs_trans_handle *trans, static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
struct btrfs_delayed_ref_head *href, struct btrfs_delayed_ref_head *href,
struct btrfs_delayed_ref_node *node, u64 parent, struct btrfs_delayed_ref_node *node,
u64 root_objectid, u64 owner_objectid,
u64 owner_offset,
struct btrfs_delayed_extent_op *extent_op) struct btrfs_delayed_extent_op *extent_op)
{ {
struct btrfs_fs_info *info = trans->fs_info; struct btrfs_fs_info *info = trans->fs_info;
...@@ -3099,6 +3090,8 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans, ...@@ -3099,6 +3090,8 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
u64 refs; u64 refs;
u64 bytenr = node->bytenr; u64 bytenr = node->bytenr;
u64 num_bytes = node->num_bytes; u64 num_bytes = node->num_bytes;
u64 owner_objectid = btrfs_delayed_ref_owner(node);
u64 owner_offset = btrfs_delayed_ref_offset(node);
bool skinny_metadata = btrfs_fs_incompat(info, SKINNY_METADATA); bool skinny_metadata = btrfs_fs_incompat(info, SKINNY_METADATA);
u64 delayed_ref_root = href->owning_root; u64 delayed_ref_root = href->owning_root;
...@@ -3124,7 +3117,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans, ...@@ -3124,7 +3117,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
skinny_metadata = false; skinny_metadata = false;
ret = lookup_extent_backref(trans, path, &iref, bytenr, num_bytes, ret = lookup_extent_backref(trans, path, &iref, bytenr, num_bytes,
parent, root_objectid, owner_objectid, node->parent, node->ref_root, owner_objectid,
owner_offset); owner_offset);
if (ret == 0) { if (ret == 0) {
/* /*
...@@ -3226,7 +3219,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans, ...@@ -3226,7 +3219,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
} else if (WARN_ON(ret == -ENOENT)) { } else if (WARN_ON(ret == -ENOENT)) {
abort_and_dump(trans, path, abort_and_dump(trans, path,
"unable to find ref byte nr %llu parent %llu root %llu owner %llu offset %llu slot %d", "unable to find ref byte nr %llu parent %llu root %llu owner %llu offset %llu slot %d",
bytenr, parent, root_objectid, owner_objectid, bytenr, node->parent, node->ref_root, owner_objectid,
owner_offset, path->slots[0]); owner_offset, path->slots[0]);
goto out; goto out;
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment