Commit 007dec8c authored by David Sterba's avatar David Sterba

btrfs: reduce parameters of btrfs_pin_extent_for_log_replay

Both callers of btrfs_pin_extent_for_log_replay expand 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 f863c502
...@@ -2569,12 +2569,12 @@ int btrfs_pin_extent(struct btrfs_trans_handle *trans, ...@@ -2569,12 +2569,12 @@ int btrfs_pin_extent(struct btrfs_trans_handle *trans,
* this function must be called within transaction * this function must be called within transaction
*/ */
int btrfs_pin_extent_for_log_replay(struct btrfs_trans_handle *trans, int btrfs_pin_extent_for_log_replay(struct btrfs_trans_handle *trans,
u64 bytenr, u64 num_bytes) const struct extent_buffer *eb)
{ {
struct btrfs_block_group *cache; struct btrfs_block_group *cache;
int ret; int ret;
cache = btrfs_lookup_block_group(trans->fs_info, bytenr); cache = btrfs_lookup_block_group(trans->fs_info, eb->start);
if (!cache) if (!cache)
return -EINVAL; return -EINVAL;
...@@ -2586,10 +2586,10 @@ int btrfs_pin_extent_for_log_replay(struct btrfs_trans_handle *trans, ...@@ -2586,10 +2586,10 @@ int btrfs_pin_extent_for_log_replay(struct btrfs_trans_handle *trans,
if (ret) if (ret)
goto out; goto out;
pin_down_extent(trans, cache, bytenr, num_bytes, 0); pin_down_extent(trans, cache, eb->start, eb->len, 0);
/* remove us from the free space cache (if we're there at all) */ /* remove us from the free space cache (if we're there at all) */
ret = btrfs_remove_free_space(cache, bytenr, num_bytes); ret = btrfs_remove_free_space(cache, eb->start, eb->len);
out: out:
btrfs_put_block_group(cache); btrfs_put_block_group(cache);
return ret; return ret;
......
...@@ -103,7 +103,7 @@ int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans, ...@@ -103,7 +103,7 @@ int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans,
int btrfs_pin_extent(struct btrfs_trans_handle *trans, u64 bytenr, u64 num, int btrfs_pin_extent(struct btrfs_trans_handle *trans, u64 bytenr, u64 num,
int reserved); int reserved);
int btrfs_pin_extent_for_log_replay(struct btrfs_trans_handle *trans, int btrfs_pin_extent_for_log_replay(struct btrfs_trans_handle *trans,
u64 bytenr, u64 num_bytes); const struct extent_buffer *eb);
int btrfs_exclude_logged_extents(struct extent_buffer *eb); int btrfs_exclude_logged_extents(struct extent_buffer *eb);
int btrfs_cross_ref_exist(struct btrfs_root *root, int btrfs_cross_ref_exist(struct btrfs_root *root,
u64 objectid, u64 offset, u64 bytenr, bool strict, u64 objectid, u64 offset, u64 bytenr, bool strict,
......
...@@ -347,8 +347,7 @@ static int process_one_buffer(struct btrfs_root *log, ...@@ -347,8 +347,7 @@ static int process_one_buffer(struct btrfs_root *log,
} }
if (wc->pin) { if (wc->pin) {
ret = btrfs_pin_extent_for_log_replay(wc->trans, eb->start, ret = btrfs_pin_extent_for_log_replay(wc->trans, eb);
eb->len);
if (ret) if (ret)
return ret; return ret;
...@@ -7203,9 +7202,7 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree) ...@@ -7203,9 +7202,7 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)
* each subsequent pass. * each subsequent pass.
*/ */
if (ret == -ENOENT) if (ret == -ENOENT)
ret = btrfs_pin_extent_for_log_replay(trans, ret = btrfs_pin_extent_for_log_replay(trans, log->node);
log->node->start,
log->node->len);
btrfs_put_root(log); btrfs_put_root(log);
if (!ret) if (!ret)
......
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