[f2fs-dev] [RFC PATCH v3 3/3] f2fs: introduce tracepoints for inline extent lookup and update
Yongpeng Yang <[email protected]> Fri, 24 Jul 2026 20:58:23 +0800
| Newsgroups | net.sourceforge.lists.linux-f2fs-devel |
|---|---|
| Message-ID | <[email protected]> |
From: Yongpeng Yang <[email protected]> Add tracepoints to aid performance analysis and debugging of the inline extent mechanism: - trace_f2fs_iext_lookup_blkaddr_start: fired at the beginning of an inline extent lookup, recording the inode and logical block offset. - trace_f2fs_iext_lookup_blkaddr_end: fired on successful lookup, recording the inode, logical offset, resolved physical block address, and extent length. - trace_f2fs_iext_update_data_blkaddr: fired when updating a block mapping in the inline extent area, recording the inode, logical offset, and new physical block address. These tracepoints can be used with ftrace/perf to measure inline extent cache hit rates and identify hot files benefiting from the feature. Signed-off-by: Yongpeng Yang <[email protected]> --- fs/f2fs/iextent.c | 11 +++++- include/trace/events/f2fs.h | 79 +++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/iextent.c b/fs/f2fs/iextent.c index dd1d1782598f..35eb3be54963 100644 --- a/fs/f2fs/iextent.c +++ b/fs/f2fs/iextent.c @@ -10,6 +10,7 @@ #include "f2fs.h" #include "iextent.h" +#include <trace/events/f2fs.h> /* * ASSERT - debug assertion for inline extent code. @@ -482,12 +483,18 @@ int f2fs_iext_lookup_blkaddr(struct inode *inode, struct folio *ifolio, struct f2fs_iext_header *eh = iext_get_header(ifolio); struct f2fs_extent *last_ext = EXT_LAST_INDEX(eh); + trace_f2fs_iext_lookup_blkaddr_start(inode, fofs); + if (EXT_ENTRY_COUNT(eh) == 0 || F2FS_EXT_LOGICAL_END(last_ext) < fofs) error = -ENOENT; else error = __iext_lookup_data_blkaddr(inode, ifolio, fofs, blkaddr, len); + if (!error) + trace_f2fs_iext_lookup_blkaddr_end(inode, fofs, + *blkaddr, len ? *len : 1); + return error; } @@ -522,6 +529,8 @@ int f2fs_iext_update_data_blkaddr(struct inode *inode, struct folio *ifolio, struct f2fs_iext_info *iext_info = sbi->iext_info; #endif + trace_f2fs_iext_update_data_blkaddr(inode, fofs, blkaddr); + retry: ASSERT(sbi, retry_cnt >= 0); ASSERT(sbi, EXT_ENTRY_COUNT(eh) <= max_inline_extents); @@ -747,4 +756,4 @@ void f2fs_iext_show_stat(struct f2fs_sb_info *sbi, struct seq_file *s) atomic64_read(&iext_info->truncate_last_ext_cnt), atomic64_read(&iext_info->drop_insert_new_ext_cnt)); } -#endif \ No newline at end of file +#endif diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 270c1a2c24c4..dc468a0c2980 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -2623,6 +2623,85 @@ TRACE_EVENT(f2fs_fault_report, __entry->data) ); +TRACE_EVENT(f2fs_iext_lookup_blkaddr_start, + + TP_PROTO(struct inode *inode, unsigned int pgofs), + + TP_ARGS(inode, pgofs), + + TP_STRUCT__entry( + __field(u64, ino) + __field(dev_t, dev) + __field(unsigned int, pgofs) + ), + + TP_fast_assign( + __entry->dev = inode->i_sb->s_dev; + __entry->ino = inode->i_ino; + __entry->pgofs = pgofs; + ), + + TP_printk("dev = (%d,%d), ino = %llu, pgofs = %u", + show_dev_ino(__entry), + __entry->pgofs) +); + +TRACE_EVENT(f2fs_iext_lookup_blkaddr_end, + + TP_PROTO(struct inode *inode, unsigned int pgofs, block_t blkaddr, + unsigned int len), + + TP_ARGS(inode, pgofs, blkaddr, len), + + TP_STRUCT__entry( + __field(u64, ino) + __field(dev_t, dev) + __field(unsigned int, pgofs) + __field(u32, blk) + __field(unsigned int, len) + ), + + TP_fast_assign( + __entry->dev = inode->i_sb->s_dev; + __entry->ino = inode->i_ino; + __entry->pgofs = pgofs; + __entry->blk = blkaddr; + __entry->len = len; + ), + + TP_printk("dev = (%d,%d), ino = %llu, pgofs = %u, blkaddr = %u, len = %u", + show_dev_ino(__entry), + __entry->pgofs, + __entry->blk, + __entry->len) +); + +TRACE_EVENT(f2fs_iext_update_data_blkaddr, + + TP_PROTO(struct inode *inode, unsigned int pgofs, block_t blkaddr), + + TP_ARGS(inode, pgofs, blkaddr), + + TP_STRUCT__entry( + __field(u64, ino) + __field(dev_t, dev) + __field(unsigned int, pgofs) + __field(u32, blk) + ), + + TP_fast_assign( + __entry->dev = inode->i_sb->s_dev; + __entry->ino = inode->i_ino; + __entry->pgofs = pgofs; + __entry->blk = blkaddr; + ), + + TP_printk("dev = (%d,%d), ino = %llu, pgofs = %u, blkaddr = %u", + show_dev_ino(__entry), + __entry->pgofs, + __entry->blk) +); + #endif /* _TRACE_F2FS_H */ /* This part must be outside protection */ -- 2.43.0 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel