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
30#include "mdt.h"30#include "mdt.h"
31#include "sufile.h"31#include "sufile.h"
32 32
33#include <trace/events/nilfs2.h>
34
33/**35/**
34 * struct nilfs_sufile_info - on-memory private data of sufile36 * struct nilfs_sufile_info - on-memory private data of sufile
35 * @mi: on-memory private data of metadata file37 * @mi: on-memory private data of metadata file
@@ -358,6 +360,7 @@ int nilfs_sufile_alloc(struct inode *sufile, __u64 *segnump) · 322 unmodified lines
358 break; /* never happens */360 break; /* never happens */
359 }361 }
360 }362 }
363 trace_nilfs2_segment_usage_check(sufile, segnum, cnt);
361 ret = nilfs_sufile_get_segment_usage_block(sufile, segnum, 1,364 ret = nilfs_sufile_get_segment_usage_block(sufile, segnum, 1,
362 &su_bh);365 &su_bh);
363 if (ret < 0)366 if (ret < 0)
@@ -388,6 +391,9 @@ int nilfs_sufile_alloc(struct inode *sufile, __u64 *segnump) · 24 unmodified lines
388 nilfs_mdt_mark_dirty(sufile);391 nilfs_mdt_mark_dirty(sufile);
389 brelse(su_bh);392 brelse(su_bh);
390 *segnump = segnum;393 *segnump = segnum;
394
395 trace_nilfs2_segment_usage_allocated(sufile, segnum);
396
391 goto out_header;397 goto out_header;
392 }398 }
393 399
@@ -490,6 +496,8 @@ void nilfs_sufile_do_free(struct inode *sufile, __u64 segnum, · 96 unmodified lines
490 NILFS_SUI(sufile)->ncleansegs++;496 NILFS_SUI(sufile)->ncleansegs++;
491 497
492 nilfs_mdt_mark_dirty(sufile);498 nilfs_mdt_mark_dirty(sufile);
499
500 trace_nilfs2_segment_usage_freed(sufile, segnum);
493}501}
494 502
495/**503/**
include/trace/events/nilfs2.h+67−0
@@ -95,6 +95,73 @@ TRACE_EVENT(nilfs2_transaction_transition, · 94 unmodified lines
95 show_transaction_state(__entry->state))95 show_transaction_state(__entry->state))
96);96);
97 97
98TRACE_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
123TRACE_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
144TRACE_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#endif /* _TRACE_NILFS2_H */165#endif /* _TRACE_NILFS2_H */
99 166
100/* This part must be outside protection */167/* 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