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