9d3de7d903a8167dc7694554c7eb109962ceb08c
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>
10 #include <linux/trace_seq.h>
11 #include <linux/version.h>
15 #ifndef _TRACE_BLOCK_DEF_
16 #define _TRACE_BLOCK_DEF_
18 #define __blk_dump_cmd(cmd, len) "<unknown>"
21 RWBS_FLAG_WRITE
= (1 << 0),
22 RWBS_FLAG_DISCARD
= (1 << 1),
23 RWBS_FLAG_READ
= (1 << 2),
24 RWBS_FLAG_RAHEAD
= (1 << 3),
25 RWBS_FLAG_BARRIER
= (1 << 4),
26 RWBS_FLAG_SYNC
= (1 << 5),
27 RWBS_FLAG_META
= (1 << 6),
28 RWBS_FLAG_SECURE
= (1 << 7),
29 RWBS_FLAG_FLUSH
= (1 << 8),
30 RWBS_FLAG_FUA
= (1 << 9),
33 #endif /* _TRACE_BLOCK_DEF_ */
35 #define __print_rwbs_flags(rwbs) \
36 __print_flags(rwbs, "", \
37 { RWBS_FLAG_FLUSH, "F" }, \
38 { RWBS_FLAG_WRITE, "W" }, \
39 { RWBS_FLAG_DISCARD, "D" }, \
40 { RWBS_FLAG_READ, "R" }, \
41 { RWBS_FLAG_FUA, "F" }, \
42 { RWBS_FLAG_RAHEAD, "A" }, \
43 { RWBS_FLAG_BARRIER, "B" }, \
44 { RWBS_FLAG_SYNC, "S" }, \
45 { RWBS_FLAG_META, "M" }, \
46 { RWBS_FLAG_SECURE, "E" })
48 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
50 #define blk_fill_rwbs(rwbs, rw, bytes) \
51 tp_assign(rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
52 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
53 ( (bytes) ? RWBS_FLAG_READ : \
55 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
56 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
57 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
58 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \
59 | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \
60 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
62 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
64 #define blk_fill_rwbs(rwbs, rw, bytes) \
65 tp_assign(rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
66 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
67 ( (bytes) ? RWBS_FLAG_READ : \
69 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
70 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
71 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
72 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
74 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
76 #define blk_fill_rwbs(rwbs, rw, bytes) \
77 tp_assign(rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
78 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
79 ( (bytes) ? RWBS_FLAG_READ : \
81 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
82 | ((rw) & REQ_HARDBARRIER ? RWBS_FLAG_BARRIER : 0) \
83 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
84 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
85 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
89 #define blk_fill_rwbs(rwbs, rw, bytes) \
90 tp_assign(rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
91 ( (rw) & (1 << BIO_RW_DISCARD) ? RWBS_FLAG_DISCARD : \
92 ( (bytes) ? RWBS_FLAG_READ : \
94 | ((rw) & (1 << BIO_RW_AHEAD) ? RWBS_FLAG_RAHEAD : 0) \
95 | ((rw) & (1 << BIO_RW_SYNCIO) ? RWBS_FLAG_SYNC : 0) \
96 | ((rw) & (1 << BIO_RW_META) ? RWBS_FLAG_META : 0) \
97 | ((rw) & (1 << BIO_RW_BARRIER) ? RWBS_FLAG_BARRIER : 0))
101 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
102 DECLARE_EVENT_CLASS(block_buffer
,
104 TP_PROTO(struct buffer_head
*bh
),
109 __field( dev_t
, dev
)
110 __field( sector_t
, sector
)
111 __field( size_t, size
)
115 tp_assign(dev
, bh
->b_bdev
->bd_dev
)
116 tp_assign(sector
, bh
->b_blocknr
)
117 tp_assign(size
, bh
->b_size
)
120 TP_printk("%d,%d sector=%llu size=%zu",
121 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
122 (unsigned long long)__entry
->sector
, __entry
->size
127 * block_touch_buffer - mark a buffer accessed
128 * @bh: buffer_head being touched
130 * Called from touch_buffer().
132 DEFINE_EVENT(block_buffer
, block_touch_buffer
,
134 TP_PROTO(struct buffer_head
*bh
),
140 * block_dirty_buffer - mark a buffer dirty
141 * @bh: buffer_head being dirtied
143 * Called from mark_buffer_dirty().
145 DEFINE_EVENT(block_buffer
, block_dirty_buffer
,
147 TP_PROTO(struct buffer_head
*bh
),
153 DECLARE_EVENT_CLASS(block_rq_with_error
,
155 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
160 __field( dev_t
, dev
)
161 __field( sector_t
, sector
)
162 __field( unsigned int, nr_sector
)
163 __field( int, errors
)
164 __field( unsigned int, rwbs
)
165 __dynamic_array_hex( unsigned char, cmd
,
166 (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
171 tp_assign(dev
, rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
172 tp_assign(sector
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
174 tp_assign(nr_sector
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
175 0 : blk_rq_sectors(rq
))
176 tp_assign(errors
, rq
->errors
)
177 blk_fill_rwbs(rwbs
, rq
->cmd_flags
, blk_rq_bytes(rq
))
178 tp_memcpy_dyn(cmd
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
182 TP_printk("%d,%d %s (%s) %llu + %u [%d]",
183 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
184 __print_rwbs_flags(__entry
->rwbs
),
185 __blk_dump_cmd(__get_dynamic_array(cmd
),
186 __get_dynamic_array_len(cmd
)),
187 (unsigned long long)__entry
->sector
,
188 __entry
->nr_sector
, __entry
->errors
)
192 * block_rq_abort - abort block operation request
193 * @q: queue containing the block operation request
194 * @rq: block IO operation request
196 * Called immediately after pending block IO operation request @rq in
197 * queue @q is aborted. The fields in the operation request @rq
198 * can be examined to determine which device and sectors the pending
199 * operation would access.
201 DEFINE_EVENT(block_rq_with_error
, block_rq_abort
,
203 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
209 * block_rq_requeue - place block IO request back on a queue
210 * @q: queue holding operation
211 * @rq: block IO operation request
213 * The block operation request @rq is being placed back into queue
214 * @q. For some reason the request was not completed and needs to be
215 * put back in the queue.
217 DEFINE_EVENT(block_rq_with_error
, block_rq_requeue
,
219 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
224 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,5) \
225 || LTTNG_KERNEL_RANGE(3,12,21, 3,13,0) \
226 || LTTNG_KERNEL_RANGE(3,10,41, 3,11,0) \
227 || LTTNG_KERNEL_RANGE(3,4,91, 3,5,1) \
228 || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0))
231 * block_rq_complete - block IO operation completed by device driver
232 * @q: queue containing the block operation request
233 * @rq: block operations request
234 * @nr_bytes: number of completed bytes
236 * The block_rq_complete tracepoint event indicates that some portion
237 * of operation request has been completed by the device driver. If
238 * the @rq->bio is %NULL, then there is absolutely no additional work to
239 * do for the request. If @rq->bio is non-NULL then there is
240 * additional work required to complete the request.
242 TRACE_EVENT(block_rq_complete
,
244 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
245 unsigned int nr_bytes
),
247 TP_ARGS(q
, rq
, nr_bytes
),
250 __field( dev_t
, dev
)
251 __field( sector_t
, sector
)
252 __field( unsigned int, nr_sector
)
253 __field( int, errors
)
254 __field( unsigned int, rwbs
)
255 __dynamic_array_hex( unsigned char, cmd
,
256 (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
261 tp_assign(dev
, rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
262 tp_assign(sector
, blk_rq_pos(rq
))
263 tp_assign(nr_sector
, nr_bytes
>> 9)
264 tp_assign(errors
, rq
->errors
)
265 blk_fill_rwbs(rwbs
, rq
->cmd_flags
, nr_bytes
)
266 tp_memcpy_dyn(cmd
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
270 TP_printk("%d,%d %s (%s) %llu + %u [%d]",
271 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
272 __entry
->rwbs
, __get_str(cmd
),
273 (unsigned long long)__entry
->sector
,
274 __entry
->nr_sector
, __entry
->errors
)
277 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
280 * block_rq_complete - block IO operation completed by device driver
281 * @q: queue containing the block operation request
282 * @rq: block operations request
284 * The block_rq_complete tracepoint event indicates that some portion
285 * of operation request has been completed by the device driver. If
286 * the @rq->bio is %NULL, then there is absolutely no additional work to
287 * do for the request. If @rq->bio is non-NULL then there is
288 * additional work required to complete the request.
290 DEFINE_EVENT(block_rq_with_error
, block_rq_complete
,
292 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
297 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
299 DECLARE_EVENT_CLASS(block_rq
,
301 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
306 __field( dev_t
, dev
)
307 __field( sector_t
, sector
)
308 __field( unsigned int, nr_sector
)
309 __field( unsigned int, bytes
)
310 __field( unsigned int, rwbs
)
311 __array_text( char, comm
, TASK_COMM_LEN
)
312 __dynamic_array_hex( unsigned char, cmd
,
313 (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
318 tp_assign(dev
, rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
319 tp_assign(sector
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
321 tp_assign(nr_sector
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
322 0 : blk_rq_sectors(rq
))
323 tp_assign(bytes
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
324 blk_rq_bytes(rq
) : 0)
325 blk_fill_rwbs(rwbs
, rq
->cmd_flags
, blk_rq_bytes(rq
))
326 tp_memcpy_dyn(cmd
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
328 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
331 TP_printk("%d,%d %s %u (%s) %llu + %u [%s]",
332 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
333 __print_rwbs_flags(__entry
->rwbs
),
335 __blk_dump_cmd(__get_dynamic_array(cmd
),
336 __get_dynamic_array_len(cmd
)),
337 (unsigned long long)__entry
->sector
,
338 __entry
->nr_sector
, __entry
->comm
)
342 * block_rq_insert - insert block operation request into queue
344 * @rq: block IO operation request
346 * Called immediately before block operation request @rq is inserted
347 * into queue @q. The fields in the operation request @rq struct can
348 * be examined to determine which device and sectors the pending
349 * operation would access.
351 DEFINE_EVENT(block_rq
, block_rq_insert
,
353 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
359 * block_rq_issue - issue pending block IO request operation to device driver
360 * @q: queue holding operation
361 * @rq: block IO operation operation request
363 * Called when block operation request @rq from queue @q is sent to a
364 * device driver for processing.
366 DEFINE_EVENT(block_rq
, block_rq_issue
,
368 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
374 * block_bio_bounce - used bounce buffer when processing block operation
375 * @q: queue holding the block operation
376 * @bio: block operation
378 * A bounce buffer was used to handle the block operation @bio in @q.
379 * This occurs when hardware limitations prevent a direct transfer of
380 * data between the @bio data memory area and the IO device. Use of a
381 * bounce buffer requires extra copying of data and decreases
384 TRACE_EVENT(block_bio_bounce
,
386 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
391 __field( dev_t
, dev
)
392 __field( sector_t
, sector
)
393 __field( unsigned int, nr_sector
)
394 __field( unsigned int, rwbs
)
395 __array_text( char, comm
, TASK_COMM_LEN
)
399 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
400 tp_assign(dev
, bio
->bi_bdev
?
401 bio
->bi_bdev
->bd_dev
: 0)
402 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
403 tp_assign(nr_sector
, bio_sectors(bio
))
404 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
405 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
406 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
407 tp_assign(dev
, bio
->bi_bdev
?
408 bio
->bi_bdev
->bd_dev
: 0)
409 tp_assign(sector
, bio
->bi_sector
)
410 tp_assign(nr_sector
, bio
->bi_size
>> 9)
411 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
412 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
413 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
416 TP_printk("%d,%d %s %llu + %u [%s]",
417 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
418 __print_rwbs_flags(__entry
->rwbs
),
419 (unsigned long long)__entry
->sector
,
420 __entry
->nr_sector
, __entry
->comm
)
424 * block_bio_complete - completed all work on the block operation
425 * @q: queue holding the block operation
426 * @bio: block operation completed
427 * @error: io error value
429 * This tracepoint indicates there is no further work to do on this
430 * block IO operation @bio.
432 TRACE_EVENT(block_bio_complete
,
434 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
435 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
437 TP_ARGS(q
, bio
, error
),
439 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
445 __field( dev_t
, dev
)
446 __field( sector_t
, sector
)
447 __field( unsigned, nr_sector
)
448 __field( int, error
)
449 __field( unsigned int, rwbs
)
453 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
454 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
455 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
456 tp_assign(nr_sector
, bio_sectors(bio
))
457 tp_assign(error
, error
)
458 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
459 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
460 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
461 tp_assign(sector
, bio
->bi_sector
)
462 tp_assign(nr_sector
, bio
->bi_size
>> 9)
463 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
464 tp_assign(error
, error
)
468 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
469 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
472 TP_printk("%d,%d %s %llu + %u [%d]",
473 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
474 __print_rwbs_flags(__entry
->rwbs
),
475 (unsigned long long)__entry
->sector
,
476 __entry
->nr_sector
, __entry
->error
)
479 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
480 DECLARE_EVENT_CLASS(block_bio_merge
,
482 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
487 __field( dev_t
, dev
)
488 __field( sector_t
, sector
)
489 __field( unsigned int, nr_sector
)
490 __field( unsigned int, rwbs
)
491 __array_text( char, comm
, TASK_COMM_LEN
)
495 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
496 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
497 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
498 tp_assign(nr_sector
, bio_sectors(bio
))
499 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
500 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
501 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
502 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
503 tp_assign(sector
, bio
->bi_sector
)
504 tp_assign(nr_sector
, bio
->bi_size
>> 9)
505 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
506 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
507 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
510 TP_printk("%d,%d %s %llu + %u [%s]",
511 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
512 __print_rwbs_flags(__entry
->rwbs
),
513 (unsigned long long)__entry
->sector
,
514 __entry
->nr_sector
, __entry
->comm
)
518 * block_bio_backmerge - merging block operation to the end of an existing operation
519 * @q: queue holding operation
520 * @bio: new block operation to merge
522 * Merging block request @bio to the end of an existing block request
525 DEFINE_EVENT(block_bio_merge
, block_bio_backmerge
,
527 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
533 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
534 * @q: queue holding operation
535 * @bio: new block operation to merge
537 * Merging block IO operation @bio to the beginning of an existing block
538 * operation in queue @q.
540 DEFINE_EVENT(block_bio_merge
, block_bio_frontmerge
,
542 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
548 * block_bio_queue - putting new block IO operation in queue
549 * @q: queue holding operation
550 * @bio: new block operation
552 * About to place the block IO operation @bio into queue @q.
554 TRACE_EVENT(block_bio_queue
,
556 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
561 __field( dev_t
, dev
)
562 __field( sector_t
, sector
)
563 __field( unsigned int, nr_sector
)
564 __field( unsigned int, rwbs
)
565 __array_text( char, comm
, TASK_COMM_LEN
)
569 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
570 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
571 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
572 tp_assign(nr_sector
, bio_sectors(bio
))
573 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
574 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
575 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
576 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
577 tp_assign(sector
, bio
->bi_sector
)
578 tp_assign(nr_sector
, bio
->bi_size
>> 9)
579 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
580 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
581 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
584 TP_printk("%d,%d %s %llu + %u [%s]",
585 MAJOR(__entry
->dev
), MINOR(__entry
->dev
), __entry
->rwbs
,
586 (unsigned long long)__entry
->sector
,
587 __entry
->nr_sector
, __entry
->comm
)
590 DECLARE_EVENT_CLASS(block_bio
,
592 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
597 __field( dev_t
, dev
)
598 __field( sector_t
, sector
)
599 __field( unsigned int, nr_sector
)
600 __field( unsigned int, rwbs
)
601 __array_text( char, comm
, TASK_COMM_LEN
)
605 tp_assign(dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
606 tp_assign(sector
, bio
->bi_sector
)
607 tp_assign(nr_sector
, bio
->bi_size
>> 9)
608 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
609 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
612 TP_printk("%d,%d %s %llu + %u [%s]",
613 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
614 __print_rwbs_flags(__entry
->rwbs
),
615 (unsigned long long)__entry
->sector
,
616 __entry
->nr_sector
, __entry
->comm
)
620 * block_bio_backmerge - merging block operation to the end of an existing operation
621 * @q: queue holding operation
622 * @bio: new block operation to merge
624 * Merging block request @bio to the end of an existing block request
627 DEFINE_EVENT(block_bio
, block_bio_backmerge
,
629 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
635 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
636 * @q: queue holding operation
637 * @bio: new block operation to merge
639 * Merging block IO operation @bio to the beginning of an existing block
640 * operation in queue @q.
642 DEFINE_EVENT(block_bio
, block_bio_frontmerge
,
644 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
650 * block_bio_queue - putting new block IO operation in queue
651 * @q: queue holding operation
652 * @bio: new block operation
654 * About to place the block IO operation @bio into queue @q.
656 DEFINE_EVENT(block_bio
, block_bio_queue
,
658 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
664 DECLARE_EVENT_CLASS(block_get_rq
,
666 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
671 __field( dev_t
, dev
)
672 __field( sector_t
, sector
)
673 __field( unsigned int, nr_sector
)
674 __field( unsigned int, rwbs
)
675 __array_text( char, comm
, TASK_COMM_LEN
)
679 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
680 tp_assign(dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
681 tp_assign(sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
682 tp_assign(nr_sector
, bio
? bio_sectors(bio
) : 0)
683 blk_fill_rwbs(rwbs
, bio
? bio
->bi_rw
: 0,
684 bio
? bio_sectors(bio
) : 0)
685 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
686 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
687 tp_assign(dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
688 tp_assign(sector
, bio
? bio
->bi_sector
: 0)
689 tp_assign(nr_sector
, bio
? bio
->bi_size
>> 9 : 0)
690 blk_fill_rwbs(rwbs
, bio
? bio
->bi_rw
: 0,
691 bio
? bio
->bi_size
>> 9 : 0)
692 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
693 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
696 TP_printk("%d,%d %s %llu + %u [%s]",
697 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
698 __print_rwbs_flags(__entry
->rwbs
),
699 (unsigned long long)__entry
->sector
,
700 __entry
->nr_sector
, __entry
->comm
)
704 * block_getrq - get a free request entry in queue for block IO operations
705 * @q: queue for operations
706 * @bio: pending block IO operation
707 * @rw: low bit indicates a read (%0) or a write (%1)
709 * A request struct for queue @q has been allocated to handle the
710 * block IO operation @bio.
712 DEFINE_EVENT(block_get_rq
, block_getrq
,
714 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
720 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
721 * @q: queue for operation
722 * @bio: pending block IO operation
723 * @rw: low bit indicates a read (%0) or a write (%1)
725 * In the case where a request struct cannot be provided for queue @q
726 * the process needs to wait for an request struct to become
727 * available. This tracepoint event is generated each time the
728 * process goes to sleep waiting for request struct become available.
730 DEFINE_EVENT(block_get_rq
, block_sleeprq
,
732 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
738 * block_plug - keep operations requests in request queue
739 * @q: request queue to plug
741 * Plug the request queue @q. Do not allow block operation requests
742 * to be sent to the device driver. Instead, accumulate requests in
743 * the queue to improve throughput performance of the block device.
745 TRACE_EVENT(block_plug
,
747 TP_PROTO(struct request_queue
*q
),
752 __array_text( char, comm
, TASK_COMM_LEN
)
756 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
759 TP_printk("[%s]", __entry
->comm
)
762 DECLARE_EVENT_CLASS(block_unplug
,
764 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
765 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
767 TP_ARGS(q
, depth
, explicit),
769 TP_PROTO(struct request_queue
*q
),
775 __field( int, nr_rq
)
776 __array_text( char, comm
, TASK_COMM_LEN
)
780 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
781 tp_assign(nr_rq
, depth
)
783 tp_assign(nr_rq
, q
->rq
.count
[READ
] + q
->rq
.count
[WRITE
])
785 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
788 TP_printk("[%s] %d", __entry
->comm
, __entry
->nr_rq
)
791 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
793 * block_unplug_timer - timed release of operations requests in queue to device driver
794 * @q: request queue to unplug
796 * Unplug the request queue @q because a timer expired and allow block
797 * operation requests to be sent to the device driver.
799 DEFINE_EVENT(block_unplug
, block_unplug_timer
,
801 TP_PROTO(struct request_queue
*q
),
808 * block_unplug - release of operations requests in request queue
809 * @q: request queue to unplug
810 * @depth: number of requests just added to the queue
811 * @explicit: whether this was an explicit unplug, or one from schedule()
813 * Unplug request queue @q because device driver is scheduled to work
814 * on elements in the request queue.
816 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
817 DEFINE_EVENT(block_unplug
, block_unplug
,
819 DEFINE_EVENT(block_unplug
, block_unplug_io
,
822 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
823 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
825 TP_ARGS(q
, depth
, explicit)
827 TP_PROTO(struct request_queue
*q
),
834 * block_split - split a single bio struct into two bio structs
835 * @q: queue containing the bio
836 * @bio: block operation being split
837 * @new_sector: The starting sector for the new bio
839 * The bio request @bio in request queue @q needs to be split into two
840 * bio requests. The newly created @bio request starts at
841 * @new_sector. This split may be required due to hardware limitation
842 * such as operation crossing device boundaries in a RAID system.
844 TRACE_EVENT(block_split
,
846 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
847 unsigned int new_sector
),
849 TP_ARGS(q
, bio
, new_sector
),
852 __field( dev_t
, dev
)
853 __field( sector_t
, sector
)
854 __field( sector_t
, new_sector
)
855 __field( unsigned int, rwbs
)
856 __array_text( char, comm
, TASK_COMM_LEN
)
860 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
861 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
862 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
863 tp_assign(new_sector
, new_sector
)
864 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
865 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
866 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
867 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
868 tp_assign(sector
, bio
->bi_sector
)
869 tp_assign(new_sector
, new_sector
)
870 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
871 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
872 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
875 TP_printk("%d,%d %s %llu / %llu [%s]",
876 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
877 __print_rwbs_flags(__entry
->rwbs
),
878 (unsigned long long)__entry
->sector
,
879 (unsigned long long)__entry
->new_sector
,
884 * block_bio_remap - map request for a logical device to the raw device
885 * @q: queue holding the operation
886 * @bio: revised operation
887 * @dev: device for the operation
888 * @from: original sector for the operation
890 * An operation for a logical device has been mapped to the
893 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
894 TRACE_EVENT(block_bio_remap
,
896 TRACE_EVENT(block_remap
,
899 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
902 TP_ARGS(q
, bio
, dev
, from
),
905 __field( dev_t
, dev
)
906 __field( sector_t
, sector
)
907 __field( unsigned int, nr_sector
)
908 __field( dev_t
, old_dev
)
909 __field( sector_t
, old_sector
)
910 __field( unsigned int, rwbs
)
914 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
915 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
916 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
917 tp_assign(nr_sector
, bio_sectors(bio
))
918 tp_assign(old_dev
, dev
)
919 tp_assign(old_sector
, from
)
920 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
921 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
922 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
923 tp_assign(sector
, bio
->bi_sector
)
924 tp_assign(nr_sector
, bio
->bi_size
>> 9)
925 tp_assign(old_dev
, dev
)
926 tp_assign(old_sector
, from
)
927 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
928 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
931 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
932 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
933 __print_rwbs_flags(__entry
->rwbs
),
934 (unsigned long long)__entry
->sector
,
936 MAJOR(__entry
->old_dev
), MINOR(__entry
->old_dev
),
937 (unsigned long long)__entry
->old_sector
)
940 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
942 * block_rq_remap - map request for a block operation request
943 * @q: queue holding the operation
944 * @rq: block IO operation request
945 * @dev: device for the operation
946 * @from: original sector for the operation
948 * The block operation request @rq in @q has been remapped. The block
949 * operation request @rq holds the current information and @from hold
950 * the original sector.
952 TRACE_EVENT(block_rq_remap
,
954 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
957 TP_ARGS(q
, rq
, dev
, from
),
960 __field( dev_t
, dev
)
961 __field( sector_t
, sector
)
962 __field( unsigned int, nr_sector
)
963 __field( dev_t
, old_dev
)
964 __field( sector_t
, old_sector
)
965 __field( unsigned int, rwbs
)
969 tp_assign(dev
, disk_devt(rq
->rq_disk
))
970 tp_assign(sector
, blk_rq_pos(rq
))
971 tp_assign(nr_sector
, blk_rq_sectors(rq
))
972 tp_assign(old_dev
, dev
)
973 tp_assign(old_sector
, from
)
974 blk_fill_rwbs(rwbs
, rq
->cmd_flags
, blk_rq_bytes(rq
))
977 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
978 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
979 __print_rwbs_flags(__entry
->rwbs
),
980 (unsigned long long)__entry
->sector
,
982 MAJOR(__entry
->old_dev
), MINOR(__entry
->old_dev
),
983 (unsigned long long)__entry
->old_sector
)
987 #undef __print_rwbs_flags
990 #endif /* _TRACE_BLOCK_H */
992 /* This part must be outside protection */
993 #include "../../../probes/define_trace.h"
This page took 0.047967 seconds and 3 git commands to generate.