2 #define TRACE_SYSTEM block
4 #if !defined(_TRACE_BLOCK_H) || defined(TRACE_HEADER_MULTI_READ)
7 #include <linux/blktrace_api.h>
8 #include <linux/blkdev.h>
9 #include <linux/tracepoint.h>
11 TRACE_EVENT(block_rq_abort
,
13 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
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
) )
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
;
32 blk_fill_rwbs_rq(__entry
->rwbs
, rq
);
33 blk_dump_cmd(__get_str(cmd
), rq
);
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
)
43 TRACE_EVENT(block_rq_insert
,
45 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
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
) )
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;
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
);
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
)
77 TRACE_EVENT(block_rq_issue
,
79 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
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
) )
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;
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
);
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
)
111 TRACE_EVENT(block_rq_requeue
,
113 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
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
) )
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
;
132 blk_fill_rwbs_rq(__entry
->rwbs
, rq
);
133 blk_dump_cmd(__get_str(cmd
), rq
);
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
)
143 TRACE_EVENT(block_rq_complete
,
145 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
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
) )
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
;
164 blk_fill_rwbs_rq(__entry
->rwbs
, rq
);
165 blk_dump_cmd(__get_str(cmd
), rq
);
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
)
175 TRACE_EVENT(block_bio_bounce
,
177 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
182 __field( dev_t
, dev
)
183 __field( sector_t
, sector
)
184 __field( unsigned int, nr_sector
)
185 __array( char, rwbs
, 6 )
186 __array( char, comm
, TASK_COMM_LEN
)
190 __entry
->dev
= bio
->bi_bdev
?
191 bio
->bi_bdev
->bd_dev
: 0;
192 __entry
->sector
= bio
->bi_sector
;
193 __entry
->nr_sector
= bio
->bi_size
>> 9;
194 blk_fill_rwbs(__entry
->rwbs
, bio
->bi_rw
, bio
->bi_size
);
195 memcpy(__entry
->comm
, current
->comm
, TASK_COMM_LEN
);
198 TP_printk("%d,%d %s %llu + %u [%s]",
199 MAJOR(__entry
->dev
), MINOR(__entry
->dev
), __entry
->rwbs
,
200 (unsigned long long)__entry
->sector
,
201 __entry
->nr_sector
, __entry
->comm
)
204 TRACE_EVENT(block_bio_complete
,
206 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
211 __field( dev_t
, dev
)
212 __field( sector_t
, sector
)
213 __field( unsigned, nr_sector
)
214 __field( int, error
)
215 __array( char, rwbs
, 6 )
219 __entry
->dev
= bio
->bi_bdev
->bd_dev
;
220 __entry
->sector
= bio
->bi_sector
;
221 __entry
->nr_sector
= bio
->bi_size
>> 9;
222 blk_fill_rwbs(__entry
->rwbs
, bio
->bi_rw
, bio
->bi_size
);
225 TP_printk("%d,%d %s %llu + %u [%d]",
226 MAJOR(__entry
->dev
), MINOR(__entry
->dev
), __entry
->rwbs
,
227 (unsigned long long)__entry
->sector
,
228 __entry
->nr_sector
, __entry
->error
)
231 TRACE_EVENT(block_bio_backmerge
,
233 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
238 __field( dev_t
, dev
)
239 __field( sector_t
, sector
)
240 __field( unsigned int, nr_sector
)
241 __array( char, rwbs
, 6 )
242 __array( char, comm
, TASK_COMM_LEN
)
246 __entry
->dev
= bio
->bi_bdev
->bd_dev
;
247 __entry
->sector
= bio
->bi_sector
;
248 __entry
->nr_sector
= bio
->bi_size
>> 9;
249 blk_fill_rwbs(__entry
->rwbs
, bio
->bi_rw
, bio
->bi_size
);
250 memcpy(__entry
->comm
, current
->comm
, TASK_COMM_LEN
);
253 TP_printk("%d,%d %s %llu + %u [%s]",
254 MAJOR(__entry
->dev
), MINOR(__entry
->dev
), __entry
->rwbs
,
255 (unsigned long long)__entry
->sector
,
256 __entry
->nr_sector
, __entry
->comm
)
259 TRACE_EVENT(block_bio_frontmerge
,
261 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
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
)
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
);
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
)
287 TRACE_EVENT(block_bio_queue
,
289 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
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
)
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
);
309 TP_printk("%d,%d %s %llu + %u [%s]",
310 MAJOR(__entry
->dev
), MINOR(__entry
->dev
), __entry
->rwbs
,
311 (unsigned long long)__entry
->sector
,
312 __entry
->nr_sector
, __entry
->comm
)
315 TRACE_EVENT(block_getrq
,
317 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
322 __field( dev_t
, dev
)
323 __field( sector_t
, sector
)
324 __field( unsigned int, nr_sector
)
325 __array( char, rwbs
, 6 )
326 __array( char, comm
, TASK_COMM_LEN
)
330 __entry
->dev
= bio
? bio
->bi_bdev
->bd_dev
: 0;
331 __entry
->sector
= bio
? bio
->bi_sector
: 0;
332 __entry
->nr_sector
= bio
? bio
->bi_size
>> 9 : 0;
333 blk_fill_rwbs(__entry
->rwbs
,
334 bio
? bio
->bi_rw
: 0, __entry
->nr_sector
);
335 memcpy(__entry
->comm
, current
->comm
, TASK_COMM_LEN
);
338 TP_printk("%d,%d %s %llu + %u [%s]",
339 MAJOR(__entry
->dev
), MINOR(__entry
->dev
), __entry
->rwbs
,
340 (unsigned long long)__entry
->sector
,
341 __entry
->nr_sector
, __entry
->comm
)
344 TRACE_EVENT(block_sleeprq
,
346 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
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
)
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
);
367 TP_printk("%d,%d %s %llu + %u [%s]",
368 MAJOR(__entry
->dev
), MINOR(__entry
->dev
), __entry
->rwbs
,
369 (unsigned long long)__entry
->sector
,
370 __entry
->nr_sector
, __entry
->comm
)
373 TRACE_EVENT(block_plug
,
375 TP_PROTO(struct request_queue
*q
),
380 __array( char, comm
, TASK_COMM_LEN
)
384 memcpy(__entry
->comm
, current
->comm
, TASK_COMM_LEN
);
387 TP_printk("[%s]", __entry
->comm
)
390 TRACE_EVENT(block_unplug_timer
,
392 TP_PROTO(struct request_queue
*q
),
397 __field( int, nr_rq
)
398 __array( char, comm
, TASK_COMM_LEN
)
402 __entry
->nr_rq
= q
->rq
.count
[READ
] + q
->rq
.count
[WRITE
];
403 memcpy(__entry
->comm
, current
->comm
, TASK_COMM_LEN
);
406 TP_printk("[%s] %d", __entry
->comm
, __entry
->nr_rq
)
409 TRACE_EVENT(block_unplug_io
,
411 TP_PROTO(struct request_queue
*q
),
416 __field( int, nr_rq
)
417 __array( char, comm
, TASK_COMM_LEN
)
421 __entry
->nr_rq
= q
->rq
.count
[READ
] + q
->rq
.count
[WRITE
];
422 memcpy(__entry
->comm
, current
->comm
, TASK_COMM_LEN
);
425 TP_printk("[%s] %d", __entry
->comm
, __entry
->nr_rq
)
428 TRACE_EVENT(block_split
,
430 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
431 unsigned int new_sector
),
433 TP_ARGS(q
, bio
, new_sector
),
436 __field( dev_t
, dev
)
437 __field( sector_t
, sector
)
438 __field( sector_t
, new_sector
)
439 __array( char, rwbs
, 6 )
440 __array( char, comm
, TASK_COMM_LEN
)
444 __entry
->dev
= bio
->bi_bdev
->bd_dev
;
445 __entry
->sector
= bio
->bi_sector
;
446 __entry
->new_sector
= new_sector
;
447 blk_fill_rwbs(__entry
->rwbs
, bio
->bi_rw
, bio
->bi_size
);
448 memcpy(__entry
->comm
, current
->comm
, TASK_COMM_LEN
);
451 TP_printk("%d,%d %s %llu / %llu [%s]",
452 MAJOR(__entry
->dev
), MINOR(__entry
->dev
), __entry
->rwbs
,
453 (unsigned long long)__entry
->sector
,
454 (unsigned long long)__entry
->new_sector
,
458 TRACE_EVENT(block_remap
,
460 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
463 TP_ARGS(q
, bio
, dev
, from
),
466 __field( dev_t
, dev
)
467 __field( sector_t
, sector
)
468 __field( unsigned int, nr_sector
)
469 __field( dev_t
, old_dev
)
470 __field( sector_t
, old_sector
)
471 __array( char, rwbs
, 6 )
475 __entry
->dev
= bio
->bi_bdev
->bd_dev
;
476 __entry
->sector
= bio
->bi_sector
;
477 __entry
->nr_sector
= bio
->bi_size
>> 9;
478 __entry
->old_dev
= dev
;
479 __entry
->old_sector
= from
;
480 blk_fill_rwbs(__entry
->rwbs
, bio
->bi_rw
, bio
->bi_size
);
483 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
484 MAJOR(__entry
->dev
), MINOR(__entry
->dev
), __entry
->rwbs
,
485 (unsigned long long)__entry
->sector
,
487 MAJOR(__entry
->old_dev
), MINOR(__entry
->old_dev
),
488 (unsigned long long)__entry
->old_sector
)
491 TRACE_EVENT(block_rq_remap
,
493 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
496 TP_ARGS(q
, rq
, dev
, from
),
499 __field( dev_t
, dev
)
500 __field( sector_t
, sector
)
501 __field( unsigned int, nr_sector
)
502 __field( dev_t
, old_dev
)
503 __field( sector_t
, old_sector
)
504 __array( char, rwbs
, 6 )
508 __entry
->dev
= disk_devt(rq
->rq_disk
);
509 __entry
->sector
= blk_rq_pos(rq
);
510 __entry
->nr_sector
= blk_rq_sectors(rq
);
511 __entry
->old_dev
= dev
;
512 __entry
->old_sector
= from
;
513 blk_fill_rwbs_rq(__entry
->rwbs
, rq
);
516 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
517 MAJOR(__entry
->dev
), MINOR(__entry
->dev
), __entry
->rwbs
,
518 (unsigned long long)__entry
->sector
,
520 MAJOR(__entry
->old_dev
), MINOR(__entry
->old_dev
),
521 (unsigned long long)__entry
->old_sector
)
524 #endif /* _TRACE_BLOCK_H */
526 /* This part must be outside protection */
527 #include <trace/define_trace.h>