Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nilfs2: add tracepoints for analyzing sufile manipulation

This patch adds tracepoints which would be useful for analyzing segment
usage from a perspective of high level sufile manipulation (check, alloc,
free). sufile is an important in-place updated metadata file, so
analyzing the behavior would be useful for performance turning.

example of usage (a case of allocation):

$ sudo bin/tpoint nilfs2:nilfs2_segment_usage_allocated
Tracing nilfs2:nilfs2_segment_usage_allocated. Ctrl-C to end.
segctord-17800 [002] ...1 10671.867294: nilfs2_segment_usage_allocated: sufile = ffff880054f908a8 segnum = 2
segctord-17800 [002] ...1 10675.073477: nilfs2_segment_usage_allocated: sufile = ffff880054f908a8 segnum = 3

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Benixon Dhas <benixon.dhas@wdc.com>
Cc: TK Kato <TK.Kato@wdc.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Hitoshi Mitake and committed by
Linus Torvalds
83eec5e6 44fda114

+75
+8
fs/nilfs2/sufile.c
··· 30 30 #include "mdt.h" 31 31 #include "sufile.h" 32 32 33 + #include <trace/events/nilfs2.h> 34 + 33 35 /** 34 36 * struct nilfs_sufile_info - on-memory private data of sufile 35 37 * @mi: on-memory private data of metadata file ··· 360 358 break; /* never happens */ 361 359 } 362 360 } 361 + trace_nilfs2_segment_usage_check(sufile, segnum, cnt); 363 362 ret = nilfs_sufile_get_segment_usage_block(sufile, segnum, 1, 364 363 &su_bh); 365 364 if (ret < 0) ··· 391 388 nilfs_mdt_mark_dirty(sufile); 392 389 brelse(su_bh); 393 390 *segnump = segnum; 391 + 392 + trace_nilfs2_segment_usage_allocated(sufile, segnum); 393 + 394 394 goto out_header; 395 395 } 396 396 ··· 496 490 NILFS_SUI(sufile)->ncleansegs++; 497 491 498 492 nilfs_mdt_mark_dirty(sufile); 493 + 494 + trace_nilfs2_segment_usage_freed(sufile, segnum); 499 495 } 500 496 501 497 /**
+67
include/trace/events/nilfs2.h
··· 95 95 show_transaction_state(__entry->state)) 96 96 ); 97 97 98 + TRACE_EVENT(nilfs2_segment_usage_check, 99 + TP_PROTO(struct inode *sufile, 100 + __u64 segnum, 101 + unsigned long cnt), 102 + 103 + TP_ARGS(sufile, segnum, cnt), 104 + 105 + TP_STRUCT__entry( 106 + __field(struct inode *, sufile) 107 + __field(__u64, segnum) 108 + __field(unsigned long, cnt) 109 + ), 110 + 111 + TP_fast_assign( 112 + __entry->sufile = sufile; 113 + __entry->segnum = segnum; 114 + __entry->cnt = cnt; 115 + ), 116 + 117 + TP_printk("sufile = %p segnum = %llu cnt = %lu", 118 + __entry->sufile, 119 + __entry->segnum, 120 + __entry->cnt) 121 + ); 122 + 123 + TRACE_EVENT(nilfs2_segment_usage_allocated, 124 + TP_PROTO(struct inode *sufile, 125 + __u64 segnum), 126 + 127 + TP_ARGS(sufile, segnum), 128 + 129 + TP_STRUCT__entry( 130 + __field(struct inode *, sufile) 131 + __field(__u64, segnum) 132 + ), 133 + 134 + TP_fast_assign( 135 + __entry->sufile = sufile; 136 + __entry->segnum = segnum; 137 + ), 138 + 139 + TP_printk("sufile = %p segnum = %llu", 140 + __entry->sufile, 141 + __entry->segnum) 142 + ); 143 + 144 + TRACE_EVENT(nilfs2_segment_usage_freed, 145 + TP_PROTO(struct inode *sufile, 146 + __u64 segnum), 147 + 148 + TP_ARGS(sufile, segnum), 149 + 150 + TP_STRUCT__entry( 151 + __field(struct inode *, sufile) 152 + __field(__u64, segnum) 153 + ), 154 + 155 + TP_fast_assign( 156 + __entry->sufile = sufile; 157 + __entry->segnum = segnum; 158 + ), 159 + 160 + TP_printk("sufile = %p segnum = %llu", 161 + __entry->sufile, 162 + __entry->segnum) 163 + ); 164 + 98 165 #endif /* _TRACE_NILFS2_H */ 99 166 100 167 /* This part must be outside protection */