linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/8] f2fs: add tracepoints for inode operations
@ 2013-02-19  2:33 Namjae Jeon
  2013-02-19  2:52 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Namjae Jeon @ 2013-02-19  2:33 UTC (permalink / raw)
  To: jaegeuk.kim, rostedt
  Cc: linux-fsdevel, linux-kernel, linux-f2fs-devel, Namjae Jeon,
	Namjae Jeon, Pankaj Kumar

From: Namjae Jeon <namjae.jeon@samsung.com>

Add tracepoints for tracing the various inode operations
like building inode, eviction of inode, link/unlike of
inodes.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Pankaj Kumar <pankaj.km@samsung.com>
---
 fs/f2fs/inode.c             |    3 ++
 fs/f2fs/namei.c             |    3 ++
 include/trace/events/f2fs.h |   90 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 96 insertions(+)

diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index ddae412..9216d1a 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -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) ||
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 1a49b88..b6e5b94 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -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;
 }
 
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
index ab28831..0c76885 100644
--- a/include/trace/events/f2fs.h
+++ b/include/trace/events/f2fs.h
@@ -78,6 +78,96 @@ TRACE_EVENT(f2fs_sync_fs,
 		  __entry->wait)
 );
 
+TRACE_EVENT(f2fs_iget,
+	TP_PROTO(struct super_block *sb, unsigned long ino),
+
+	TP_ARGS(sb, ino),
+
+	TP_STRUCT__entry(
+		__field(dev_t,	dev)
+		__field(unsigned long,	ino)
+	),
+
+	TP_fast_assign(
+		__entry->dev	= sb->s_dev;
+		__entry->ino	= ino;
+	),
+
+	TP_printk("dev %d,%d ino %lu ",
+		  MAJOR(__entry->dev), MINOR(__entry->dev),
+		  (unsigned long) __entry->ino)
+);
+
+TRACE_EVENT(f2fs_evict_inode,
+	TP_PROTO(struct inode *inode),
+
+	TP_ARGS(inode),
+
+	TP_STRUCT__entry(
+		__field(dev_t,	dev)
+		__field(ino_t,	ino)
+		__field(int,	nlink)
+	),
+
+	TP_fast_assign(
+		__entry->dev	= inode->i_sb->s_dev;
+		__entry->ino	= inode->i_ino;
+		__entry->nlink	= inode->i_nlink;
+	),
+
+	TP_printk("dev %d,%d ino %lu nlink %d",
+		  MAJOR(__entry->dev), MINOR(__entry->dev),
+		  (unsigned long) __entry->ino, __entry->nlink)
+);
+
+TRACE_EVENT(f2fs_unlink_enter,
+	TP_PROTO(struct inode *parent, struct dentry *dentry),
+
+	TP_ARGS(parent, dentry),
+
+	TP_STRUCT__entry(
+		__field(ino_t,	parent)
+		__field(ino_t,	ino)
+		__field(loff_t,	size)
+		__field(dev_t,	dev)
+	),
+
+	TP_fast_assign(
+		__entry->parent		= parent->i_ino;
+		__entry->ino		= dentry->d_inode->i_ino;
+		__entry->size		= dentry->d_inode->i_size;
+		__entry->dev		= dentry->d_inode->i_sb->s_dev;
+	),
+
+	TP_printk("dev %d,%d ino %lu size %lld parent %lu",
+		  MAJOR(__entry->dev), MINOR(__entry->dev),
+		  (unsigned long) __entry->ino, __entry->size,
+		  (unsigned long) __entry->parent)
+);
+
+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;
+	),
+
+	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 */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/8] f2fs: add tracepoints for inode operations
  2013-02-19  2:33 [PATCH 2/8] f2fs: add tracepoints for inode operations Namjae Jeon
@ 2013-02-19  2:52 ` Steven Rostedt
  2013-02-20  5:58   ` Namjae Jeon
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2013-02-19  2:52 UTC (permalink / raw)
  To: Namjae Jeon
  Cc: jaegeuk.kim, linux-fsdevel, linux-kernel, linux-f2fs-devel,
	Namjae Jeon, Pankaj Kumar

On Tue, 2013-02-19 at 11:33 +0900, Namjae Jeon wrote:
> From: Namjae Jeon <namjae.jeon@samsung.com>

> +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;
> +	),
> +
> +	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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/8] f2fs: add tracepoints for inode operations
  2013-02-19  2:52 ` Steven Rostedt
@ 2013-02-20  5:58   ` Namjae Jeon
  0 siblings, 0 replies; 3+ messages in thread
From: Namjae Jeon @ 2013-02-20  5:58 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: jaegeuk.kim, linux-fsdevel, linux-kernel, linux-f2fs-devel,
	Namjae Jeon, Pankaj Kumar

2013/2/19 Steven Rostedt <rostedt@goodmis.org>:
> On Tue, 2013-02-19 at 11:33 +0900, Namjae Jeon wrote:
>> From: Namjae Jeon <namjae.jeon@samsung.com>
>
>> +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;
>> +     ),
>> +
>> +     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.
Hi Steven.
Thanks for review :). I will update patches as your advice.


> -- Steve
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-20  5:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-19  2:33 [PATCH 2/8] f2fs: add tracepoints for inode operations Namjae Jeon
2013-02-19  2:52 ` Steven Rostedt
2013-02-20  5:58   ` Namjae Jeon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).