f2fs: add a tracepoint for f2fs_write_begin
authorChao Yu <chao2.yu@samsung.com>
Tue, 6 May 2014 08:46:04 +0000 (16:46 +0800)
committerJaegeuk Kim <jaegeuk.kim@samsung.com>
Wed, 7 May 2014 01:21:59 +0000 (10:21 +0900)
This patch adds a tracepoint for f2fs_write_begin to trace write op of user.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
fs/f2fs/data.c
include/trace/events/f2fs.h

index a7bb98f5831ae2127f3d5e4dfdf6335c3e4ba66b..cde0d69969b9585690cc07a7cdc8a19bb48e6d27 100644 (file)
@@ -900,6 +900,8 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
        struct dnode_of_data dn;
        int err = 0;
 
+       trace_f2fs_write_begin(inode, pos, len, flags);
+
        f2fs_balance_fs(sbi);
 repeat:
        err = f2fs_convert_inline_data(inode, pos + len);
index 67f38faac589ad52ac5850e5af602799753b8d29..1e9375aa93401ce113ac131e93aa92605adf1a88 100644 (file)
@@ -659,6 +659,36 @@ DEFINE_EVENT_CONDITION(f2fs__submit_bio, f2fs_submit_read_bio,
        TP_CONDITION(bio)
 );
 
+TRACE_EVENT(f2fs_write_begin,
+
+       TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
+                               unsigned int flags),
+
+       TP_ARGS(inode, pos, len, flags),
+
+       TP_STRUCT__entry(
+               __field(dev_t,  dev)
+               __field(ino_t,  ino)
+               __field(loff_t, pos)
+               __field(unsigned int, len)
+               __field(unsigned int, flags)
+       ),
+
+       TP_fast_assign(
+               __entry->dev    = inode->i_sb->s_dev;
+               __entry->ino    = inode->i_ino;
+               __entry->pos    = pos;
+               __entry->len    = len;
+               __entry->flags  = flags;
+       ),
+
+       TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, flags = %u",
+               show_dev_ino(__entry),
+               (unsigned long long)__entry->pos,
+               __entry->len,
+               __entry->flags)
+);
+
 DECLARE_EVENT_CLASS(f2fs__page,
 
        TP_PROTO(struct page *page, int type),