Commit 50b3e040 authored by Qu Wenruo's avatar Qu Wenruo Committed by David Sterba

btrfs: qgroup: Rename functions to make it follow reserve,trace,account steps

Rename btrfs_qgroup_insert_dirty_extent(_nolock) to
btrfs_qgroup_trace_extent(_nolock), according to the new
reserve/trace/account naming schema.
Signed-off-by: default avatarQu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-and-Tested-by: default avatarGoldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 1d2beaa9
...@@ -606,7 +606,7 @@ add_delayed_ref_head(struct btrfs_fs_info *fs_info, ...@@ -606,7 +606,7 @@ add_delayed_ref_head(struct btrfs_fs_info *fs_info,
qrecord->num_bytes = num_bytes; qrecord->num_bytes = num_bytes;
qrecord->old_roots = NULL; qrecord->old_roots = NULL;
if(btrfs_qgroup_insert_dirty_extent_nolock(fs_info, if(btrfs_qgroup_trace_extent_nolock(fs_info,
delayed_refs, qrecord)) delayed_refs, qrecord))
kfree(qrecord); kfree(qrecord);
} }
......
...@@ -8571,7 +8571,7 @@ static int account_leaf_items(struct btrfs_trans_handle *trans, ...@@ -8571,7 +8571,7 @@ static int account_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_insert_dirty_extent(trans, root->fs_info, ret = btrfs_qgroup_trace_extent(trans, root->fs_info,
bytenr, num_bytes, GFP_NOFS); bytenr, num_bytes, GFP_NOFS);
if (ret) if (ret)
return ret; return ret;
...@@ -8721,7 +8721,7 @@ static int account_shared_subtree(struct btrfs_trans_handle *trans, ...@@ -8721,7 +8721,7 @@ static int account_shared_subtree(struct btrfs_trans_handle *trans,
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_insert_dirty_extent(trans, ret = btrfs_qgroup_trace_extent(trans,
root->fs_info, child_bytenr, root->fs_info, child_bytenr,
root->nodesize, GFP_NOFS); root->nodesize, GFP_NOFS);
if (ret) if (ret)
......
...@@ -1457,7 +1457,7 @@ int btrfs_qgroup_prepare_account_extents(struct btrfs_trans_handle *trans, ...@@ -1457,7 +1457,7 @@ int btrfs_qgroup_prepare_account_extents(struct btrfs_trans_handle *trans,
return ret; return ret;
} }
int btrfs_qgroup_insert_dirty_extent_nolock(struct btrfs_fs_info *fs_info, int btrfs_qgroup_trace_extent_nolock(struct btrfs_fs_info *fs_info,
struct btrfs_delayed_ref_root *delayed_refs, struct btrfs_delayed_ref_root *delayed_refs,
struct btrfs_qgroup_extent_record *record) struct btrfs_qgroup_extent_record *record)
{ {
...@@ -1467,7 +1467,7 @@ int btrfs_qgroup_insert_dirty_extent_nolock(struct btrfs_fs_info *fs_info, ...@@ -1467,7 +1467,7 @@ int btrfs_qgroup_insert_dirty_extent_nolock(struct btrfs_fs_info *fs_info,
u64 bytenr = record->bytenr; u64 bytenr = record->bytenr;
assert_spin_locked(&delayed_refs->lock); assert_spin_locked(&delayed_refs->lock);
trace_btrfs_qgroup_insert_dirty_extent(fs_info, record); trace_btrfs_qgroup_trace_extent(fs_info, record);
while (*p) { while (*p) {
parent_node = *p; parent_node = *p;
...@@ -1486,7 +1486,7 @@ int btrfs_qgroup_insert_dirty_extent_nolock(struct btrfs_fs_info *fs_info, ...@@ -1486,7 +1486,7 @@ int btrfs_qgroup_insert_dirty_extent_nolock(struct btrfs_fs_info *fs_info,
return 0; return 0;
} }
int btrfs_qgroup_insert_dirty_extent(struct btrfs_trans_handle *trans, int btrfs_qgroup_trace_extent(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info, u64 bytenr, u64 num_bytes, struct btrfs_fs_info *fs_info, u64 bytenr, u64 num_bytes,
gfp_t gfp_flag) gfp_t gfp_flag)
{ {
...@@ -1509,7 +1509,7 @@ int btrfs_qgroup_insert_dirty_extent(struct btrfs_trans_handle *trans, ...@@ -1509,7 +1509,7 @@ int btrfs_qgroup_insert_dirty_extent(struct btrfs_trans_handle *trans,
record->old_roots = NULL; record->old_roots = NULL;
spin_lock(&delayed_refs->lock); spin_lock(&delayed_refs->lock);
ret = btrfs_qgroup_insert_dirty_extent_nolock(fs_info, delayed_refs, ret = btrfs_qgroup_trace_extent_nolock(fs_info, delayed_refs,
record); record);
spin_unlock(&delayed_refs->lock); spin_unlock(&delayed_refs->lock);
if (ret > 0) if (ret > 0)
......
...@@ -93,8 +93,8 @@ struct btrfs_delayed_extent_op; ...@@ -93,8 +93,8 @@ struct btrfs_delayed_extent_op;
int btrfs_qgroup_prepare_account_extents(struct btrfs_trans_handle *trans, int btrfs_qgroup_prepare_account_extents(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info); struct btrfs_fs_info *fs_info);
/* /*
* Insert one dirty extent record into @delayed_refs, informing qgroup to * Inform qgroup to trace one dirty extent, its info is recorded in @record.
* account that extent at commit trans time. * So qgroup can account it at commit trans time.
* *
* No lock version, caller must acquire delayed ref lock and allocate memory. * No lock version, caller must acquire delayed ref lock and allocate memory.
* *
...@@ -102,14 +102,15 @@ int btrfs_qgroup_prepare_account_extents(struct btrfs_trans_handle *trans, ...@@ -102,14 +102,15 @@ int btrfs_qgroup_prepare_account_extents(struct btrfs_trans_handle *trans,
* Return >0 for existing record, caller can free @record safely. * Return >0 for existing record, caller can free @record safely.
* Error is not possible * Error is not possible
*/ */
int btrfs_qgroup_insert_dirty_extent_nolock( int btrfs_qgroup_trace_extent_nolock(
struct btrfs_fs_info *fs_info, struct btrfs_fs_info *fs_info,
struct btrfs_delayed_ref_root *delayed_refs, struct btrfs_delayed_ref_root *delayed_refs,
struct btrfs_qgroup_extent_record *record); struct btrfs_qgroup_extent_record *record);
/* /*
* Insert one dirty extent record into @delayed_refs, informing qgroup to * Inform qgroup to trace one dirty extent, specified by @bytenr and
* account that extent at commit trans time. * @num_bytes.
* So qgroup can account it at commit trans time.
* *
* Better encapsulated version. * Better encapsulated version.
* *
...@@ -117,7 +118,7 @@ int btrfs_qgroup_insert_dirty_extent_nolock( ...@@ -117,7 +118,7 @@ int btrfs_qgroup_insert_dirty_extent_nolock(
* 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_insert_dirty_extent(struct btrfs_trans_handle *trans, int btrfs_qgroup_trace_extent(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info, u64 bytenr, u64 num_bytes, struct btrfs_fs_info *fs_info, u64 bytenr, u64 num_bytes,
gfp_t gfp_flag); gfp_t gfp_flag);
......
...@@ -4012,7 +4012,7 @@ static int qgroup_fix_relocated_data_extents(struct btrfs_trans_handle *trans, ...@@ -4012,7 +4012,7 @@ static int qgroup_fix_relocated_data_extents(struct btrfs_trans_handle *trans,
if (btrfs_file_extent_type(path->nodes[0], fi) != if (btrfs_file_extent_type(path->nodes[0], fi) !=
BTRFS_FILE_EXTENT_REG) BTRFS_FILE_EXTENT_REG)
goto next; goto next;
ret = btrfs_qgroup_insert_dirty_extent(trans, fs_info, ret = btrfs_qgroup_trace_extent(trans, fs_info,
btrfs_file_extent_disk_bytenr(path->nodes[0], fi), btrfs_file_extent_disk_bytenr(path->nodes[0], fi),
btrfs_file_extent_disk_num_bytes(path->nodes[0], fi), btrfs_file_extent_disk_num_bytes(path->nodes[0], fi),
GFP_NOFS); GFP_NOFS);
......
...@@ -689,7 +689,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans, ...@@ -689,7 +689,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_insert_dirty_extent(trans, root->fs_info, ret = btrfs_qgroup_trace_extent(trans, root->fs_info,
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);
......
...@@ -1406,7 +1406,7 @@ DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents, ...@@ -1406,7 +1406,7 @@ DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents,
TP_ARGS(fs_info, rec) TP_ARGS(fs_info, rec)
); );
DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_insert_dirty_extent, DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_trace_extent,
TP_PROTO(struct btrfs_fs_info *fs_info, TP_PROTO(struct btrfs_fs_info *fs_info,
struct btrfs_qgroup_extent_record *rec), struct btrfs_qgroup_extent_record *rec),
......
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