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
)
174 TRACE_EVENT(block_bio_bounce
,
176 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
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
)
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
);
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
)
202 TRACE_EVENT(block_bio_complete
,
204 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
209 __field( dev_t
, dev
)
210 __field( sector_t
, sector
)
211 __field( unsigned, nr_sector
)
212 __field( int, error
)
213 __array( char, rwbs
, 6 )
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
);
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
)
229 TRACE_EVENT(block_bio_backmerge
,
231 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
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
)
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
);
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
)
257 TRACE_EVENT(block_bio_frontmerge
,
259 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
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
)
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
);
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
)
285 TRACE_EVENT(block_bio_queue
,
287 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
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
)
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
);
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
)
313 TRACE_EVENT(block_getrq
,
315 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
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
)
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
);
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
)
342 TRACE_EVENT(block_sleeprq
,
344 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
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
)
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
);
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
)
371 TRACE_EVENT(block_plug
,
373 TP_PROTO(struct request_queue
*q
),
378 __array( char, comm
, TASK_COMM_LEN
)
382 memcpy(__entry
->comm
, current
->comm
, TASK_COMM_LEN
);
385 TP_printk("[%s]", __entry
->comm
)
388 TRACE_EVENT(block_unplug_timer
,
390 TP_PROTO(struct request_queue
*q
),
395 __field( int, nr_rq
)
396 __array( char, comm
, TASK_COMM_LEN
)
400 __entry
->nr_rq
= q
->rq
.count
[READ
] + q
->rq
.count
[WRITE
];
401 memcpy(__entry
->comm
, current
->comm
, TASK_COMM_LEN
);
404 TP_printk("[%s] %d", __entry
->comm
, __entry
->nr_rq
)
407 TRACE_EVENT(block_unplug_io
,
409 TP_PROTO(struct request_queue
*q
),
414 __field( int, nr_rq
)
415 __array( char, comm
, TASK_COMM_LEN
)
419 __entry
->nr_rq
= q
->rq
.count
[READ
] + q
->rq
.count
[WRITE
];
420 memcpy(__entry
->comm
, current
->comm
, TASK_COMM_LEN
);
423 TP_printk("[%s] %d", __entry
->comm
, __entry
->nr_rq
)
426 TRACE_EVENT(block_split
,
428 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
429 unsigned int new_sector
),
431 TP_ARGS(q
, bio
, new_sector
),
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
)
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
);
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
,
456 TRACE_EVENT(block_remap
,
458 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
461 TP_ARGS(q
, bio
, dev
, from
),
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 )
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
);
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
,
485 MAJOR(__entry
->old_dev
), MINOR(__entry
->old_dev
),
486 (unsigned long long)__entry
->old_sector
)
489 #endif /* _TRACE_BLOCK_H */
491 /* This part must be outside protection */
492 #include <trace/define_trace.h>