mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-21 23:57:36 -04:00
btrfs: tracepoints: add trace event for btrfs_log_all_parents()
btrfs_log_all_parents() is an important step called during a fsync, as well as during rename and link operations on inodes that were previously logged. Add trace events for when entering and exiting that function. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
committed by
David Sterba
parent
e2f67524f4
commit
0f24ea456a
@@ -7240,9 +7240,13 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,
|
||||
struct btrfs_root *root = inode->root;
|
||||
const u64 ino = btrfs_ino(inode);
|
||||
|
||||
trace_btrfs_log_all_parents_enter(trans, inode);
|
||||
|
||||
path = btrfs_alloc_path();
|
||||
if (!path)
|
||||
return -ENOMEM;
|
||||
if (!path) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
path->skip_locking = true;
|
||||
path->search_commit_root = true;
|
||||
|
||||
@@ -7251,7 +7255,7 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,
|
||||
key.offset = 0;
|
||||
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
goto out;
|
||||
|
||||
while (true) {
|
||||
struct extent_buffer *leaf = path->nodes[0];
|
||||
@@ -7263,9 +7267,11 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,
|
||||
if (slot >= btrfs_header_nritems(leaf)) {
|
||||
ret = btrfs_next_leaf(root, path);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (ret > 0)
|
||||
goto out;
|
||||
if (ret > 0) {
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -7318,8 +7324,10 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,
|
||||
* at both parents and the old parent B would still
|
||||
* exist.
|
||||
*/
|
||||
if (IS_ERR(dir_inode))
|
||||
return PTR_ERR(dir_inode);
|
||||
if (IS_ERR(dir_inode)) {
|
||||
ret = PTR_ERR(dir_inode);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!need_log_inode(trans, dir_inode)) {
|
||||
btrfs_add_delayed_iput(dir_inode);
|
||||
@@ -7332,11 +7340,14 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,
|
||||
ret = log_new_dir_dentries(trans, dir_inode, ctx);
|
||||
btrfs_add_delayed_iput(dir_inode);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto out;
|
||||
}
|
||||
path->slots[0]++;
|
||||
}
|
||||
return 0;
|
||||
out:
|
||||
trace_btrfs_log_all_parents_exit(trans, inode, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int log_new_ancestors(struct btrfs_trans_handle *trans,
|
||||
|
||||
@@ -1067,6 +1067,59 @@ TRACE_EVENT(btrfs_log_inode_exit,
|
||||
__entry->last_log_commit, __entry->ret)
|
||||
);
|
||||
|
||||
TRACE_EVENT(btrfs_log_all_parents_enter,
|
||||
|
||||
TP_PROTO(const struct btrfs_trans_handle *trans,
|
||||
const struct btrfs_inode *inode),
|
||||
|
||||
TP_ARGS(trans, inode),
|
||||
|
||||
TP_STRUCT__entry_btrfs(
|
||||
__field( u64, root_objectid )
|
||||
__field( u64, ino )
|
||||
__field( u64, transid )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
TP_fast_assign_fsid(inode->root->fs_info);
|
||||
__entry->root_objectid = btrfs_root_id(inode->root);
|
||||
__entry->ino = btrfs_ino(inode);
|
||||
__entry->transid = trans->transid;
|
||||
),
|
||||
|
||||
TP_printk_btrfs("root=%llu(%s) ino=%llu transid=%llu",
|
||||
show_root_type(__entry->root_objectid), __entry->ino,
|
||||
__entry->transid)
|
||||
);
|
||||
|
||||
TRACE_EVENT(btrfs_log_all_parents_exit,
|
||||
|
||||
TP_PROTO(const struct btrfs_trans_handle *trans,
|
||||
const struct btrfs_inode *inode,
|
||||
int ret),
|
||||
|
||||
TP_ARGS(trans, inode, ret),
|
||||
|
||||
TP_STRUCT__entry_btrfs(
|
||||
__field( u64, root_objectid )
|
||||
__field( u64, ino )
|
||||
__field( u64, transid )
|
||||
__field( int, ret )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
TP_fast_assign_fsid(inode->root->fs_info);
|
||||
__entry->root_objectid = btrfs_root_id(inode->root);
|
||||
__entry->ino = btrfs_ino(inode);
|
||||
__entry->transid = trans->transid;
|
||||
__entry->ret = ret;
|
||||
),
|
||||
|
||||
TP_printk_btrfs("root=%llu(%s) ino=%llu transid=%llu ret=%d",
|
||||
show_root_type(__entry->root_objectid), __entry->ino,
|
||||
__entry->transid, __entry->ret)
|
||||
);
|
||||
|
||||
TRACE_EVENT(btrfs_sync_fs,
|
||||
|
||||
TP_PROTO(const struct btrfs_fs_info *fs_info, int wait),
|
||||
|
||||
Reference in New Issue
Block a user