f2fs: add a tracepoint for f2fs_write_{meta,node,data}_pages
authorChao Yu <chao2.yu@samsung.com>
Tue, 6 May 2014 08:51:24 +0000 (16:51 +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_{meta,node,data}_pages to trace when
pages are fsyncing/flushing.

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

index c95d62281d7e2ab07f0a92adfceb49a6f7f41d9d..fe968c7bfc90e8f6d7b3e0fa27485e6e6df5185a 100644 (file)
@@ -186,6 +186,8 @@ static int f2fs_write_meta_pages(struct address_space *mapping,
        struct f2fs_sb_info *sbi = F2FS_SB(mapping->host->i_sb);
        long diff, written;
 
+       trace_f2fs_writepages(mapping->host, wbc, META);
+
        /* collect a number of dirty meta pages and write together */
        if (wbc->for_kupdate ||
                get_pages(sbi, F2FS_DIRTY_META) < nr_pages_to_skip(sbi, META))
index b997d552880ea97a9517994cf8207b50c13deb4e..21bfafaafe83af0bd0ae552d1c152967b9fcc468 100644 (file)
@@ -860,6 +860,8 @@ static int f2fs_write_data_pages(struct address_space *mapping,
        int ret;
        long diff;
 
+       trace_f2fs_writepages(mapping->host, wbc, DATA);
+
        /* deal with chardevs and other special file */
        if (!mapping->a_ops->writepage)
                return 0;
index 49bdddbcadead16147fe7b7b27c1e2fde2ce76ec..3d60d3d34ed292e7df0434b9b37c24b40af02c6c 100644 (file)
@@ -1242,6 +1242,8 @@ static int f2fs_write_node_pages(struct address_space *mapping,
        struct f2fs_sb_info *sbi = F2FS_SB(mapping->host->i_sb);
        long diff;
 
+       trace_f2fs_writepages(mapping->host, wbc, NODE);
+
        /* balancing f2fs's metadata in background */
        f2fs_balance_fs_bg(sbi);
 
index d70991e69e58e4d3753d3836ad763b81e468f3a6..91b1fcc5ec9394ad5ba6d2802e1b227c2bd8b61f 100644 (file)
@@ -772,6 +772,70 @@ DEFINE_EVENT(f2fs__page, f2fs_vm_page_mkwrite,
        TP_ARGS(page, type)
 );
 
+TRACE_EVENT(f2fs_writepages,
+
+       TP_PROTO(struct inode *inode, struct writeback_control *wbc, int type),
+
+       TP_ARGS(inode, wbc, type),
+
+       TP_STRUCT__entry(
+               __field(dev_t,  dev)
+               __field(ino_t,  ino)
+               __field(int,    type)
+               __field(int,    dir)
+               __field(long,   nr_to_write)
+               __field(long,   pages_skipped)
+               __field(loff_t, range_start)
+               __field(loff_t, range_end)
+               __field(pgoff_t, writeback_index)
+               __field(int,    sync_mode)
+               __field(char,   for_kupdate)
+               __field(char,   for_background)
+               __field(char,   tagged_writepages)
+               __field(char,   for_reclaim)
+               __field(char,   range_cyclic)
+               __field(char,   for_sync)
+       ),
+
+       TP_fast_assign(
+               __entry->dev            = inode->i_sb->s_dev;
+               __entry->ino            = inode->i_ino;
+               __entry->type           = type;
+               __entry->dir            = S_ISDIR(inode->i_mode);
+               __entry->nr_to_write    = wbc->nr_to_write;
+               __entry->pages_skipped  = wbc->pages_skipped;
+               __entry->range_start    = wbc->range_start;
+               __entry->range_end      = wbc->range_end;
+               __entry->writeback_index = inode->i_mapping->writeback_index;
+               __entry->sync_mode      = wbc->sync_mode;
+               __entry->for_kupdate    = wbc->for_kupdate;
+               __entry->for_background = wbc->for_background;
+               __entry->tagged_writepages      = wbc->tagged_writepages;
+               __entry->for_reclaim    = wbc->for_reclaim;
+               __entry->range_cyclic   = wbc->range_cyclic;
+               __entry->for_sync       = wbc->for_sync;
+       ),
+
+       TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, "
+               "skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, "
+               "kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u",
+               show_dev_ino(__entry),
+               show_block_type(__entry->type),
+               show_file_type(__entry->dir),
+               __entry->nr_to_write,
+               __entry->pages_skipped,
+               __entry->range_start,
+               __entry->range_end,
+               (unsigned long)__entry->writeback_index,
+               __entry->sync_mode,
+               __entry->for_kupdate,
+               __entry->for_background,
+               __entry->tagged_writepages,
+               __entry->for_reclaim,
+               __entry->range_cyclic,
+               __entry->for_sync)
+);
+
 TRACE_EVENT(f2fs_submit_page_mbio,
 
        TP_PROTO(struct page *page, int rw, int type, block_t blk_addr),