mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-21 23:57:36 -04:00
btrfs: use min_size variable to setup block rsv in btrfs_replace_file_extents()
There's no need to calculate again the size for the temporary block reserve in btrfs_replace_file_extents() - we have already calculated it and stored it in the 'min_size' variable. So use the variable to make it more clear and also make the variable const since it's not supposed to change during the whole function. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
committed by
David Sterba
parent
18d32b0013
commit
2d1e969b44
@@ -2381,7 +2381,7 @@ int btrfs_replace_file_extents(struct btrfs_inode *inode,
|
||||
struct btrfs_drop_extents_args drop_args = { 0 };
|
||||
struct btrfs_root *root = inode->root;
|
||||
struct btrfs_fs_info *fs_info = root->fs_info;
|
||||
u64 min_size = btrfs_calc_insert_metadata_size(fs_info, 1);
|
||||
const u64 min_size = btrfs_calc_insert_metadata_size(fs_info, 1);
|
||||
u64 ino_size = round_up(inode->vfs_inode.i_size, fs_info->sectorsize);
|
||||
struct btrfs_trans_handle *trans = NULL;
|
||||
struct btrfs_block_rsv rsv;
|
||||
@@ -2394,7 +2394,7 @@ int btrfs_replace_file_extents(struct btrfs_inode *inode,
|
||||
return -EINVAL;
|
||||
|
||||
btrfs_init_metadata_block_rsv(fs_info, &rsv, BTRFS_BLOCK_RSV_TEMP);
|
||||
rsv.size = btrfs_calc_insert_metadata_size(fs_info, 1);
|
||||
rsv.size = min_size;
|
||||
rsv.failfast = true;
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user