f2fs: adds a tracepoint for f2fs_submit_read_bio
authorChao Yu <chao2.yu@samsung.com>
Sun, 24 Nov 2013 03:36:42 +0000 (12:36 +0900)
committerJaegeuk Kim <jaegeuk.kim@samsung.com>
Mon, 23 Dec 2013 01:18:02 +0000 (10:18 +0900)
This patch adds a tracepoint for f2fs_submit_read_bio.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
[Jaegeuk Kim: integrate tracepoints of f2fs_submit_read(_write)_bio]
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
fs/f2fs/data.c
fs/f2fs/segment.c
include/trace/events/f2fs.h

index cdb342eeb4214ee5db45bfcb0793f2cdbdd3d596..711722018b8e925ea6d64032acdc7f61bebc41d6 100644 (file)
@@ -421,6 +421,8 @@ void f2fs_submit_read_bio(struct f2fs_sb_info *sbi, int rw)
        if (!io->bio)
                return;
 
+       trace_f2fs_submit_read_bio(sbi->sb, rw, META, io->bio);
+
        mutex_lock(&io->io_mutex);
        if (io->bio) {
                submit_bio(rw, io->bio);
index d42426dc3706bc0a012a20f8c9abdec052450f92..a1acaa025bdeabd3633fb396ec561d9b19c73dcf 100644 (file)
@@ -844,6 +844,9 @@ static void do_submit_bio(struct f2fs_sb_info *sbi,
 
        if (type >= META_FLUSH)
                rw = WRITE_FLUSH_FUA;
+
+       trace_f2fs_submit_write_bio(sbi->sb, rw, btype, io->bio);
+
        if (btype == META)
                rw |= REQ_META;
 
@@ -851,8 +854,6 @@ static void do_submit_bio(struct f2fs_sb_info *sbi,
        p->sbi = sbi;
        io->bio->bi_end_io = f2fs_end_io_write;
 
-       trace_f2fs_do_submit_bio(sbi->sb, btype, sync, io->bio);
-
        if (type == META_FLUSH) {
                DECLARE_COMPLETION_ONSTACK(wait);
                p->is_sync = true;
index 73cc5f07d1babaa0179bb0520e0be17dbd37fa76..1f59f5db55e5da1c74cb2becc1967cabb07b3822 100644 (file)
 
 #define show_bio_type(type)                                            \
        __print_symbolic(type,                                          \
-               { READ,         "READ" },                               \
-               { READA,        "READAHEAD" },                          \
-               { READ_SYNC,    "READ_SYNC" },                          \
-               { WRITE,        "WRITE" },                              \
-               { WRITE_SYNC,   "WRITE_SYNC" },                         \
-               { WRITE_FLUSH,  "WRITE_FLUSH" },                        \
-               { WRITE_FUA,    "WRITE_FUA" })
+               { READ,                 "READ" },                       \
+               { READA,                "READAHEAD" },                  \
+               { READ_SYNC,            "READ_SYNC" },                  \
+               { WRITE,                "WRITE" },                      \
+               { WRITE_SYNC,           "WRITE_SYNC" },                 \
+               { WRITE_FLUSH,          "WRITE_FLUSH" },                \
+               { WRITE_FUA,            "WRITE_FUA" },                  \
+               { WRITE_FLUSH_FUA,      "WRITE_FLUSH_FUA" })
 
 #define show_data_type(type)                                           \
        __print_symbolic(type,                                          \
@@ -598,36 +599,50 @@ TRACE_EVENT(f2fs_reserve_new_block,
                __entry->ofs_in_node)
 );
 
-TRACE_EVENT(f2fs_do_submit_bio,
+DECLARE_EVENT_CLASS(f2fs__submit_bio,
 
-       TP_PROTO(struct super_block *sb, int btype, bool sync, struct bio *bio),
+       TP_PROTO(struct super_block *sb, int rw, int type, struct bio *bio),
 
-       TP_ARGS(sb, btype, sync, bio),
+       TP_ARGS(sb, rw, type, bio),
 
        TP_STRUCT__entry(
                __field(dev_t,  dev)
-               __field(int,    btype)
-               __field(bool,   sync)
+               __field(int,    rw)
+               __field(int,    type)
                __field(sector_t,       sector)
                __field(unsigned int,   size)
        ),
 
        TP_fast_assign(
                __entry->dev            = sb->s_dev;
-               __entry->btype          = btype;
-               __entry->sync           = sync;
+               __entry->rw             = rw;
+               __entry->type           = type;
                __entry->sector         = bio->bi_sector;
                __entry->size           = bio->bi_size;
        ),
 
-       TP_printk("dev = (%d,%d), type = %s, io = %s, sector = %lld, size = %u",
+       TP_printk("dev = (%d,%d), %s, %s, sector = %lld, size = %u",
                show_dev(__entry),
-               show_block_type(__entry->btype),
-               __entry->sync ? "sync" : "no sync",
+               show_bio_type(__entry->rw),
+               show_block_type(__entry->type),
                (unsigned long long)__entry->sector,
                __entry->size)
 );
 
+DEFINE_EVENT(f2fs__submit_bio, f2fs_submit_write_bio,
+
+       TP_PROTO(struct super_block *sb, int rw, int type, struct bio *bio),
+
+       TP_ARGS(sb, rw, type, bio)
+);
+
+DEFINE_EVENT(f2fs__submit_bio, f2fs_submit_read_bio,
+
+       TP_PROTO(struct super_block *sb, int rw, int type, struct bio *bio),
+
+       TP_ARGS(sb, rw, type, bio)
+);
+
 DECLARE_EVENT_CLASS(f2fs__page,
 
        TP_PROTO(struct page *page, int type),