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: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2023-09-08 01:09:31 +02:00
parent f863c50277
commit 007dec8c7e
3 changed files with 7 additions and 10 deletions

View File

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

View File

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

View File

@ -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 @@ again:
* 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)