diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-11-26 02:06:14 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-11-26 03:14:04 -0500 |
commit | 77ca1e0294f25fc26053ba14353e703158acef26 (patch) | |
tree | 9f227291d8da984b28708ec3bd2b5cc92cb787da /include | |
parent | 7703466b4c0a21b88d701882bef0d45bcb0a0281 (diff) |
tracing: Convert some block events to DEFINE_EVENT
use DECLARE_EVENT_CLASS to remove duplicate code:
text data bss dec hex filename
53570 3284 184 57038 dece block/blk-core.o.old
43702 3284 144 47130 b81a block/blk-core.o
12 events are converted:
block_rq: block_rq_insert, block_rq_issue
block_rq_with_error: block_rq_{abort, requeue, complete}
block_bio: block_bio_{backmerge, frontmerge, queue}
block_get_rq: block_getrq, block_sleeprq
block_unplug: block_unplug_timer, block_unplug_io
No change in functionality.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <4B0E28E6.7060609@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r-- | include/trace/events/block.h | 202 |
1 files changed, 42 insertions, 160 deletions
diff --git a/include/trace/events/block.h b/include/trace/events/block.h index 00405b5f624a..5fb72733331e 100644 --- a/include/trace/events/block.h +++ b/include/trace/events/block.h | |||
@@ -8,7 +8,7 @@ | |||
8 | #include <linux/blkdev.h> | 8 | #include <linux/blkdev.h> |
9 | #include <linux/tracepoint.h> | 9 | #include <linux/tracepoint.h> |
10 | 10 | ||
11 | TRACE_EVENT(block_rq_abort, | 11 | DECLARE_EVENT_CLASS(block_rq_with_error, |
12 | 12 | ||
13 | TP_PROTO(struct request_queue *q, struct request *rq), | 13 | TP_PROTO(struct request_queue *q, struct request *rq), |
14 | 14 | ||
@@ -40,41 +40,28 @@ TRACE_EVENT(block_rq_abort, | |||
40 | __entry->nr_sector, __entry->errors) | 40 | __entry->nr_sector, __entry->errors) |
41 | ); | 41 | ); |
42 | 42 | ||
43 | TRACE_EVENT(block_rq_insert, | 43 | DEFINE_EVENT(block_rq_with_error, block_rq_abort, |
44 | 44 | ||
45 | TP_PROTO(struct request_queue *q, struct request *rq), | 45 | TP_PROTO(struct request_queue *q, struct request *rq), |
46 | 46 | ||
47 | TP_ARGS(q, rq), | 47 | TP_ARGS(q, rq) |
48 | ); | ||
48 | 49 | ||
49 | TP_STRUCT__entry( | 50 | DEFINE_EVENT(block_rq_with_error, block_rq_requeue, |
50 | __field( dev_t, dev ) | ||
51 | __field( sector_t, sector ) | ||
52 | __field( unsigned int, nr_sector ) | ||
53 | __field( unsigned int, bytes ) | ||
54 | __array( char, rwbs, 6 ) | ||
55 | __array( char, comm, TASK_COMM_LEN ) | ||
56 | __dynamic_array( char, cmd, blk_cmd_buf_len(rq) ) | ||
57 | ), | ||
58 | 51 | ||
59 | TP_fast_assign( | 52 | TP_PROTO(struct request_queue *q, struct request *rq), |
60 | __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; | ||
61 | __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq); | ||
62 | __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq); | ||
63 | __entry->bytes = blk_pc_request(rq) ? blk_rq_bytes(rq) : 0; | ||
64 | 53 | ||
65 | blk_fill_rwbs_rq(__entry->rwbs, rq); | 54 | TP_ARGS(q, rq) |
66 | blk_dump_cmd(__get_str(cmd), rq); | 55 | ); |
67 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); | ||
68 | ), | ||
69 | 56 | ||
70 | TP_printk("%d,%d %s %u (%s) %llu + %u [%s]", | 57 | DEFINE_EVENT(block_rq_with_error, block_rq_complete, |
71 | MAJOR(__entry->dev), MINOR(__entry->dev), | 58 | |
72 | __entry->rwbs, __entry->bytes, __get_str(cmd), | 59 | TP_PROTO(struct request_queue *q, struct request *rq), |
73 | (unsigned long long)__entry->sector, | 60 | |
74 | __entry->nr_sector, __entry->comm) | 61 | TP_ARGS(q, rq) |
75 | ); | 62 | ); |
76 | 63 | ||
77 | TRACE_EVENT(block_rq_issue, | 64 | DECLARE_EVENT_CLASS(block_rq, |
78 | 65 | ||
79 | TP_PROTO(struct request_queue *q, struct request *rq), | 66 | TP_PROTO(struct request_queue *q, struct request *rq), |
80 | 67 | ||
@@ -86,7 +73,7 @@ TRACE_EVENT(block_rq_issue, | |||
86 | __field( unsigned int, nr_sector ) | 73 | __field( unsigned int, nr_sector ) |
87 | __field( unsigned int, bytes ) | 74 | __field( unsigned int, bytes ) |
88 | __array( char, rwbs, 6 ) | 75 | __array( char, rwbs, 6 ) |
89 | __array( char, comm, TASK_COMM_LEN ) | 76 | __array( char, comm, TASK_COMM_LEN ) |
90 | __dynamic_array( char, cmd, blk_cmd_buf_len(rq) ) | 77 | __dynamic_array( char, cmd, blk_cmd_buf_len(rq) ) |
91 | ), | 78 | ), |
92 | 79 | ||
@@ -108,68 +95,18 @@ TRACE_EVENT(block_rq_issue, | |||
108 | __entry->nr_sector, __entry->comm) | 95 | __entry->nr_sector, __entry->comm) |
109 | ); | 96 | ); |
110 | 97 | ||
111 | TRACE_EVENT(block_rq_requeue, | 98 | DEFINE_EVENT(block_rq, block_rq_insert, |
112 | 99 | ||
113 | TP_PROTO(struct request_queue *q, struct request *rq), | 100 | TP_PROTO(struct request_queue *q, struct request *rq), |
114 | 101 | ||
115 | TP_ARGS(q, rq), | 102 | TP_ARGS(q, rq) |
116 | |||
117 | TP_STRUCT__entry( | ||
118 | __field( dev_t, dev ) | ||
119 | __field( sector_t, sector ) | ||
120 | __field( unsigned int, nr_sector ) | ||
121 | __field( int, errors ) | ||
122 | __array( char, rwbs, 6 ) | ||
123 | __dynamic_array( char, cmd, blk_cmd_buf_len(rq) ) | ||
124 | ), | ||
125 | |||
126 | TP_fast_assign( | ||
127 | __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; | ||
128 | __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq); | ||
129 | __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq); | ||
130 | __entry->errors = rq->errors; | ||
131 | |||
132 | blk_fill_rwbs_rq(__entry->rwbs, rq); | ||
133 | blk_dump_cmd(__get_str(cmd), rq); | ||
134 | ), | ||
135 | |||
136 | TP_printk("%d,%d %s (%s) %llu + %u [%d]", | ||
137 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
138 | __entry->rwbs, __get_str(cmd), | ||
139 | (unsigned long long)__entry->sector, | ||
140 | __entry->nr_sector, __entry->errors) | ||
141 | ); | 103 | ); |
142 | 104 | ||
143 | TRACE_EVENT(block_rq_complete, | 105 | DEFINE_EVENT(block_rq, block_rq_issue, |
144 | 106 | ||
145 | TP_PROTO(struct request_queue *q, struct request *rq), | 107 | TP_PROTO(struct request_queue *q, struct request *rq), |
146 | 108 | ||
147 | TP_ARGS(q, rq), | 109 | TP_ARGS(q, rq) |
148 | |||
149 | TP_STRUCT__entry( | ||
150 | __field( dev_t, dev ) | ||
151 | __field( sector_t, sector ) | ||
152 | __field( unsigned int, nr_sector ) | ||
153 | __field( int, errors ) | ||
154 | __array( char, rwbs, 6 ) | ||
155 | __dynamic_array( char, cmd, blk_cmd_buf_len(rq) ) | ||
156 | ), | ||
157 | |||
158 | TP_fast_assign( | ||
159 | __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; | ||
160 | __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq); | ||
161 | __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq); | ||
162 | __entry->errors = rq->errors; | ||
163 | |||
164 | blk_fill_rwbs_rq(__entry->rwbs, rq); | ||
165 | blk_dump_cmd(__get_str(cmd), rq); | ||
166 | ), | ||
167 | |||
168 | TP_printk("%d,%d %s (%s) %llu + %u [%d]", | ||
169 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
170 | __entry->rwbs, __get_str(cmd), | ||
171 | (unsigned long long)__entry->sector, | ||
172 | __entry->nr_sector, __entry->errors) | ||
173 | ); | 110 | ); |
174 | 111 | ||
175 | TRACE_EVENT(block_bio_bounce, | 112 | TRACE_EVENT(block_bio_bounce, |
@@ -228,7 +165,7 @@ TRACE_EVENT(block_bio_complete, | |||
228 | __entry->nr_sector, __entry->error) | 165 | __entry->nr_sector, __entry->error) |
229 | ); | 166 | ); |
230 | 167 | ||
231 | TRACE_EVENT(block_bio_backmerge, | 168 | DECLARE_EVENT_CLASS(block_bio, |
232 | 169 | ||
233 | TP_PROTO(struct request_queue *q, struct bio *bio), | 170 | TP_PROTO(struct request_queue *q, struct bio *bio), |
234 | 171 | ||
@@ -256,63 +193,28 @@ TRACE_EVENT(block_bio_backmerge, | |||
256 | __entry->nr_sector, __entry->comm) | 193 | __entry->nr_sector, __entry->comm) |
257 | ); | 194 | ); |
258 | 195 | ||
259 | TRACE_EVENT(block_bio_frontmerge, | 196 | DEFINE_EVENT(block_bio, block_bio_backmerge, |
260 | 197 | ||
261 | TP_PROTO(struct request_queue *q, struct bio *bio), | 198 | TP_PROTO(struct request_queue *q, struct bio *bio), |
262 | 199 | ||
263 | TP_ARGS(q, bio), | 200 | TP_ARGS(q, bio) |
264 | |||
265 | TP_STRUCT__entry( | ||
266 | __field( dev_t, dev ) | ||
267 | __field( sector_t, sector ) | ||
268 | __field( unsigned, nr_sector ) | ||
269 | __array( char, rwbs, 6 ) | ||
270 | __array( char, comm, TASK_COMM_LEN ) | ||
271 | ), | ||
272 | |||
273 | TP_fast_assign( | ||
274 | __entry->dev = bio->bi_bdev->bd_dev; | ||
275 | __entry->sector = bio->bi_sector; | ||
276 | __entry->nr_sector = bio->bi_size >> 9; | ||
277 | blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); | ||
278 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); | ||
279 | ), | ||
280 | |||
281 | TP_printk("%d,%d %s %llu + %u [%s]", | ||
282 | MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, | ||
283 | (unsigned long long)__entry->sector, | ||
284 | __entry->nr_sector, __entry->comm) | ||
285 | ); | 201 | ); |
286 | 202 | ||
287 | TRACE_EVENT(block_bio_queue, | 203 | DEFINE_EVENT(block_bio, block_bio_frontmerge, |
288 | 204 | ||
289 | TP_PROTO(struct request_queue *q, struct bio *bio), | 205 | TP_PROTO(struct request_queue *q, struct bio *bio), |
290 | 206 | ||
291 | TP_ARGS(q, bio), | 207 | TP_ARGS(q, bio) |
208 | ); | ||
292 | 209 | ||
293 | TP_STRUCT__entry( | 210 | DEFINE_EVENT(block_bio, block_bio_queue, |
294 | __field( dev_t, dev ) | ||
295 | __field( sector_t, sector ) | ||
296 | __field( unsigned int, nr_sector ) | ||
297 | __array( char, rwbs, 6 ) | ||
298 | __array( char, comm, TASK_COMM_LEN ) | ||
299 | ), | ||
300 | 211 | ||
301 | TP_fast_assign( | 212 | TP_PROTO(struct request_queue *q, struct bio *bio), |
302 | __entry->dev = bio->bi_bdev->bd_dev; | ||
303 | __entry->sector = bio->bi_sector; | ||
304 | __entry->nr_sector = bio->bi_size >> 9; | ||
305 | blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); | ||
306 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); | ||
307 | ), | ||
308 | 213 | ||
309 | TP_printk("%d,%d %s %llu + %u [%s]", | 214 | TP_ARGS(q, bio) |
310 | MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, | ||
311 | (unsigned long long)__entry->sector, | ||
312 | __entry->nr_sector, __entry->comm) | ||
313 | ); | 215 | ); |
314 | 216 | ||
315 | TRACE_EVENT(block_getrq, | 217 | DECLARE_EVENT_CLASS(block_get_rq, |
316 | 218 | ||
317 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), | 219 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), |
318 | 220 | ||
@@ -341,33 +243,18 @@ TRACE_EVENT(block_getrq, | |||
341 | __entry->nr_sector, __entry->comm) | 243 | __entry->nr_sector, __entry->comm) |
342 | ); | 244 | ); |
343 | 245 | ||
344 | TRACE_EVENT(block_sleeprq, | 246 | DEFINE_EVENT(block_get_rq, block_getrq, |
345 | 247 | ||
346 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), | 248 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), |
347 | 249 | ||
348 | TP_ARGS(q, bio, rw), | 250 | TP_ARGS(q, bio, rw) |
251 | ); | ||
349 | 252 | ||
350 | TP_STRUCT__entry( | 253 | DEFINE_EVENT(block_get_rq, block_sleeprq, |
351 | __field( dev_t, dev ) | ||
352 | __field( sector_t, sector ) | ||
353 | __field( unsigned int, nr_sector ) | ||
354 | __array( char, rwbs, 6 ) | ||
355 | __array( char, comm, TASK_COMM_LEN ) | ||
356 | ), | ||
357 | 254 | ||
358 | TP_fast_assign( | 255 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), |
359 | __entry->dev = bio ? bio->bi_bdev->bd_dev : 0; | ||
360 | __entry->sector = bio ? bio->bi_sector : 0; | ||
361 | __entry->nr_sector = bio ? bio->bi_size >> 9 : 0; | ||
362 | blk_fill_rwbs(__entry->rwbs, | ||
363 | bio ? bio->bi_rw : 0, __entry->nr_sector); | ||
364 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); | ||
365 | ), | ||
366 | 256 | ||
367 | TP_printk("%d,%d %s %llu + %u [%s]", | 257 | TP_ARGS(q, bio, rw) |
368 | MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, | ||
369 | (unsigned long long)__entry->sector, | ||
370 | __entry->nr_sector, __entry->comm) | ||
371 | ); | 258 | ); |
372 | 259 | ||
373 | TRACE_EVENT(block_plug, | 260 | TRACE_EVENT(block_plug, |
@@ -387,7 +274,7 @@ TRACE_EVENT(block_plug, | |||
387 | TP_printk("[%s]", __entry->comm) | 274 | TP_printk("[%s]", __entry->comm) |
388 | ); | 275 | ); |
389 | 276 | ||
390 | TRACE_EVENT(block_unplug_timer, | 277 | DECLARE_EVENT_CLASS(block_unplug, |
391 | 278 | ||
392 | TP_PROTO(struct request_queue *q), | 279 | TP_PROTO(struct request_queue *q), |
393 | 280 | ||
@@ -406,23 +293,18 @@ TRACE_EVENT(block_unplug_timer, | |||
406 | TP_printk("[%s] %d", __entry->comm, __entry->nr_rq) | 293 | TP_printk("[%s] %d", __entry->comm, __entry->nr_rq) |
407 | ); | 294 | ); |
408 | 295 | ||
409 | TRACE_EVENT(block_unplug_io, | 296 | DEFINE_EVENT(block_unplug, block_unplug_timer, |
410 | 297 | ||
411 | TP_PROTO(struct request_queue *q), | 298 | TP_PROTO(struct request_queue *q), |
412 | 299 | ||
413 | TP_ARGS(q), | 300 | TP_ARGS(q) |
301 | ); | ||
414 | 302 | ||
415 | TP_STRUCT__entry( | 303 | DEFINE_EVENT(block_unplug, block_unplug_io, |
416 | __field( int, nr_rq ) | ||
417 | __array( char, comm, TASK_COMM_LEN ) | ||
418 | ), | ||
419 | 304 | ||
420 | TP_fast_assign( | 305 | TP_PROTO(struct request_queue *q), |
421 | __entry->nr_rq = q->rq.count[READ] + q->rq.count[WRITE]; | ||
422 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); | ||
423 | ), | ||
424 | 306 | ||
425 | TP_printk("[%s] %d", __entry->comm, __entry->nr_rq) | 307 | TP_ARGS(q) |
426 | ); | 308 | ); |
427 | 309 | ||
428 | TRACE_EVENT(block_split, | 310 | TRACE_EVENT(block_split, |