Commit 7661a3e0 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: make btrfs_qgroup_reserve_data take btrfs_inode

There's only a single use of vfs_inode in a tracepoint so let's take
btrfs_inode 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 088545f6
...@@ -253,7 +253,7 @@ int btrfs_check_data_free_space(struct inode *inode, ...@@ -253,7 +253,7 @@ int btrfs_check_data_free_space(struct inode *inode,
return ret; return ret;
/* 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(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(inode, len);
else else
......
...@@ -3213,7 +3213,7 @@ static int btrfs_zero_range(struct inode *inode, ...@@ -3213,7 +3213,7 @@ static int btrfs_zero_range(struct inode *inode,
&cached_state); &cached_state);
if (ret) if (ret)
goto out; goto out;
ret = btrfs_qgroup_reserve_data(inode, &data_reserved, ret = btrfs_qgroup_reserve_data(BTRFS_I(inode), &data_reserved,
alloc_start, bytes_to_reserve); alloc_start, bytes_to_reserve);
if (ret) if (ret)
goto out; goto out;
...@@ -3383,8 +3383,9 @@ static long btrfs_fallocate(struct file *file, int mode, ...@@ -3383,8 +3383,9 @@ static long btrfs_fallocate(struct file *file, int mode,
free_extent_map(em); free_extent_map(em);
break; break;
} }
ret = btrfs_qgroup_reserve_data(inode, &data_reserved, ret = btrfs_qgroup_reserve_data(BTRFS_I(inode),
cur_offset, last_byte - cur_offset); &data_reserved, cur_offset,
last_byte - cur_offset);
if (ret < 0) { if (ret < 0) {
cur_offset = last_byte; cur_offset = last_byte;
free_extent_map(em); free_extent_map(em);
......
...@@ -3435,11 +3435,11 @@ btrfs_qgroup_rescan_resume(struct btrfs_fs_info *fs_info) ...@@ -3435,11 +3435,11 @@ btrfs_qgroup_rescan_resume(struct btrfs_fs_info *fs_info)
* same @reserved, caller must ensure when error happens it's OK * same @reserved, caller must ensure when error happens it's OK
* to free *ALL* reserved space. * to free *ALL* reserved space.
*/ */
int btrfs_qgroup_reserve_data(struct inode *inode, int btrfs_qgroup_reserve_data(struct btrfs_inode *inode,
struct extent_changeset **reserved_ret, u64 start, struct extent_changeset **reserved_ret, u64 start,
u64 len) u64 len)
{ {
struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_root *root = inode->root;
struct ulist_node *unode; struct ulist_node *unode;
struct ulist_iterator uiter; struct ulist_iterator uiter;
struct extent_changeset *reserved; struct extent_changeset *reserved;
...@@ -3462,12 +3462,12 @@ int btrfs_qgroup_reserve_data(struct inode *inode, ...@@ -3462,12 +3462,12 @@ int btrfs_qgroup_reserve_data(struct inode *inode,
reserved = *reserved_ret; reserved = *reserved_ret;
/* Record already reserved space */ /* Record already reserved space */
orig_reserved = reserved->bytes_changed; orig_reserved = reserved->bytes_changed;
ret = set_record_extent_bits(&BTRFS_I(inode)->io_tree, start, ret = set_record_extent_bits(&inode->io_tree, start,
start + len -1, EXTENT_QGROUP_RESERVED, reserved); start + len -1, EXTENT_QGROUP_RESERVED, reserved);
/* Newly reserved space */ /* Newly reserved space */
to_reserve = reserved->bytes_changed - orig_reserved; to_reserve = reserved->bytes_changed - orig_reserved;
trace_btrfs_qgroup_reserve_data(inode, start, len, trace_btrfs_qgroup_reserve_data(&inode->vfs_inode, start, len,
to_reserve, QGROUP_RESERVE); to_reserve, QGROUP_RESERVE);
if (ret < 0) if (ret < 0)
goto cleanup; goto cleanup;
...@@ -3481,7 +3481,7 @@ int btrfs_qgroup_reserve_data(struct inode *inode, ...@@ -3481,7 +3481,7 @@ int btrfs_qgroup_reserve_data(struct inode *inode,
/* cleanup *ALL* already reserved ranges */ /* cleanup *ALL* already reserved ranges */
ULIST_ITER_INIT(&uiter); ULIST_ITER_INIT(&uiter);
while ((unode = ulist_next(&reserved->range_changed, &uiter))) while ((unode = ulist_next(&reserved->range_changed, &uiter)))
clear_extent_bit(&BTRFS_I(inode)->io_tree, unode->val, clear_extent_bit(&inode->io_tree, unode->val,
unode->aux, EXTENT_QGROUP_RESERVED, 0, 0, NULL); unode->aux, EXTENT_QGROUP_RESERVED, 0, 0, NULL);
/* Also free data bytes of already reserved one */ /* Also free data bytes of already reserved one */
btrfs_qgroup_free_refroot(root->fs_info, root->root_key.objectid, btrfs_qgroup_free_refroot(root->fs_info, root->root_key.objectid,
......
...@@ -344,7 +344,7 @@ int btrfs_verify_qgroup_counts(struct btrfs_fs_info *fs_info, u64 qgroupid, ...@@ -344,7 +344,7 @@ int btrfs_verify_qgroup_counts(struct btrfs_fs_info *fs_info, u64 qgroupid,
#endif #endif
/* New io_tree based accurate qgroup reserve API */ /* New io_tree based accurate qgroup reserve API */
int btrfs_qgroup_reserve_data(struct inode *inode, int btrfs_qgroup_reserve_data(struct btrfs_inode *inode,
struct extent_changeset **reserved, u64 start, u64 len); struct extent_changeset **reserved, u64 start, u64 len);
int btrfs_qgroup_release_data(struct btrfs_inode *inode, u64 start, u64 len); int btrfs_qgroup_release_data(struct btrfs_inode *inode, u64 start, u64 len);
int btrfs_qgroup_free_data(struct btrfs_inode *inode, int btrfs_qgroup_free_data(struct btrfs_inode *inode,
......
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