tracing: fix the block trace points print size
[linux-2.6.git] / include / trace / events / block.h
1 #if !defined(_TRACE_BLOCK_H) || defined(TRACE_HEADER_MULTI_READ)
2 #define _TRACE_BLOCK_H
3
4 #include <linux/blktrace_api.h>
5 #include <linux/blkdev.h>
6 #include <linux/tracepoint.h>
7
8 #undef TRACE_SYSTEM
9 #define TRACE_SYSTEM block
10
11 TRACE_EVENT(block_rq_abort,
12
13         TP_PROTO(struct request_queue *q, struct request *rq),
14
15         TP_ARGS(q, rq),
16
17         TP_STRUCT__entry(
18                 __field(  dev_t,        dev                     )
19                 __field(  sector_t,     sector                  )
20                 __field(  unsigned int, nr_sector               )
21                 __field(  int,          errors                  )
22                 __array(  char,         rwbs,   6               )
23                 __dynamic_array( char,  cmd,    blk_cmd_buf_len(rq)     )
24         ),
25
26         TP_fast_assign(
27                 __entry->dev       = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
28                 __entry->sector    = blk_pc_request(rq) ? 0 : rq->hard_sector;
29                 __entry->nr_sector = blk_pc_request(rq) ?
30                                                 0 : rq->hard_nr_sectors;
31                 __entry->errors    = rq->errors;
32
33                 blk_fill_rwbs_rq(__entry->rwbs, rq);
34                 blk_dump_cmd(__get_str(cmd), rq);
35         ),
36
37         TP_printk("%d,%d %s (%s) %llu + %u [%d]",
38                   MAJOR(__entry->dev), MINOR(__entry->dev),
39                   __entry->rwbs, __get_str(cmd),
40                   (unsigned long long)__entry->sector,
41                   __entry->nr_sector, __entry->errors)
42 );
43
44 TRACE_EVENT(block_rq_insert,
45
46         TP_PROTO(struct request_queue *q, struct request *rq),
47
48         TP_ARGS(q, rq),
49
50         TP_STRUCT__entry(
51                 __field(  dev_t,        dev                     )
52                 __field(  sector_t,     sector                  )
53                 __field(  unsigned int, nr_sector               )
54                 __field(  unsigned int, bytes                   )
55                 __array(  char,         rwbs,   6               )
56                 __array(  char,         comm,   TASK_COMM_LEN   )
57                 __dynamic_array( char,  cmd,    blk_cmd_buf_len(rq)     )
58         ),
59
60         TP_fast_assign(
61                 __entry->dev       = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
62                 __entry->sector    = blk_pc_request(rq) ? 0 : rq->hard_sector;
63                 __entry->nr_sector = blk_pc_request(rq) ?
64                                                 0 : rq->hard_nr_sectors;
65                 __entry->bytes     = blk_pc_request(rq) ? rq->data_len : 0;
66
67                 blk_fill_rwbs_rq(__entry->rwbs, rq);
68                 blk_dump_cmd(__get_str(cmd), rq);
69                 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
70         ),
71
72         TP_printk("%d,%d %s %u (%s) %llu + %u [%s]",
73                   MAJOR(__entry->dev), MINOR(__entry->dev),
74                   __entry->rwbs, __entry->bytes, __get_str(cmd),
75                   (unsigned long long)__entry->sector,
76                   __entry->nr_sector, __entry->comm)
77 );
78
79 TRACE_EVENT(block_rq_issue,
80
81         TP_PROTO(struct request_queue *q, struct request *rq),
82
83         TP_ARGS(q, rq),
84
85         TP_STRUCT__entry(
86                 __field(  dev_t,        dev                     )
87                 __field(  sector_t,     sector                  )
88                 __field(  unsigned int, nr_sector               )
89                 __field(  unsigned int, bytes                   )
90                 __array(  char,         rwbs,   6               )
91                 __array(  char,         comm,   TASK_COMM_LEN   )
92                 __dynamic_array( char,  cmd,    blk_cmd_buf_len(rq)     )
93         ),
94
95         TP_fast_assign(
96                 __entry->dev       = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
97                 __entry->sector    = blk_pc_request(rq) ? 0 : rq->hard_sector;
98                 __entry->nr_sector = blk_pc_request(rq) ?
99                                                 0 : rq->hard_nr_sectors;
100                 __entry->bytes     = blk_pc_request(rq) ? rq->data_len : 0;
101
102                 blk_fill_rwbs_rq(__entry->rwbs, rq);
103                 blk_dump_cmd(__get_str(cmd), rq);
104                 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
105         ),
106
107         TP_printk("%d,%d %s %u (%s) %llu + %u [%s]",
108                   MAJOR(__entry->dev), MINOR(__entry->dev),
109                   __entry->rwbs, __entry->bytes, __get_str(cmd),
110                   (unsigned long long)__entry->sector,
111                   __entry->nr_sector, __entry->comm)
112 );
113
114 TRACE_EVENT(block_rq_requeue,
115
116         TP_PROTO(struct request_queue *q, struct request *rq),
117
118         TP_ARGS(q, rq),
119
120         TP_STRUCT__entry(
121                 __field(  dev_t,        dev                     )
122                 __field(  sector_t,     sector                  )
123                 __field(  unsigned int, nr_sector               )
124                 __field(  int,          errors                  )
125                 __array(  char,         rwbs,   6               )
126                 __dynamic_array( char,  cmd,    blk_cmd_buf_len(rq)     )
127         ),
128
129         TP_fast_assign(
130                 __entry->dev       = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
131                 __entry->sector    = blk_pc_request(rq) ? 0 : rq->hard_sector;
132                 __entry->nr_sector = blk_pc_request(rq) ?
133                                                 0 : rq->hard_nr_sectors;
134                 __entry->errors    = rq->errors;
135
136                 blk_fill_rwbs_rq(__entry->rwbs, rq);
137                 blk_dump_cmd(__get_str(cmd), rq);
138         ),
139
140         TP_printk("%d,%d %s (%s) %llu + %u [%d]",
141                   MAJOR(__entry->dev), MINOR(__entry->dev),
142                   __entry->rwbs, __get_str(cmd),
143                   (unsigned long long)__entry->sector,
144                   __entry->nr_sector, __entry->errors)
145 );
146
147 TRACE_EVENT(block_rq_complete,
148
149         TP_PROTO(struct request_queue *q, struct request *rq),
150
151         TP_ARGS(q, rq),
152
153         TP_STRUCT__entry(
154                 __field(  dev_t,        dev                     )
155                 __field(  sector_t,     sector                  )
156                 __field(  unsigned int, nr_sector               )
157                 __field(  int,          errors                  )
158                 __array(  char,         rwbs,   6               )
159                 __dynamic_array( char,  cmd,    blk_cmd_buf_len(rq)     )
160         ),
161
162         TP_fast_assign(
163                 __entry->dev       = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
164                 __entry->sector    = blk_pc_request(rq) ? 0 : rq->hard_sector;
165                 __entry->nr_sector = blk_pc_request(rq) ?
166                                                 0 : rq->hard_nr_sectors;
167                 __entry->errors    = rq->errors;
168
169                 blk_fill_rwbs_rq(__entry->rwbs, rq);
170                 blk_dump_cmd(__get_str(cmd), rq);
171         ),
172
173         TP_printk("%d,%d %s (%s) %llu + %u [%d]",
174                   MAJOR(__entry->dev), MINOR(__entry->dev),
175                   __entry->rwbs, __get_str(cmd),
176                   (unsigned long long)__entry->sector,
177                   __entry->nr_sector, __entry->errors)
178 );
179 TRACE_EVENT(block_bio_bounce,
180
181         TP_PROTO(struct request_queue *q, struct bio *bio),
182
183         TP_ARGS(q, bio),
184
185         TP_STRUCT__entry(
186                 __field( dev_t,         dev                     )
187                 __field( sector_t,      sector                  )
188                 __field( unsigned int,  nr_sector               )
189                 __array( char,          rwbs,   6               )
190                 __array( char,          comm,   TASK_COMM_LEN   )
191         ),
192
193         TP_fast_assign(
194                 __entry->dev            = bio->bi_bdev->bd_dev;
195                 __entry->sector         = bio->bi_sector;
196                 __entry->nr_sector      = bio->bi_size >> 9;
197                 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
198                 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
199         ),
200
201         TP_printk("%d,%d %s %llu + %u [%s]",
202                   MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
203                   (unsigned long long)__entry->sector,
204                   __entry->nr_sector, __entry->comm)
205 );
206
207 TRACE_EVENT(block_bio_complete,
208
209         TP_PROTO(struct request_queue *q, struct bio *bio),
210
211         TP_ARGS(q, bio),
212
213         TP_STRUCT__entry(
214                 __field( dev_t,         dev             )
215                 __field( sector_t,      sector          )
216                 __field( unsigned,      nr_sector       )
217                 __field( int,           error           )
218                 __array( char,          rwbs,   6       )
219         ),
220
221         TP_fast_assign(
222                 __entry->dev            = bio->bi_bdev->bd_dev;
223                 __entry->sector         = bio->bi_sector;
224                 __entry->nr_sector      = bio->bi_size >> 9;
225                 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
226         ),
227
228         TP_printk("%d,%d %s %llu + %u [%d]",
229                   MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
230                   (unsigned long long)__entry->sector,
231                   __entry->nr_sector, __entry->error)
232 );
233
234 TRACE_EVENT(block_bio_backmerge,
235
236         TP_PROTO(struct request_queue *q, struct bio *bio),
237
238         TP_ARGS(q, bio),
239
240         TP_STRUCT__entry(
241                 __field( dev_t,         dev                     )
242                 __field( sector_t,      sector                  )
243                 __field( unsigned int,  nr_sector               )
244                 __array( char,          rwbs,   6               )
245                 __array( char,          comm,   TASK_COMM_LEN   )
246         ),
247
248         TP_fast_assign(
249                 __entry->dev            = bio->bi_bdev->bd_dev;
250                 __entry->sector         = bio->bi_sector;
251                 __entry->nr_sector      = bio->bi_size >> 9;
252                 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
253                 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
254         ),
255
256         TP_printk("%d,%d %s %llu + %u [%s]",
257                   MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
258                   (unsigned long long)__entry->sector,
259                   __entry->nr_sector, __entry->comm)
260 );
261
262 TRACE_EVENT(block_bio_frontmerge,
263
264         TP_PROTO(struct request_queue *q, struct bio *bio),
265
266         TP_ARGS(q, bio),
267
268         TP_STRUCT__entry(
269                 __field( dev_t,         dev                     )
270                 __field( sector_t,      sector                  )
271                 __field( unsigned,      nr_sector               )
272                 __array( char,          rwbs,   6               )
273                 __array( char,          comm,   TASK_COMM_LEN   )
274         ),
275
276         TP_fast_assign(
277                 __entry->dev            = bio->bi_bdev->bd_dev;
278                 __entry->sector         = bio->bi_sector;
279                 __entry->nr_sector      = bio->bi_size >> 9;
280                 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
281                 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
282         ),
283
284         TP_printk("%d,%d %s %llu + %u [%s]",
285                   MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
286                   (unsigned long long)__entry->sector,
287                   __entry->nr_sector, __entry->comm)
288 );
289
290 TRACE_EVENT(block_bio_queue,
291
292         TP_PROTO(struct request_queue *q, struct bio *bio),
293
294         TP_ARGS(q, bio),
295
296         TP_STRUCT__entry(
297                 __field( dev_t,         dev                     )
298                 __field( sector_t,      sector                  )
299                 __field( unsigned int,  nr_sector               )
300                 __array( char,          rwbs,   6               )
301                 __array( char,          comm,   TASK_COMM_LEN   )
302         ),
303
304         TP_fast_assign(
305                 __entry->dev            = bio->bi_bdev->bd_dev;
306                 __entry->sector         = bio->bi_sector;
307                 __entry->nr_sector      = bio->bi_size >> 9;
308                 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
309                 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
310         ),
311
312         TP_printk("%d,%d %s %llu + %u [%s]",
313                   MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
314                   (unsigned long long)__entry->sector,
315                   __entry->nr_sector, __entry->comm)
316 );
317
318 TRACE_EVENT(block_getrq,
319
320         TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
321
322         TP_ARGS(q, bio, rw),
323
324         TP_STRUCT__entry(
325                 __field( dev_t,         dev                     )
326                 __field( sector_t,      sector                  )
327                 __field( unsigned int,  nr_sector               )
328                 __array( char,          rwbs,   6               )
329                 __array( char,          comm,   TASK_COMM_LEN   )
330         ),
331
332         TP_fast_assign(
333                 __entry->dev            = bio ? bio->bi_bdev->bd_dev : 0;
334                 __entry->sector         = bio ? bio->bi_sector : 0;
335                 __entry->nr_sector      = bio ? bio->bi_size >> 9 : 0;
336                 blk_fill_rwbs(__entry->rwbs,
337                               bio ? bio->bi_rw : 0, __entry->nr_sector);
338                 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
339         ),
340
341         TP_printk("%d,%d %s %llu + %u [%s]",
342                   MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
343                   (unsigned long long)__entry->sector,
344                   __entry->nr_sector, __entry->comm)
345 );
346
347 TRACE_EVENT(block_sleeprq,
348
349         TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
350
351         TP_ARGS(q, bio, rw),
352
353         TP_STRUCT__entry(
354                 __field( dev_t,         dev                     )
355                 __field( sector_t,      sector                  )
356                 __field( unsigned int,  nr_sector               )
357                 __array( char,          rwbs,   6               )
358                 __array( char,          comm,   TASK_COMM_LEN   )
359         ),
360
361         TP_fast_assign(
362                 __entry->dev            = bio ? bio->bi_bdev->bd_dev : 0;
363                 __entry->sector         = bio ? bio->bi_sector : 0;
364                 __entry->nr_sector      = bio ? bio->bi_size >> 9 : 0;
365                 blk_fill_rwbs(__entry->rwbs,
366                             bio ? bio->bi_rw : 0, __entry->nr_sector);
367                 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
368         ),
369
370         TP_printk("%d,%d %s %llu + %u [%s]",
371                   MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
372                   (unsigned long long)__entry->sector,
373                   __entry->nr_sector, __entry->comm)
374 );
375
376 TRACE_EVENT(block_plug,
377
378         TP_PROTO(struct request_queue *q),
379
380         TP_ARGS(q),
381
382         TP_STRUCT__entry(
383                 __array( char,          comm,   TASK_COMM_LEN   )
384         ),
385
386         TP_fast_assign(
387                 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
388         ),
389
390         TP_printk("[%s]", __entry->comm)
391 );
392
393 TRACE_EVENT(block_unplug_timer,
394
395         TP_PROTO(struct request_queue *q),
396
397         TP_ARGS(q),
398
399         TP_STRUCT__entry(
400                 __field( int,           nr_rq                   )
401                 __array( char,          comm,   TASK_COMM_LEN   )
402         ),
403
404         TP_fast_assign(
405                 __entry->nr_rq  = q->rq.count[READ] + q->rq.count[WRITE];
406                 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
407         ),
408
409         TP_printk("[%s] %d", __entry->comm, __entry->nr_rq)
410 );
411
412 TRACE_EVENT(block_unplug_io,
413
414         TP_PROTO(struct request_queue *q),
415
416         TP_ARGS(q),
417
418         TP_STRUCT__entry(
419                 __field( int,           nr_rq                   )
420                 __array( char,          comm,   TASK_COMM_LEN   )
421         ),
422
423         TP_fast_assign(
424                 __entry->nr_rq  = q->rq.count[READ] + q->rq.count[WRITE];
425                 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
426         ),
427
428         TP_printk("[%s] %d", __entry->comm, __entry->nr_rq)
429 );
430
431 TRACE_EVENT(block_split,
432
433         TP_PROTO(struct request_queue *q, struct bio *bio,
434                  unsigned int new_sector),
435
436         TP_ARGS(q, bio, new_sector),
437
438         TP_STRUCT__entry(
439                 __field( dev_t,         dev                             )
440                 __field( sector_t,      sector                          )
441                 __field( sector_t,      new_sector                      )
442                 __array( char,          rwbs,           6               )
443                 __array( char,          comm,           TASK_COMM_LEN   )
444         ),
445
446         TP_fast_assign(
447                 __entry->dev            = bio->bi_bdev->bd_dev;
448                 __entry->sector         = bio->bi_sector;
449                 __entry->new_sector     = new_sector;
450                 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
451                 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
452         ),
453
454         TP_printk("%d,%d %s %llu / %llu [%s]",
455                   MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
456                   (unsigned long long)__entry->sector,
457                   (unsigned long long)__entry->new_sector,
458                   __entry->comm)
459 );
460
461 TRACE_EVENT(block_remap,
462
463         TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev,
464                  sector_t from),
465
466         TP_ARGS(q, bio, dev, from),
467
468         TP_STRUCT__entry(
469                 __field( dev_t,         dev             )
470                 __field( sector_t,      sector          )
471                 __field( unsigned int,  nr_sector       )
472                 __field( dev_t,         old_dev         )
473                 __field( sector_t,      old_sector      )
474                 __array( char,          rwbs,   6       )
475         ),
476
477         TP_fast_assign(
478                 __entry->dev            = bio->bi_bdev->bd_dev;
479                 __entry->sector         = bio->bi_sector;
480                 __entry->nr_sector      = bio->bi_size >> 9;
481                 __entry->old_dev        = dev;
482                 __entry->old_sector     = from;
483                 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
484         ),
485
486         TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
487                   MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
488                   (unsigned long long)__entry->sector,
489                   __entry->nr_sector,
490                   MAJOR(__entry->old_dev), MINOR(__entry->old_dev),
491                   (unsigned long long)__entry->old_sector)
492 );
493
494 #endif /* _TRACE_BLOCK_H */
495
496 /* This part must be outside protection */
497 #include <trace/define_trace.h>
498