History

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

Hitoshi Mitake committed 11 years ago

Commit 83eec5e1 parent 44fda112 files · +75 −0Browse files

Unified · Split

2 files
  1. fs/nilfs2/sufile.c +8 −0
  2. include/trace/events/nilfs2.h +67 −0
fs/nilfs2/sufile.c+8−0
@@ -30,6 +30,8 @@ · 29 unmodified lines
3030 #include "mdt.h"
3131 #include "sufile.h"
3232
33+#include <trace/events/nilfs2.h>
34+
3335 /**
3436 * struct nilfs_sufile_info - on-memory private data of sufile
3537 * @mi: on-memory private data of metadata file
@@ -358,6 +360,7 @@ int nilfs_sufile_alloc(struct inode *sufile, __u64 *segnump) · 322 unmodified lines
358360 break; /* never happens */
359361 }
360362 }
363+ trace_nilfs2_segment_usage_check(sufile, segnum, cnt);
361364 ret = nilfs_sufile_get_segment_usage_block(sufile, segnum, 1,
362365 &su_bh);
363366 if (ret < 0)
@@ -388,6 +391,9 @@ int nilfs_sufile_alloc(struct inode *sufile, __u64 *segnump) · 24 unmodified lines
388391 nilfs_mdt_mark_dirty(sufile);
389392 brelse(su_bh);
390393 *segnump = segnum;
394+
395+ trace_nilfs2_segment_usage_allocated(sufile, segnum);
396+
391397 goto out_header;
392398 }
393399
@@ -490,6 +496,8 @@ void nilfs_sufile_do_free(struct inode *sufile, __u64 segnum, · 96 unmodified lines
490496 NILFS_SUI(sufile)->ncleansegs++;
491497
492498 nilfs_mdt_mark_dirty(sufile);
499+
500+ trace_nilfs2_segment_usage_freed(sufile, segnum);
493501 }
494502
495503 /**
include/trace/events/nilfs2.h+67−0
@@ -95,6 +95,73 @@ TRACE_EVENT(nilfs2_transaction_transition, · 94 unmodified lines
9595 show_transaction_state(__entry->state))
9696 );
9797
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+
98165 #endif /* _TRACE_NILFS2_H */
99166
100167 /* This part must be outside protection */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t