Commit 8769af96 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: make __btrfs_qgroup_release_data take btrfs_inode

It uses vfs_inode only for a tracepoint so convert its interface to 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 df2cfd13
...@@ -3545,7 +3545,7 @@ static int qgroup_free_reserved_data(struct btrfs_inode *inode, ...@@ -3545,7 +3545,7 @@ static int qgroup_free_reserved_data(struct btrfs_inode *inode,
return ret; return ret;
} }
static int __btrfs_qgroup_release_data(struct inode *inode, static int __btrfs_qgroup_release_data(struct btrfs_inode *inode,
struct extent_changeset *reserved, u64 start, u64 len, struct extent_changeset *reserved, u64 start, u64 len,
int free) int free)
{ {
...@@ -3553,28 +3553,26 @@ static int __btrfs_qgroup_release_data(struct inode *inode, ...@@ -3553,28 +3553,26 @@ static int __btrfs_qgroup_release_data(struct inode *inode,
int trace_op = QGROUP_RELEASE; int trace_op = QGROUP_RELEASE;
int ret; int ret;
if (!test_bit(BTRFS_FS_QUOTA_ENABLED, if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &inode->root->fs_info->flags))
&BTRFS_I(inode)->root->fs_info->flags))
return 0; return 0;
/* In release case, we shouldn't have @reserved */ /* In release case, we shouldn't have @reserved */
WARN_ON(!free && reserved); WARN_ON(!free && reserved);
if (free && reserved) if (free && reserved)
return qgroup_free_reserved_data(BTRFS_I(inode), reserved, return qgroup_free_reserved_data(inode, reserved, start, len);
start, len);
extent_changeset_init(&changeset); extent_changeset_init(&changeset);
ret = clear_record_extent_bits(&BTRFS_I(inode)->io_tree, start, ret = clear_record_extent_bits(&inode->io_tree, start, start + len -1,
start + len -1, EXTENT_QGROUP_RESERVED, &changeset); EXTENT_QGROUP_RESERVED, &changeset);
if (ret < 0) if (ret < 0)
goto out; goto out;
if (free) if (free)
trace_op = QGROUP_FREE; trace_op = QGROUP_FREE;
trace_btrfs_qgroup_release_data(inode, start, len, trace_btrfs_qgroup_release_data(&inode->vfs_inode, start, len,
changeset.bytes_changed, trace_op); changeset.bytes_changed, trace_op);
if (free) if (free)
btrfs_qgroup_free_refroot(BTRFS_I(inode)->root->fs_info, btrfs_qgroup_free_refroot(inode->root->fs_info,
BTRFS_I(inode)->root->root_key.objectid, inode->root->root_key.objectid,
changeset.bytes_changed, BTRFS_QGROUP_RSV_DATA); changeset.bytes_changed, BTRFS_QGROUP_RSV_DATA);
ret = changeset.bytes_changed; ret = changeset.bytes_changed;
out: out:
...@@ -3597,7 +3595,7 @@ static int __btrfs_qgroup_release_data(struct inode *inode, ...@@ -3597,7 +3595,7 @@ static int __btrfs_qgroup_release_data(struct inode *inode,
int btrfs_qgroup_free_data(struct inode *inode, int btrfs_qgroup_free_data(struct inode *inode,
struct extent_changeset *reserved, u64 start, u64 len) struct extent_changeset *reserved, u64 start, u64 len)
{ {
return __btrfs_qgroup_release_data(inode, reserved, start, len, 1); return __btrfs_qgroup_release_data(BTRFS_I(inode), reserved, start, len, 1);
} }
/* /*
...@@ -3617,7 +3615,7 @@ int btrfs_qgroup_free_data(struct inode *inode, ...@@ -3617,7 +3615,7 @@ int btrfs_qgroup_free_data(struct inode *inode,
*/ */
int btrfs_qgroup_release_data(struct inode *inode, u64 start, u64 len) int btrfs_qgroup_release_data(struct inode *inode, u64 start, u64 len)
{ {
return __btrfs_qgroup_release_data(inode, NULL, start, len, 0); return __btrfs_qgroup_release_data(BTRFS_I(inode), NULL, start, len, 0);
} }
static void add_root_meta_rsv(struct btrfs_root *root, int num_bytes, static void add_root_meta_rsv(struct btrfs_root *root, int num_bytes,
......
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