diff options
author | Tao Ma <boyu.mt@taobao.com> | 2011-02-21 19:21:10 -0500 |
---|---|---|
committer | Tao Ma <boyu.mt@taobao.com> | 2011-02-21 19:21:10 -0500 |
commit | a09d09b8f8d7c8acd46d96e3e9899bd1461fc036 (patch) | |
tree | 1ed7bc9c6197fb8129553c0eb8c45bf38eb4666f /fs/ocfs2/ocfs2_trace.h | |
parent | 80a9a84da381087ed89f5fdfc40a513cf9768ac4 (diff) |
ocfs2: Remove mlog(0) from fs/ocfs2/alloc.c
This is the first try of replacing debug mlog(0,...) to
trace events. Wengang has did some work in his original
patch
http://oss.oracle.com/pipermail/ocfs2-devel/2009-November/005513.html
But he didn't finished it.
So this patch removes all mlog(0,...) from alloc.c and adds
the corresponding trace events. Different mlogs have different
solutions.
1. Some are replaced with trace event directly.
2. Some are replaced and some new parameters are added since
I think we need to know the btree owner in that case.
3. Some are combined into one trace events.
4. Some redundant mlogs are removed.
What's more, it defines some event classes so that we can use
them later.
Cc: Wengang Wang <wen.gang.wang@oracle.com>
Signed-off-by: Tao Ma <boyu.mt@taobao.com>
Diffstat (limited to 'fs/ocfs2/ocfs2_trace.h')
-rw-r--r-- | fs/ocfs2/ocfs2_trace.h | 364 |
1 files changed, 364 insertions, 0 deletions
diff --git a/fs/ocfs2/ocfs2_trace.h b/fs/ocfs2/ocfs2_trace.h index 8d4e49aef491..1793b1f71805 100644 --- a/fs/ocfs2/ocfs2_trace.h +++ b/fs/ocfs2/ocfs2_trace.h | |||
@@ -6,6 +6,370 @@ | |||
6 | 6 | ||
7 | #include <linux/tracepoint.h> | 7 | #include <linux/tracepoint.h> |
8 | 8 | ||
9 | DECLARE_EVENT_CLASS(ocfs2__int, | ||
10 | TP_PROTO(int num), | ||
11 | TP_ARGS(num), | ||
12 | TP_STRUCT__entry( | ||
13 | __field(int, num) | ||
14 | ), | ||
15 | TP_fast_assign( | ||
16 | __entry->num = num; | ||
17 | ), | ||
18 | TP_printk("%d", __entry->num) | ||
19 | ); | ||
20 | |||
21 | #define DEFINE_OCFS2_INT_EVENT(name) \ | ||
22 | DEFINE_EVENT(ocfs2__int, name, \ | ||
23 | TP_PROTO(int num), \ | ||
24 | TP_ARGS(num)) | ||
25 | |||
26 | DECLARE_EVENT_CLASS(ocfs2__int_int, | ||
27 | TP_PROTO(int value1, int value2), | ||
28 | TP_ARGS(value1, value2), | ||
29 | TP_STRUCT__entry( | ||
30 | __field(int, value1) | ||
31 | __field(int, value2) | ||
32 | ), | ||
33 | TP_fast_assign( | ||
34 | __entry->value1 = value1; | ||
35 | __entry->value2 = value2; | ||
36 | ), | ||
37 | TP_printk("%d %d", __entry->value1, __entry->value2) | ||
38 | ); | ||
39 | |||
40 | #define DEFINE_OCFS2_INT_INT_EVENT(name) \ | ||
41 | DEFINE_EVENT(ocfs2__int_int, name, \ | ||
42 | TP_PROTO(int val1, int val2), \ | ||
43 | TP_ARGS(val1, val2)) | ||
44 | |||
45 | DECLARE_EVENT_CLASS(ocfs2__ull_uint, | ||
46 | TP_PROTO(unsigned long long value1, unsigned int value2), | ||
47 | TP_ARGS(value1, value2), | ||
48 | TP_STRUCT__entry( | ||
49 | __field(unsigned long long, value1) | ||
50 | __field(unsigned int, value2) | ||
51 | ), | ||
52 | TP_fast_assign( | ||
53 | __entry->value1 = value1; | ||
54 | __entry->value2 = value2; | ||
55 | ), | ||
56 | TP_printk("%llu %u", __entry->value1, __entry->value2) | ||
57 | ); | ||
58 | |||
59 | #define DEFINE_OCFS2_ULL_UINT_EVENT(name) \ | ||
60 | DEFINE_EVENT(ocfs2__ull_uint, name, \ | ||
61 | TP_PROTO(unsigned long long val1, unsigned int val2), \ | ||
62 | TP_ARGS(val1, val2)) | ||
63 | |||
64 | /* Trace events for fs/ocfs2/alloc.c. */ | ||
65 | DECLARE_EVENT_CLASS(ocfs2__btree_ops, | ||
66 | TP_PROTO(unsigned long long owner,\ | ||
67 | unsigned int value1, unsigned int value2), | ||
68 | TP_ARGS(owner, value1, value2), | ||
69 | TP_STRUCT__entry( | ||
70 | __field(unsigned long long, owner) | ||
71 | __field(unsigned int, value1) | ||
72 | __field(unsigned int, value2) | ||
73 | ), | ||
74 | TP_fast_assign( | ||
75 | __entry->owner = owner; | ||
76 | __entry->value1 = value1; | ||
77 | __entry->value2 = value2; | ||
78 | ), | ||
79 | TP_printk("%llu %u %u", | ||
80 | __entry->owner, __entry->value1, __entry->value2) | ||
81 | ); | ||
82 | |||
83 | #define DEFINE_OCFS2_BTREE_EVENT(name) \ | ||
84 | DEFINE_EVENT(ocfs2__btree_ops, name, \ | ||
85 | TP_PROTO(unsigned long long owner, \ | ||
86 | unsigned int value1, unsigned int value2), \ | ||
87 | TP_ARGS(owner, value1, value2)) | ||
88 | |||
89 | DEFINE_OCFS2_BTREE_EVENT(ocfs2_adjust_rightmost_branch); | ||
90 | |||
91 | DEFINE_OCFS2_BTREE_EVENT(ocfs2_rotate_tree_right); | ||
92 | |||
93 | DEFINE_OCFS2_BTREE_EVENT(ocfs2_append_rec_to_path); | ||
94 | |||
95 | DEFINE_OCFS2_BTREE_EVENT(ocfs2_insert_extent_start); | ||
96 | |||
97 | DEFINE_OCFS2_BTREE_EVENT(ocfs2_add_clusters_in_btree); | ||
98 | |||
99 | DEFINE_OCFS2_INT_EVENT(ocfs2_num_free_extents); | ||
100 | |||
101 | DEFINE_OCFS2_INT_EVENT(ocfs2_complete_edge_insert); | ||
102 | |||
103 | TRACE_EVENT(ocfs2_grow_tree, | ||
104 | TP_PROTO(unsigned long long owner, int depth), | ||
105 | TP_ARGS(owner, depth), | ||
106 | TP_STRUCT__entry( | ||
107 | __field(unsigned long long, owner) | ||
108 | __field(int, depth) | ||
109 | ), | ||
110 | TP_fast_assign( | ||
111 | __entry->owner = owner; | ||
112 | __entry->depth = depth; | ||
113 | ), | ||
114 | TP_printk("%llu %d", __entry->owner, __entry->depth) | ||
115 | ); | ||
116 | |||
117 | TRACE_EVENT(ocfs2_rotate_subtree, | ||
118 | TP_PROTO(int subtree_root, unsigned long long blkno, | ||
119 | int depth), | ||
120 | TP_ARGS(subtree_root, blkno, depth), | ||
121 | TP_STRUCT__entry( | ||
122 | __field(int, subtree_root) | ||
123 | __field(unsigned long long, blkno) | ||
124 | __field(int, depth) | ||
125 | ), | ||
126 | TP_fast_assign( | ||
127 | __entry->subtree_root = subtree_root; | ||
128 | __entry->blkno = blkno; | ||
129 | __entry->depth = depth; | ||
130 | ), | ||
131 | TP_printk("%d %llu %d", __entry->subtree_root, | ||
132 | __entry->blkno, __entry->depth) | ||
133 | ); | ||
134 | |||
135 | TRACE_EVENT(ocfs2_insert_extent, | ||
136 | TP_PROTO(unsigned int ins_appending, unsigned int ins_contig, | ||
137 | int ins_contig_index, int free_records, int ins_tree_depth), | ||
138 | TP_ARGS(ins_appending, ins_contig, ins_contig_index, free_records, | ||
139 | ins_tree_depth), | ||
140 | TP_STRUCT__entry( | ||
141 | __field(unsigned int, ins_appending) | ||
142 | __field(unsigned int, ins_contig) | ||
143 | __field(int, ins_contig_index) | ||
144 | __field(int, free_records) | ||
145 | __field(int, ins_tree_depth) | ||
146 | ), | ||
147 | TP_fast_assign( | ||
148 | __entry->ins_appending = ins_appending; | ||
149 | __entry->ins_contig = ins_contig; | ||
150 | __entry->ins_contig_index = ins_contig_index; | ||
151 | __entry->free_records = free_records; | ||
152 | __entry->ins_tree_depth = ins_tree_depth; | ||
153 | ), | ||
154 | TP_printk("%u %u %d %d %d", | ||
155 | __entry->ins_appending, __entry->ins_contig, | ||
156 | __entry->ins_contig_index, __entry->free_records, | ||
157 | __entry->ins_tree_depth) | ||
158 | ); | ||
159 | |||
160 | TRACE_EVENT(ocfs2_split_extent, | ||
161 | TP_PROTO(int split_index, unsigned int c_contig_type, | ||
162 | unsigned int c_has_empty_extent, | ||
163 | unsigned int c_split_covers_rec), | ||
164 | TP_ARGS(split_index, c_contig_type, | ||
165 | c_has_empty_extent, c_split_covers_rec), | ||
166 | TP_STRUCT__entry( | ||
167 | __field(int, split_index) | ||
168 | __field(unsigned int, c_contig_type) | ||
169 | __field(unsigned int, c_has_empty_extent) | ||
170 | __field(unsigned int, c_split_covers_rec) | ||
171 | ), | ||
172 | TP_fast_assign( | ||
173 | __entry->split_index = split_index; | ||
174 | __entry->c_contig_type = c_contig_type; | ||
175 | __entry->c_has_empty_extent = c_has_empty_extent; | ||
176 | __entry->c_split_covers_rec = c_split_covers_rec; | ||
177 | ), | ||
178 | TP_printk("%d %u %u %u", __entry->split_index, __entry->c_contig_type, | ||
179 | __entry->c_has_empty_extent, __entry->c_split_covers_rec) | ||
180 | ); | ||
181 | |||
182 | TRACE_EVENT(ocfs2_remove_extent, | ||
183 | TP_PROTO(unsigned long long owner, unsigned int cpos, | ||
184 | unsigned int len, int index, | ||
185 | unsigned int e_cpos, unsigned int clusters), | ||
186 | TP_ARGS(owner, cpos, len, index, e_cpos, clusters), | ||
187 | TP_STRUCT__entry( | ||
188 | __field(unsigned long long, owner) | ||
189 | __field(unsigned int, cpos) | ||
190 | __field(unsigned int, len) | ||
191 | __field(int, index) | ||
192 | __field(unsigned int, e_cpos) | ||
193 | __field(unsigned int, clusters) | ||
194 | ), | ||
195 | TP_fast_assign( | ||
196 | __entry->owner = owner; | ||
197 | __entry->cpos = cpos; | ||
198 | __entry->len = len; | ||
199 | __entry->index = index; | ||
200 | __entry->e_cpos = e_cpos; | ||
201 | __entry->clusters = clusters; | ||
202 | ), | ||
203 | TP_printk("%llu %u %u %d %u %u", | ||
204 | __entry->owner, __entry->cpos, __entry->len, __entry->index, | ||
205 | __entry->e_cpos, __entry->clusters) | ||
206 | ); | ||
207 | |||
208 | TRACE_EVENT(ocfs2_commit_truncate, | ||
209 | TP_PROTO(unsigned long long ino, unsigned int new_cpos, | ||
210 | unsigned int clusters, unsigned int depth), | ||
211 | TP_ARGS(ino, new_cpos, clusters, depth), | ||
212 | TP_STRUCT__entry( | ||
213 | __field(unsigned long long, ino) | ||
214 | __field(unsigned int, new_cpos) | ||
215 | __field(unsigned int, clusters) | ||
216 | __field(unsigned int, depth) | ||
217 | ), | ||
218 | TP_fast_assign( | ||
219 | __entry->ino = ino; | ||
220 | __entry->new_cpos = new_cpos; | ||
221 | __entry->clusters = clusters; | ||
222 | __entry->depth = depth; | ||
223 | ), | ||
224 | TP_printk("%llu %u %u %u", | ||
225 | __entry->ino, __entry->new_cpos, | ||
226 | __entry->clusters, __entry->depth) | ||
227 | ); | ||
228 | |||
229 | TRACE_EVENT(ocfs2_validate_extent_block, | ||
230 | TP_PROTO(unsigned long long blkno), | ||
231 | TP_ARGS(blkno), | ||
232 | TP_STRUCT__entry( | ||
233 | __field(unsigned long long, blkno) | ||
234 | ), | ||
235 | TP_fast_assign( | ||
236 | __entry->blkno = blkno; | ||
237 | ), | ||
238 | TP_printk("%llu ", __entry->blkno) | ||
239 | ); | ||
240 | |||
241 | TRACE_EVENT(ocfs2_rotate_leaf, | ||
242 | TP_PROTO(unsigned int insert_cpos, int insert_index, | ||
243 | int has_empty, int next_free, | ||
244 | unsigned int l_count), | ||
245 | TP_ARGS(insert_cpos, insert_index, has_empty, | ||
246 | next_free, l_count), | ||
247 | TP_STRUCT__entry( | ||
248 | __field(unsigned int, insert_cpos) | ||
249 | __field(int, insert_index) | ||
250 | __field(int, has_empty) | ||
251 | __field(int, next_free) | ||
252 | __field(unsigned int, l_count) | ||
253 | ), | ||
254 | TP_fast_assign( | ||
255 | __entry->insert_cpos = insert_cpos; | ||
256 | __entry->insert_index = insert_index; | ||
257 | __entry->has_empty = has_empty; | ||
258 | __entry->next_free = next_free; | ||
259 | __entry->l_count = l_count; | ||
260 | ), | ||
261 | TP_printk("%u %d %d %d %u", __entry->insert_cpos, | ||
262 | __entry->insert_index, __entry->has_empty, | ||
263 | __entry->next_free, __entry->l_count) | ||
264 | ); | ||
265 | |||
266 | TRACE_EVENT(ocfs2_add_clusters_in_btree_ret, | ||
267 | TP_PROTO(int status, int reason, int err), | ||
268 | TP_ARGS(status, reason, err), | ||
269 | TP_STRUCT__entry( | ||
270 | __field(int, status) | ||
271 | __field(int, reason) | ||
272 | __field(int, err) | ||
273 | ), | ||
274 | TP_fast_assign( | ||
275 | __entry->status = status; | ||
276 | __entry->reason = reason; | ||
277 | __entry->err = err; | ||
278 | ), | ||
279 | TP_printk("%d %d %d", __entry->status, | ||
280 | __entry->reason, __entry->err) | ||
281 | ); | ||
282 | |||
283 | TRACE_EVENT(ocfs2_mark_extent_written, | ||
284 | TP_PROTO(unsigned long long owner, unsigned int cpos, | ||
285 | unsigned int len, unsigned int phys), | ||
286 | TP_ARGS(owner, cpos, len, phys), | ||
287 | TP_STRUCT__entry( | ||
288 | __field(unsigned long long, owner) | ||
289 | __field(unsigned int, cpos) | ||
290 | __field(unsigned int, len) | ||
291 | __field(unsigned int, phys) | ||
292 | ), | ||
293 | TP_fast_assign( | ||
294 | __entry->owner = owner; | ||
295 | __entry->cpos = cpos; | ||
296 | __entry->len = len; | ||
297 | __entry->phys = phys; | ||
298 | ), | ||
299 | TP_printk("%llu %u %u %u", | ||
300 | __entry->owner, __entry->cpos, | ||
301 | __entry->len, __entry->phys) | ||
302 | ); | ||
303 | |||
304 | DECLARE_EVENT_CLASS(ocfs2__truncate_log_ops, | ||
305 | TP_PROTO(unsigned long long blkno, int index, | ||
306 | unsigned int start, unsigned int num), | ||
307 | TP_ARGS(blkno, index, start, num), | ||
308 | TP_STRUCT__entry( | ||
309 | __field(unsigned long long, blkno) | ||
310 | __field(int, index) | ||
311 | __field(unsigned int, start) | ||
312 | __field(unsigned int, num) | ||
313 | ), | ||
314 | TP_fast_assign( | ||
315 | __entry->blkno = blkno; | ||
316 | __entry->index = index; | ||
317 | __entry->start = start; | ||
318 | __entry->num = num; | ||
319 | ), | ||
320 | TP_printk("%llu %d %u %u", | ||
321 | __entry->blkno, __entry->index, | ||
322 | __entry->start, __entry->num) | ||
323 | ); | ||
324 | |||
325 | #define DEFINE_OCFS2_TRUNCATE_LOG_OPS_EVENT(name) \ | ||
326 | DEFINE_EVENT(ocfs2__truncate_log_ops, name, \ | ||
327 | TP_PROTO(unsigned long long blkno, int index, \ | ||
328 | unsigned int start, unsigned int num), \ | ||
329 | TP_ARGS(blkno, index, start, num)) | ||
330 | |||
331 | DEFINE_OCFS2_TRUNCATE_LOG_OPS_EVENT(ocfs2_truncate_log_append); | ||
332 | |||
333 | DEFINE_OCFS2_TRUNCATE_LOG_OPS_EVENT(ocfs2_replay_truncate_records); | ||
334 | |||
335 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_flush_truncate_log); | ||
336 | |||
337 | DEFINE_OCFS2_INT_EVENT(ocfs2_begin_truncate_log_recovery); | ||
338 | |||
339 | DEFINE_OCFS2_INT_EVENT(ocfs2_truncate_log_recovery_num); | ||
340 | |||
341 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_complete_truncate_log_recovery); | ||
342 | |||
343 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_free_cached_blocks); | ||
344 | |||
345 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_cache_cluster_dealloc); | ||
346 | |||
347 | DEFINE_OCFS2_INT_INT_EVENT(ocfs2_run_deallocs); | ||
348 | |||
349 | TRACE_EVENT(ocfs2_cache_block_dealloc, | ||
350 | TP_PROTO(int type, int slot, unsigned long long suballoc, | ||
351 | unsigned long long blkno, unsigned int bit), | ||
352 | TP_ARGS(type, slot, suballoc, blkno, bit), | ||
353 | TP_STRUCT__entry( | ||
354 | __field(int, type) | ||
355 | __field(int, slot) | ||
356 | __field(unsigned long long, suballoc) | ||
357 | __field(unsigned long long, blkno) | ||
358 | __field(unsigned int, bit) | ||
359 | ), | ||
360 | TP_fast_assign( | ||
361 | __entry->type = type; | ||
362 | __entry->slot = slot; | ||
363 | __entry->suballoc = suballoc; | ||
364 | __entry->blkno = blkno; | ||
365 | __entry->bit = bit; | ||
366 | ), | ||
367 | TP_printk("%d %d %llu %llu %u", | ||
368 | __entry->type, __entry->slot, __entry->suballoc, | ||
369 | __entry->blkno, __entry->bit) | ||
370 | ); | ||
371 | |||
372 | /* End of trace events for fs/ocfs2/alloc.c. */ | ||
9 | 373 | ||
10 | #endif /* _TRACE_OCFS2_H */ | 374 | #endif /* _TRACE_OCFS2_H */ |
11 | 375 | ||