Commit af9b8a0e authored by Lu Fengqi's avatar Lu Fengqi Committed by David Sterba

btrfs: remove fs_info from btrfs_check_space_for_delayed_refs

It can be referenced from the transaction handle.
Signed-off-by: default avatarLu Fengqi <lufq.fnst@cn.fujitsu.com>
Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 9e920a6f
...@@ -2600,8 +2600,7 @@ static inline u64 btrfs_calc_trunc_metadata_size(struct btrfs_fs_info *fs_info, ...@@ -2600,8 +2600,7 @@ static inline u64 btrfs_calc_trunc_metadata_size(struct btrfs_fs_info *fs_info,
int btrfs_should_throttle_delayed_refs(struct btrfs_trans_handle *trans, int btrfs_should_throttle_delayed_refs(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info); struct btrfs_fs_info *fs_info);
int btrfs_check_space_for_delayed_refs(struct btrfs_trans_handle *trans, int btrfs_check_space_for_delayed_refs(struct btrfs_trans_handle *trans);
struct btrfs_fs_info *fs_info);
void btrfs_dec_block_group_reservations(struct btrfs_fs_info *fs_info, void btrfs_dec_block_group_reservations(struct btrfs_fs_info *fs_info,
const u64 start); const u64 start);
void btrfs_wait_block_group_reservations(struct btrfs_block_group_cache *bg); void btrfs_wait_block_group_reservations(struct btrfs_block_group_cache *bg);
......
...@@ -2789,9 +2789,9 @@ u64 btrfs_csum_bytes_to_leaves(struct btrfs_fs_info *fs_info, u64 csum_bytes) ...@@ -2789,9 +2789,9 @@ u64 btrfs_csum_bytes_to_leaves(struct btrfs_fs_info *fs_info, u64 csum_bytes)
return num_csums; return num_csums;
} }
int btrfs_check_space_for_delayed_refs(struct btrfs_trans_handle *trans, int btrfs_check_space_for_delayed_refs(struct btrfs_trans_handle *trans)
struct btrfs_fs_info *fs_info)
{ {
struct btrfs_fs_info *fs_info = trans->fs_info;
struct btrfs_block_rsv *global_rsv; struct btrfs_block_rsv *global_rsv;
u64 num_heads = trans->transaction->delayed_refs.num_heads_ready; u64 num_heads = trans->transaction->delayed_refs.num_heads_ready;
u64 csum_bytes = trans->transaction->delayed_refs.pending_csums; u64 csum_bytes = trans->transaction->delayed_refs.pending_csums;
...@@ -2842,7 +2842,7 @@ int btrfs_should_throttle_delayed_refs(struct btrfs_trans_handle *trans, ...@@ -2842,7 +2842,7 @@ int btrfs_should_throttle_delayed_refs(struct btrfs_trans_handle *trans,
if (val >= NSEC_PER_SEC / 2) if (val >= NSEC_PER_SEC / 2)
return 2; return 2;
return btrfs_check_space_for_delayed_refs(trans, fs_info); return btrfs_check_space_for_delayed_refs(trans);
} }
struct async_delayed_refs { struct async_delayed_refs {
......
...@@ -5319,7 +5319,7 @@ static struct btrfs_trans_handle *evict_refill_and_join(struct btrfs_root *root, ...@@ -5319,7 +5319,7 @@ static struct btrfs_trans_handle *evict_refill_and_join(struct btrfs_root *root,
* Try to steal from the global reserve if there is space for * Try to steal from the global reserve if there is space for
* it. * it.
*/ */
if (!btrfs_check_space_for_delayed_refs(trans, fs_info) && if (!btrfs_check_space_for_delayed_refs(trans) &&
!btrfs_block_rsv_migrate(global_rsv, rsv, rsv->size, false)) !btrfs_block_rsv_migrate(global_rsv, rsv, rsv->size, false))
return trans; return trans;
......
...@@ -760,7 +760,7 @@ static int should_end_transaction(struct btrfs_trans_handle *trans) ...@@ -760,7 +760,7 @@ static int should_end_transaction(struct btrfs_trans_handle *trans)
{ {
struct btrfs_fs_info *fs_info = trans->fs_info; struct btrfs_fs_info *fs_info = trans->fs_info;
if (btrfs_check_space_for_delayed_refs(trans, fs_info)) if (btrfs_check_space_for_delayed_refs(trans))
return 1; return 1;
return !!btrfs_block_rsv_check(&fs_info->global_block_rsv, 5); return !!btrfs_block_rsv_check(&fs_info->global_block_rsv, 5);
......
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