summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2026-04-28 16:52:09 +0100
committerDavid Sterba <dsterba@suse.com>2026-06-08 15:53:34 +0200
commitd32609208782127d99917fb7aeee26738ad89e3f (patch)
tree2756ed6c53d1f12036689c19e91c1fc935f3e512 /include
parent658d72fe491380582ddfa7e536142d829a7b3688 (diff)
downloadlinux-next-d32609208782127d99917fb7aeee26738ad89e3f.tar.gz
linux-next-d32609208782127d99917fb7aeee26738ad89e3f.zip
btrfs: tracepoints: add trace event for btrfs_log_inode_parent()
btrfs_log_inode_parent() is one of the most important steps called during a fsync operation 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>
Diffstat (limited to 'include')
-rw-r--r--include/trace/events/btrfs.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index 1b19364eabff..cd127c79a535 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -34,6 +34,16 @@ struct find_free_extent_ctl;
struct btrfs_trans_handle;
struct btrfs_transaction;
+#define show_inode_type(mode) \
+ __print_symbolic((mode) & S_IFMT, \
+ { S_IFDIR, "DIR" }, \
+ { S_IFREG, "REG" }, \
+ { S_IFLNK, "LNK" }, \
+ { S_IFIFO, "FIFO" }, \
+ { S_IFCHR, "CHR" }, \
+ { S_IFBLK, "BLK" }, \
+ { S_IFSOCK, "SOCK" })
+
#define show_ref_type(type) \
__print_symbolic(type, \
{ BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \
@@ -866,6 +876,81 @@ TRACE_EVENT(btrfs_sync_file_exit,
__entry->ino, __entry->ret)
);
+TRACE_EVENT(btrfs_log_inode_parent_enter,
+
+ TP_PROTO(const struct btrfs_trans_handle *trans, struct btrfs_inode *inode),
+
+ TP_ARGS(trans, inode),
+
+ TP_STRUCT__entry_btrfs(
+ __field( u64, root_objectid )
+ __field( u64, ino )
+ __field( umode_t, mode )
+ __field( u64, transid )
+ __field( u64, generation )
+ __field( u64, logged_trans )
+ __field( u64, last_unlink_trans )
+ __field( int, last_sub_trans )
+ __field( int, inode_last_log_commit )
+ __field( int, root_last_log_commit )
+ ),
+
+ TP_fast_assign(
+ struct btrfs_root *root = inode->root;
+
+ TP_fast_assign_fsid(root->fs_info);
+ __entry->root_objectid = btrfs_root_id(root);
+ __entry->ino = btrfs_ino(inode);
+ __entry->mode = inode->vfs_inode.i_mode;
+ __entry->transid = trans->transid;
+ __entry->generation = inode->generation;
+ spin_lock(&inode->lock);
+ __entry->logged_trans = inode->logged_trans;
+ __entry->last_unlink_trans = inode->last_unlink_trans;
+ __entry->last_sub_trans = inode->last_sub_trans;
+ __entry->inode_last_log_commit = inode->last_log_commit;
+ spin_unlock(&inode->lock);
+ __entry->root_last_log_commit = btrfs_get_root_last_log_commit(root);
+ ),
+
+ TP_printk_btrfs("root=%llu(%s) ino=%llu type=%s transid=%llu gen=%llu"
+ " logged_trans=%llu last_unlink_trans=%llu last_sub_trans=%d"
+ " inode_last_log_commit=%d root_last_log_commit=%d",
+ show_root_type(__entry->root_objectid), __entry->ino,
+ show_inode_type(__entry->mode), __entry->transid,
+ __entry->generation, __entry->logged_trans,
+ __entry->last_unlink_trans, __entry->last_sub_trans,
+ __entry->inode_last_log_commit, __entry->root_last_log_commit)
+);
+
+TRACE_EVENT(btrfs_log_inode_parent_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),