f2fs: add a tracepoint for background gc
authorJaegeuk Kim <jaegeuk@kernel.org>
Mon, 5 Oct 2015 18:32:34 +0000 (11:32 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 9 Oct 2015 23:20:57 +0000 (16:20 -0700)
This patch introduces a tracepoint to monitor background gc behaviors.

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

index e627c19f730101ff879cf2a606270744d6761f7f..e7cec86f0747ccd7ad6c88025953c3bea33ffa25 100644 (file)
@@ -77,6 +77,9 @@ static int gc_thread_func(void *data)
 
                stat_inc_bggc_count(sbi);
 
+               trace_f2fs_background_gc(sbi->sb, wait_ms,
+                               prefree_segments(sbi), free_segments(sbi));
+
                /* if return value is not zero, no victim was selected */
                if (f2fs_gc(sbi, test_opt(sbi, FORCE_FG_GC)))
                        wait_ms = gc_th->no_gc_sleep_time;
index 6aa63d963af430b7a09837ddd68dfb1703de8f8d..7de751d5763bc4794fde881cc6df6e7072c55173 100644 (file)
@@ -514,6 +514,34 @@ TRACE_EVENT(f2fs_map_blocks,
                __entry->ret)
 );
 
+TRACE_EVENT(f2fs_background_gc,
+
+       TP_PROTO(struct super_block *sb, long wait_ms,
+                       unsigned int prefree, unsigned int free),
+
+       TP_ARGS(sb, wait_ms, prefree, free),
+
+       TP_STRUCT__entry(
+               __field(dev_t,  dev)
+               __field(long,   wait_ms)
+               __field(unsigned int,   prefree)
+               __field(unsigned int,   free)
+       ),
+
+       TP_fast_assign(
+               __entry->dev            = sb->s_dev;
+               __entry->wait_ms        = wait_ms;
+               __entry->prefree        = prefree;
+               __entry->free           = free;
+       ),
+
+       TP_printk("dev = (%d,%d), wait_ms = %ld, prefree = %u, free = %u",
+               show_dev(__entry),
+               __entry->wait_ms,
+               __entry->prefree,
+               __entry->free)
+);
+
 TRACE_EVENT(f2fs_get_victim,
 
        TP_PROTO(struct super_block *sb, int type, int gc_type,