mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-27 09:02:06 +00:00
btrfs: qgroup: Drop fs_info parameter from btrfs_qgroup_trace_extent
It can be fetched from the transaction handle. In addition, remove the WARN_ON(trans == NULL) because it's not possible to hit this condition. Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
f0042d5e92
commit
a95f3aafd6
3 changed files with 9 additions and 13 deletions
|
@ -1580,10 +1580,10 @@ int btrfs_qgroup_trace_extent_post(struct btrfs_fs_info *fs_info,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int btrfs_qgroup_trace_extent(struct btrfs_trans_handle *trans,
|
int btrfs_qgroup_trace_extent(struct btrfs_trans_handle *trans, u64 bytenr,
|
||||||
struct btrfs_fs_info *fs_info, u64 bytenr, u64 num_bytes,
|
u64 num_bytes, gfp_t gfp_flag)
|
||||||
gfp_t gfp_flag)
|
|
||||||
{
|
{
|
||||||
|
struct btrfs_fs_info *fs_info = trans->fs_info;
|
||||||
struct btrfs_qgroup_extent_record *record;
|
struct btrfs_qgroup_extent_record *record;
|
||||||
struct btrfs_delayed_ref_root *delayed_refs;
|
struct btrfs_delayed_ref_root *delayed_refs;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -1591,8 +1591,6 @@ int btrfs_qgroup_trace_extent(struct btrfs_trans_handle *trans,
|
||||||
if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags)
|
if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags)
|
||||||
|| bytenr == 0 || num_bytes == 0)
|
|| bytenr == 0 || num_bytes == 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (WARN_ON(trans == NULL))
|
|
||||||
return -EINVAL;
|
|
||||||
record = kmalloc(sizeof(*record), gfp_flag);
|
record = kmalloc(sizeof(*record), gfp_flag);
|
||||||
if (!record)
|
if (!record)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -1645,8 +1643,8 @@ int btrfs_qgroup_trace_leaf_items(struct btrfs_trans_handle *trans,
|
||||||
|
|
||||||
num_bytes = btrfs_file_extent_disk_num_bytes(eb, fi);
|
num_bytes = btrfs_file_extent_disk_num_bytes(eb, fi);
|
||||||
|
|
||||||
ret = btrfs_qgroup_trace_extent(trans, fs_info, bytenr,
|
ret = btrfs_qgroup_trace_extent(trans, bytenr, num_bytes,
|
||||||
num_bytes, GFP_NOFS);
|
GFP_NOFS);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1797,8 +1795,7 @@ walk_down:
|
||||||
btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK);
|
btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK);
|
||||||
path->locks[level] = BTRFS_READ_LOCK_BLOCKING;
|
path->locks[level] = BTRFS_READ_LOCK_BLOCKING;
|
||||||
|
|
||||||
ret = btrfs_qgroup_trace_extent(trans, fs_info,
|
ret = btrfs_qgroup_trace_extent(trans, child_bytenr,
|
||||||
child_bytenr,
|
|
||||||
fs_info->nodesize,
|
fs_info->nodesize,
|
||||||
GFP_NOFS);
|
GFP_NOFS);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|
|
@ -212,9 +212,8 @@ int btrfs_qgroup_trace_extent_post(struct btrfs_fs_info *fs_info,
|
||||||
* Return <0 for error, like memory allocation failure or invalid parameter
|
* Return <0 for error, like memory allocation failure or invalid parameter
|
||||||
* (NULL trans)
|
* (NULL trans)
|
||||||
*/
|
*/
|
||||||
int btrfs_qgroup_trace_extent(struct btrfs_trans_handle *trans,
|
int btrfs_qgroup_trace_extent(struct btrfs_trans_handle *trans, u64 bytenr,
|
||||||
struct btrfs_fs_info *fs_info, u64 bytenr, u64 num_bytes,
|
u64 num_bytes, gfp_t gfp_flag);
|
||||||
gfp_t gfp_flag);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Inform qgroup to trace all leaf items of data
|
* Inform qgroup to trace all leaf items of data
|
||||||
|
|
|
@ -685,7 +685,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
|
||||||
* as the owner of the file extent changed from log tree
|
* as the owner of the file extent changed from log tree
|
||||||
* (doesn't affect qgroup) to fs/file tree(affects qgroup)
|
* (doesn't affect qgroup) to fs/file tree(affects qgroup)
|
||||||
*/
|
*/
|
||||||
ret = btrfs_qgroup_trace_extent(trans, fs_info,
|
ret = btrfs_qgroup_trace_extent(trans,
|
||||||
btrfs_file_extent_disk_bytenr(eb, item),
|
btrfs_file_extent_disk_bytenr(eb, item),
|
||||||
btrfs_file_extent_disk_num_bytes(eb, item),
|
btrfs_file_extent_disk_num_bytes(eb, item),
|
||||||
GFP_NOFS);
|
GFP_NOFS);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue