Commit f863c502 authored by David Sterba's avatar David Sterba

btrfs: reduce parameters of btrfs_pin_reserved_extent

There is only one caller of btrfs_pin_reserved_extent that expands the
parameters to extent buffer members. We can simply pass the extent
buffer instead.
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 203f6a87
...@@ -4562,20 +4562,20 @@ int btrfs_free_reserved_extent(struct btrfs_fs_info *fs_info, ...@@ -4562,20 +4562,20 @@ int btrfs_free_reserved_extent(struct btrfs_fs_info *fs_info,
return 0; return 0;
} }
int btrfs_pin_reserved_extent(struct btrfs_trans_handle *trans, u64 start, int btrfs_pin_reserved_extent(struct btrfs_trans_handle *trans,
u64 len) const struct extent_buffer *eb)
{ {
struct btrfs_block_group *cache; struct btrfs_block_group *cache;
int ret = 0; int ret = 0;
cache = btrfs_lookup_block_group(trans->fs_info, start); cache = btrfs_lookup_block_group(trans->fs_info, eb->start);
if (!cache) { if (!cache) {
btrfs_err(trans->fs_info, "unable to find block group for %llu", btrfs_err(trans->fs_info, "unable to find block group for %llu",
start); eb->start);
return -ENOSPC; return -ENOSPC;
} }
ret = pin_down_extent(trans, cache, start, len, 1); ret = pin_down_extent(trans, cache, eb->start, eb->len, 1);
btrfs_put_block_group(cache); btrfs_put_block_group(cache);
return ret; return ret;
} }
......
...@@ -139,7 +139,8 @@ int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_ref *ref); ...@@ -139,7 +139,8 @@ int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_ref *ref);
int btrfs_free_reserved_extent(struct btrfs_fs_info *fs_info, int btrfs_free_reserved_extent(struct btrfs_fs_info *fs_info,
u64 start, u64 len, int delalloc); u64 start, u64 len, int delalloc);
int btrfs_pin_reserved_extent(struct btrfs_trans_handle *trans, u64 start, u64 len); int btrfs_pin_reserved_extent(struct btrfs_trans_handle *trans,
const struct extent_buffer *eb);
int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans); int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans);
int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, struct btrfs_ref *generic_ref); int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, struct btrfs_ref *generic_ref);
int btrfs_drop_snapshot(struct btrfs_root *root, int update_ref, int btrfs_drop_snapshot(struct btrfs_root *root, int update_ref,
......
...@@ -2574,7 +2574,7 @@ static int clean_log_buffer(struct btrfs_trans_handle *trans, ...@@ -2574,7 +2574,7 @@ static int clean_log_buffer(struct btrfs_trans_handle *trans,
btrfs_tree_unlock(eb); btrfs_tree_unlock(eb);
if (trans) { if (trans) {
ret = btrfs_pin_reserved_extent(trans, eb->start, eb->len); ret = btrfs_pin_reserved_extent(trans, eb);
if (ret) if (ret)
return ret; return ret;
btrfs_redirty_list_add(trans->transaction, eb); btrfs_redirty_list_add(trans->transaction, eb);
......
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