f2fs: add tracepoint for f2fs_direct_IO
Chao Yu [Thu, 31 Jul 2014 13:11:22 +0000 (21:11 +0800)]
This patch adds a tracepoint for f2fs_direct_IO.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Conflicts:
fs/f2fs/data.c

Change-Id: Icb2e26e51a4ee52ebfe8136731500b7b944cda27

fs/f2fs/data.c
include/trace/events/f2fs.h

index a66895b..7f81952 100644 (file)
@@ -1092,10 +1092,15 @@ static ssize_t f2fs_direct_IO(int rw, struct kiocb *iocb,
        /* clear fsync mark to recover these blocks */
        fsync_mark_clear(F2FS_SB(inode->i_sb), inode->i_ino);
 
+       trace_f2fs_direct_IO_enter(inode, offset, count, rw);
+
        err = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs,
                                                        get_data_block);
        if (err < 0 && (rw & WRITE))
                f2fs_write_failed(mapping, offset + count);
+
+       trace_f2fs_direct_IO_exit(inode, offset, count, rw, err);
+
        return err;
 }
 
index c49d86d..d1f15bb 100644 (file)
@@ -587,6 +587,69 @@ TRACE_EVENT(f2fs_fallocate,
                __entry->ret)
 );
 
+TRACE_EVENT(f2fs_direct_IO_enter,
+
+       TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw),
+
+       TP_ARGS(inode, offset, len, rw),
+
+       TP_STRUCT__entry(
+               __field(dev_t,  dev)
+               __field(ino_t,  ino)
+               __field(loff_t, pos)
+               __field(unsigned long,  len)
+               __field(int,    rw)
+       ),
+
+       TP_fast_assign(
+               __entry->dev    = inode->i_sb->s_dev;
+               __entry->ino    = inode->i_ino;
+               __entry->pos    = offset;
+               __entry->len    = len;
+               __entry->rw     = rw;
+       ),
+
+       TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu rw = %d",
+               show_dev_ino(__entry),
+               __entry->pos,
+               __entry->len,
+               __entry->rw)
+);
+
+TRACE_EVENT(f2fs_direct_IO_exit,
+
+       TP_PROTO(struct inode *inode, loff_t offset, unsigned long len,
+                int rw, int ret),
+
+       TP_ARGS(inode, offset, len, rw, ret),
+
+       TP_STRUCT__entry(
+               __field(dev_t,  dev)
+               __field(ino_t,  ino)
+               __field(loff_t, pos)
+               __field(unsigned long,  len)
+               __field(int,    rw)
+               __field(int,    ret)
+       ),
+
+       TP_fast_assign(
+               __entry->dev    = inode->i_sb->s_dev;
+               __entry->ino    = inode->i_ino;
+               __entry->pos    = offset;
+               __entry->len    = len;
+               __entry->rw     = rw;
+               __entry->ret    = ret;
+       ),
+
+       TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu "
+               "rw = %d ret = %d",
+               show_dev_ino(__entry),
+               __entry->pos,
+               __entry->len,
+               __entry->rw,
+               __entry->ret)
+);
+
 TRACE_EVENT(f2fs_reserve_new_block,
 
        TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs_in_node),