Skip to contentSkip to conversation

f2fs: add tracepoints for GC threads

PATCH In review Namjae Jeon 2 participants 2 messages Apr 19, 2013 – Apr 23, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v4 4/7 f2fs: add tracepoints for GC threads

From: Namjae Jeon <[email protected]>

Add tracepoints for tracing the garbage collector threads in f2fs with status of collection & type.

---
 fs/f2fs/gc.c                |    2 ++
 include/trace/events/f2fs.h |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
fs/f2fs/gc.c +2 -0
index 37b05e1..935ca8c 100644
@@ -23,6 +23,7 @@
 #include "node.h"
 #include "segment.h"
 #include "gc.h"
+#include <trace/events/f2fs.h>
 
 static struct kmem_cache *winode_slab;
 
@@ -304,6 +305,7 @@ got_it:
 	}
 	mutex_unlock(&dirty_i->seglist_lock);
 
+	trace_f2fs_get_victim(sbi->sb, gc_type, type, &p, sbi->cur_victim_sec);
 	return (p.min_segno == NULL_SEGNO) ? 0 : 1;
 }
 
include/trace/events/f2fs.h +38 -0
index c7e71f9..57b6487 100644
@@ -6,6 +6,7 @@
 
 #include <linux/tracepoint.h>
 
+struct victim_sel_policy;
 
 TRACE_EVENT(f2fs_sync_file_enter,
 	TP_PROTO(struct file *file, char advise, int datasync),
@@ -471,6 +472,43 @@ TRACE_EVENT(f2fs_get_data_block,
 			 (unsigned long long) __entry->bh_block,
 					__entry->size,  __entry->ret)
 );
+
+TRACE_EVENT(f2fs_get_victim,
+	TP_PROTO(struct super_block *sb, int gc_type, int type,
+			 struct victim_sel_policy *p, unsigned int victim),
+
+	TP_ARGS(sb, gc_type, type, p, victim),
+
+	TP_STRUCT__entry(
+		__field(dev_t,	dev)
+		__field(int,	gc_type)
+		__field(int,	type)
+		__field(int,	alloc_mode)
+		__field(int,	gc_mode)
+		__field(unsigned int,	ofs_unit)
+		__field(unsigned int,	min_segno)
+		__field(unsigned int,	victim)
+	),
+
+	TP_fast_assign(
+		__entry->dev		= sb->s_dev;
+		__entry->gc_type	= gc_type;
+		__entry->type		= type;
+		__entry->alloc_mode	= p->alloc_mode;
+		__entry->gc_mode	= p->gc_mode;
+		__entry->ofs_unit	= p->ofs_unit;
+		__entry->min_segno	= p->min_segno;
+		__entry->victim		= victim;
+	),
+
+	TP_printk("dev %d,%d  GC_type %d Data type %d Alloc_mode %d Gc_mode %d "
+			"Bitmap %u Segment No %u Victim %u" ,
+		  MAJOR(__entry->dev), MINOR(__entry->dev),
+		   __entry->gc_type, __entry->type, __entry->alloc_mode,
+		 __entry->gc_mode, __entry->ofs_unit, __entry->min_segno,
+			__entry->victim)
+);
+
 #endif /* _TRACE_F2FS_H */
 
  /* This part must be outside protection */
Signature · 1 line
1.7.9.5
Acked-by Steven Rostedt on v4 4/7
#1 lore raw

From 8e46b3ed11b750a740fec0a313ad9118059fc37b Mon Sep 17 00:00:00 2001
From: Namjae Jeon <[email protected]>
Date: Tue, 23 Apr 2013 16:42:53 +0900
Subject: [PATCH 4/7] f2fs: add tracepoints for GC threads
Cc: [email protected], [email protected], [email protected]

Add tracepoints for tracing the garbage collector
threads in f2fs with status of collection & type.

[Jaegeuk: modify slightly to show information]
---
 fs/f2fs/gc.c                |  5 +++
 include/trace/events/f2fs.h | 75
+++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 80 insertions(+)
fs/f2fs/gc.c +5 -0
index 37b05e1..1ca3324 100644
@@ -23,6 +23,7 @@
 #include "node.h"
 #include "segment.h"
 #include "gc.h"
+#include <trace/events/f2fs.h>
 
 static struct kmem_cache *winode_slab;
 
@@ -301,6 +302,10 @@ got_it:
 				set_bit(secno, dirty_i->victim_secmap);
 		}
 		*result = (p.min_segno / p.ofs_unit) * p.ofs_unit;
+
+		trace_f2fs_get_victim(sbi->sb, type, gc_type, &p,
+				sbi->cur_victim_sec,
+				prefree_segments(sbi), free_segments(sbi));
 	}
 	mutex_unlock(&dirty_i->seglist_lock);
 
include/trace/events/f2fs.h +62 -0

71 lines not on this page · raw message

u "
+ "ofs_unit = %u, pre_victim_secno = %d, prefree = %u, free = %u",
+ show_dev(__entry),
+ show_data_type(__entry->type),
+ show_gc_type(__entry->gc_type),
+ show_alloc_mode(__entry->alloc_mode),
+ show_victim_policy(__entry->gc_mode),
+ __entry->victim,
+ __entry->ofs_unit,
+ (int)__entry->pre_victim,
+ __entry->prefree,
+ __entry->free)
+);
+
#endif /* _TRACE_F2FS_H */

/* This part must be outside protection */

Signature · 7 lines
1.8.1.3.566.gaa39828



-- 
Jaegeuk Kim
Samsung