Commit 9db5d510 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: make btrfs_free_reserved_data_space_noquota take btrfs_fs_info

No point in taking an inode only to get btrfs_fs_info from it, instead
take btrfs_fs_info directly.
Signed-off-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 7661a3e0
...@@ -255,7 +255,7 @@ int btrfs_check_data_free_space(struct inode *inode, ...@@ -255,7 +255,7 @@ int btrfs_check_data_free_space(struct inode *inode,
/* Use new btrfs_qgroup_reserve_data to reserve precious data space. */ /* Use new btrfs_qgroup_reserve_data to reserve precious data space. */
ret = btrfs_qgroup_reserve_data(BTRFS_I(inode), reserved, start, len); ret = btrfs_qgroup_reserve_data(BTRFS_I(inode), reserved, start, len);
if (ret < 0) if (ret < 0)
btrfs_free_reserved_data_space_noquota(inode, len); btrfs_free_reserved_data_space_noquota(fs_info, len);
else else
ret = 0; ret = 0;
return ret; return ret;
...@@ -269,10 +269,9 @@ int btrfs_check_data_free_space(struct inode *inode, ...@@ -269,10 +269,9 @@ int btrfs_check_data_free_space(struct inode *inode,
* which we can't sleep and is sure it won't affect qgroup reserved space. * which we can't sleep and is sure it won't affect qgroup reserved space.
* Like clear_bit_hook(). * Like clear_bit_hook().
*/ */
void btrfs_free_reserved_data_space_noquota(struct inode *inode, void btrfs_free_reserved_data_space_noquota(struct btrfs_fs_info *fs_info,
u64 len) u64 len)
{ {
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
struct btrfs_space_info *data_sinfo; struct btrfs_space_info *data_sinfo;
ASSERT(IS_ALIGNED(len, fs_info->sectorsize)); ASSERT(IS_ALIGNED(len, fs_info->sectorsize));
...@@ -300,7 +299,7 @@ void btrfs_free_reserved_data_space(struct inode *inode, ...@@ -300,7 +299,7 @@ void btrfs_free_reserved_data_space(struct inode *inode,
round_down(start, root->fs_info->sectorsize); round_down(start, root->fs_info->sectorsize);
start = round_down(start, root->fs_info->sectorsize); start = round_down(start, root->fs_info->sectorsize);
btrfs_free_reserved_data_space_noquota(inode, len); btrfs_free_reserved_data_space_noquota(root->fs_info, len);
btrfs_qgroup_free_data(BTRFS_I(inode), reserved, start, len); btrfs_qgroup_free_data(BTRFS_I(inode), reserved, start, len);
} }
......
...@@ -13,7 +13,7 @@ void btrfs_free_reserved_data_space(struct inode *inode, ...@@ -13,7 +13,7 @@ void btrfs_free_reserved_data_space(struct inode *inode,
void btrfs_delalloc_release_space(struct inode *inode, void btrfs_delalloc_release_space(struct inode *inode,
struct extent_changeset *reserved, struct extent_changeset *reserved,
u64 start, u64 len, bool qgroup_free); u64 start, u64 len, bool qgroup_free);
void btrfs_free_reserved_data_space_noquota(struct inode *inode, void btrfs_free_reserved_data_space_noquota(struct btrfs_fs_info *fs_info,
u64 len); u64 len);
void btrfs_delalloc_release_metadata(struct btrfs_inode *inode, u64 num_bytes, void btrfs_delalloc_release_metadata(struct btrfs_inode *inode, u64 num_bytes,
bool qgroup_free); bool qgroup_free);
......
...@@ -2080,9 +2080,7 @@ void btrfs_clear_delalloc_extent(struct inode *vfs_inode, ...@@ -2080,9 +2080,7 @@ void btrfs_clear_delalloc_extent(struct inode *vfs_inode,
if (root->root_key.objectid != BTRFS_DATA_RELOC_TREE_OBJECTID && if (root->root_key.objectid != BTRFS_DATA_RELOC_TREE_OBJECTID &&
do_list && !(state->state & EXTENT_NORESERVE) && do_list && !(state->state & EXTENT_NORESERVE) &&
(*bits & EXTENT_CLEAR_DATA_RESV)) (*bits & EXTENT_CLEAR_DATA_RESV))
btrfs_free_reserved_data_space_noquota( btrfs_free_reserved_data_space_noquota(fs_info, len);
&inode->vfs_inode,
len);
percpu_counter_add_batch(&fs_info->delalloc_bytes, -len, percpu_counter_add_batch(&fs_info->delalloc_bytes, -len,
fs_info->delalloc_batch); fs_info->delalloc_batch);
...@@ -7312,7 +7310,7 @@ static int btrfs_get_blocks_direct_write(struct extent_map **map, ...@@ -7312,7 +7310,7 @@ static int btrfs_get_blocks_direct_write(struct extent_map **map,
* use the existing or preallocated extent, so does not * use the existing or preallocated extent, so does not
* need to adjust btrfs_space_info's bytes_may_use. * need to adjust btrfs_space_info's bytes_may_use.
*/ */
btrfs_free_reserved_data_space_noquota(inode, len); btrfs_free_reserved_data_space_noquota(fs_info, len);
goto skip_cow; goto skip_cow;
} }
} }
......
...@@ -2613,7 +2613,7 @@ int prealloc_file_extent_cluster(struct inode *inode, ...@@ -2613,7 +2613,7 @@ int prealloc_file_extent_cluster(struct inode *inode,
inode_unlock(inode); inode_unlock(inode);
if (cur_offset < prealloc_end) if (cur_offset < prealloc_end)
btrfs_free_reserved_data_space_noquota(inode, btrfs_free_reserved_data_space_noquota(btrfs_sb(inode->i_sb),
prealloc_end + 1 - cur_offset); prealloc_end + 1 - cur_offset);
return ret; return 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