f2fs: add tracepoints for inode operations
Subsystems (3)
PATCH 2/8 f2fs: add tracepoints for inode operations
From: Namjae Jeon <[email protected]>
Add tracepoints for tracing the various inode operations like building inode, eviction of inode, link/unlike of inodes.
--- fs/f2fs/inode.c | 3 ++ fs/f2fs/namei.c | 3 ++ include/trace/events/f2fs.h | 90 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+)
fs/f2fs/inode.c +3 -0
@@ -15,6 +15,7 @@#include "f2fs.h" #include "node.h" +#include <trace/events/f2fs.h> void f2fs_set_inode_flags (struct inode *inode) {
@@ -90,6 +91,7 @@ struct inode *f2fs_iget(struct super_block *sb, unsigned long ino)struct inode *inode;int ret; +trace_f2fs_iget (sb, ino); inode =iget_locked (sb, ino);if (!inode)return ERR_PTR (-ENOMEM );
@@ -233,6 +235,7 @@ void f2fs_evict_inode(struct inode *inode) {struct f2fs_sb_info *sbi =F2FS_SB (inode->i_sb); +trace_f2fs_evict_inode (inode);truncate_inode_pages (&inode->i_data,0 ); if (inode->i_ino == F2FS_NODE_INO(sbi) ||
fs/f2fs/namei.c +3 -0
@@ -17,6 +17,7 @@#include "f2fs.h" #include "xattr.h" #include "acl.h" +#include <trace/events/f2fs.h> static struct inode *f2fs_new_inode (struct inode *dir,umode_t mode) {
@@ -223,6 +224,7 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)struct page *page;int err = -ENOENT ; +trace_f2fs_unlink_enter (dir, dentry);f2fs_balance_fs (sbi); de =f2fs_find_entry (dir, &dentry->d_name, &page);
@@ -241,6 +243,7 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)/* In order to evict this inode, we set it dirty */ mark_inode_dirty (inode); fail: +trace_f2fs_unlink_exit (dentry, err);return err; }
include/trace/events/f2fs.h +90 -0
96 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Steven Rostedt
maintainerQuoted 18 lines · Namjae Jeon
From: Namjae Jeon <[email protected]>
include/trace/events/f2fs.h +16
-0+TRACE_EVENT(f2fs_unlink_exit, + TP_PROTO(struct dentry *dentry, int ret), + + TP_ARGS(dentry, ret), + + TP_STRUCT__entry( + __field(ino_t, ino) + __field(dev_t, dev) + __field(int, ret) + ), + + TP_fast_assign( + __entry->ino = dentry->d_inode->i_ino; + __entry->dev = dentry->d_inode->i_sb->s_dev; + __entry->ret = ret; + ),
include/trace/events/f2fs.h TRACE_EVENT(f2fs_sync_fs, · line 173
Quoted 10 lines
include/trace/events/f2fs.h +7
-0+ +TP_printk ("dev %d,%d ino %lu ret %d" , +MAJOR (__entry->dev),MINOR (__entry->dev), + (unsigned long ) __entry->ino, + __entry->ret) +); +#endif /* _TRACE_F2FS_H */ /* This part must be outside protection */
If at all possible, try to combine as many tracepoints as possible by a class. A TRACE_EVENT() is really a DECLARE_EVENT_CLASS(); DEFINE_EVENT(); pair that totals about 5k per TRACE_EVENT(). The DECLARE_EVENT_CLASS() being the majority of that. A DEFINE_EVENT() adds approximately 250 bytes each. Thus, combining the above with the TRACE_EVENT() from the previous patch:
+TRACE_EVENT(f2fs_sync_file_exit,
+ TP_PROTO(struct inode *inode, int ret),
+
+ TP_ARGS(inode, ret),
+
+ TP_STRUCT__entry(
+ __field(int, ret)
+ __field(ino_t, ino)
+ __field(dev_t, dev)
+ ),
+
+ TP_fast_assign(
+ __entry->ret = ret;
+ __entry->ino = inode->i_ino;
+ __entry->dev = inode->i_sb->s_dev;
+ ),
+
+ TP_printk("dev %d,%d ino %lu ret %d",
+ MAJOR(__entry->dev), MINOR(__entry->dev),
+ (unsigned long) __entry->ino,
+ __entry->ret)+);
into:
DECLARE_EVENT_CLASS(f2fs_dev_inode_ret,
TP_PROTO(struct inode *inode, int ret),
TP_ARGS(inode, ret),
TP_STRUCT__entry(
__field(int, ret)
__field(ino_t, ino)
__field(dev_t, dev)
),
TP_fast_assign(
__entry->ret = ret;
__entry->ino = inode->i_ino;
__entry->dev = inode->i_sb->s_dev;
),
TP_printk("dev %d,%d ino %lu ret %d",
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long) __entry->ino,
__entry->ret));
DEFINE_EVENT(f2fs_sync_file_exit,
TP_PROTO(struct inode *inode, int ret),
TP_ARGS(inode, ret));
DEFINE_EVENT(f2fs_unlink_exit,
TP_PROTO(struct inode *inode, int ret),
TP_ARGS(inode, ret));
You can save ~4750 bytes. Note, you will need to pass the inode instead of the dentry into f2fs_unlink_exit(), but you don't use the dentry anyway.
-- Steve
2013/2/19 Steven Rostedt <[email protected]>:
Quoted 89 lines · Namjae Jeon
Quoted 18 lines
From: Namjae Jeon <[email protected]>
include/trace/events/f2fs.h +16
-0+TRACE_EVENT(f2fs_unlink_exit, + TP_PROTO(struct dentry *dentry, int ret), + + TP_ARGS(dentry, ret), + + TP_STRUCT__entry( + __field(ino_t, ino) + __field(dev_t, dev) + __field(int, ret) + ), + + TP_fast_assign( + __entry->ino = dentry->d_inode->i_ino; + __entry->dev = dentry->d_inode->i_sb->s_dev; + __entry->ret = ret; + ),include/trace/events/f2fs.h TRACE_EVENT(f2fs_sync_fs, · line 173
Quoted 10 lines
include/trace/events/f2fs.h +7
-0+ +TP_printk ("dev %d,%d ino %lu ret %d" , +MAJOR (__entry->dev),MINOR (__entry->dev), + (unsigned long ) __entry->ino, + __entry->ret) +); +#endif /* _TRACE_F2FS_H */ /* This part must be outside protection */ If at all possible, try to combine as many tracepoints as possible by a class. A
TRACE_EVENT()is really aDECLARE_EVENT_CLASS();DEFINE_EVENT(); pair that totals about 5k perTRACE_EVENT(). TheDECLARE_EVENT_CLASS()being the majority of that. ADEFINE_EVENT()adds approximately 250 bytes each. Thus, combining the above with theTRACE_EVENT()from the previous patch:include/trace/events/f2fs.h +22
-0+TRACE_EVENT (f2fs_sync_file_exit, + TP_PROTO(struct inode *inode, int ret), + +TP_ARGS (inode, ret), + +TP_STRUCT__entry ( + __field(int, ret) + __field(ino_t, ino) +__field (dev_t, dev) + ), + +TP_fast_assign ( + __entry->ret = ret; + __entry->ino = inode->i_ino; + __entry->dev = inode->i_sb->s_dev; + ), + +TP_printk ("dev %d,%d ino %lu ret %d" , +MAJOR (__entry->dev),MINOR (__entry->dev), + (unsigned long ) __entry->ino, + __entry->ret) +);into:
DECLARE_EVENT_CLASS(f2fs_dev_inode_ret,
TP_PROTO(struct inode *inode, int ret), TP_ARGS(inode, ret), TP_STRUCT__entry( __field(int, ret) __field(ino_t, ino) __field(dev_t, dev) ), TP_fast_assign( __entry->ret = ret; __entry->ino = inode->i_ino; __entry->dev = inode->i_sb->s_dev; ), TP_printk("dev %d,%d ino %lu ret %d", MAJOR(__entry->dev), MINOR(__entry->dev), (unsigned long) __entry->ino, __entry->ret));
DEFINE_EVENT(f2fs_sync_file_exit,
TP_PROTO(struct inode *inode, int ret),
TP_ARGS(inode, ret));
Quoted 7 lines
DEFINE_EVENT(f2fs_unlink_exit,
TP_PROTO(struct inode *inode, int ret),
TP_ARGS(inode, ret));You can save ~4750 bytes. Note, you will need to pass the inode instead of the dentry into
f2fs_unlink_exit(), but you don't use the dentry anyway.
Hi Steven.
Thanks for review :). I will update patches as your advice.
Quoted 3 lines
-- Steve