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,15,0) \
225 || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0))
228 * block_rq_complete - block IO operation completed by device driver
229 * @q: queue containing the block operation request
230 * @rq: block operations request
231 * @nr_bytes: number of completed bytes
233 * The block_rq_complete tracepoint event indicates that some portion
234 * of operation request has been completed by the device driver. If
235 * the @rq->bio is %NULL, then there is absolutely no additional work to
236 * do for the request. If @rq->bio is non-NULL then there is
237 * additional work required to complete the request.
239 TRACE_EVENT(block_rq_complete
,
241 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
242 unsigned int nr_bytes
),
244 TP_ARGS(q
, rq
, nr_bytes
),
247 __field( dev_t
, dev
)
248 __field( sector_t
, sector
)
249 __field( unsigned int, nr_sector
)
250 __field( int, errors
)
251 __field( unsigned int, rwbs
)
252 __dynamic_array_hex( unsigned char, cmd
,
253 (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
258 tp_assign(dev
, rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
259 tp_assign(sector
, blk_rq_pos(rq
))
260 tp_assign(nr_sector
, nr_bytes
>> 9)
261 tp_assign(errors
, rq
->errors
)
262 blk_fill_rwbs(rwbs
, rq
->cmd_flags
, nr_bytes
)
263 tp_memcpy_dyn(cmd
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
267 TP_printk("%d,%d %s (%s) %llu + %u [%d]",
268 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
269 __entry
->rwbs
, __get_str(cmd
),
270 (unsigned long long)__entry
->sector
,
271 __entry
->nr_sector
, __entry
->errors
)
274 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
277 * block_rq_complete - block IO operation completed by device driver
278 * @q: queue containing the block operation request
279 * @rq: block operations request
281 * The block_rq_complete tracepoint event indicates that some portion
282 * of operation request has been completed by the device driver. If
283 * the @rq->bio is %NULL, then there is absolutely no additional work to
284 * do for the request. If @rq->bio is non-NULL then there is
285 * additional work required to complete the request.
287 DEFINE_EVENT(block_rq_with_error
, block_rq_complete
,
289 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
294 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
296 DECLARE_EVENT_CLASS(block_rq
,
298 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
303 __field( dev_t
, dev
)
304 __field( sector_t
, sector
)
305 __field( unsigned int, nr_sector
)
306 __field( unsigned int, bytes
)
307 __field( unsigned int, rwbs
)
308 __array_text( char, comm
, TASK_COMM_LEN
)
309 __dynamic_array_hex( unsigned char, cmd
,
310 (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
315 tp_assign(dev
, rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
316 tp_assign(sector
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
318 tp_assign(nr_sector
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
319 0 : blk_rq_sectors(rq
))
320 tp_assign(bytes
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
321 blk_rq_bytes(rq
) : 0)
322 blk_fill_rwbs(rwbs
, rq
->cmd_flags
, blk_rq_bytes(rq
))
323 tp_memcpy_dyn(cmd
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
325 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
328 TP_printk("%d,%d %s %u (%s) %llu + %u [%s]",
329 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
330 __print_rwbs_flags(__entry
->rwbs
),
332 __blk_dump_cmd(__get_dynamic_array(cmd
),
333 __get_dynamic_array_len(cmd
)),
334 (unsigned long long)__entry
->sector
,
335 __entry
->nr_sector
, __entry
->comm
)
339 * block_rq_insert - insert block operation request into queue
341 * @rq: block IO operation request
343 * Called immediately before block operation request @rq is inserted
344 * into queue @q. The fields in the operation request @rq struct can
345 * be examined to determine which device and sectors the pending
346 * operation would access.
348 DEFINE_EVENT(block_rq
, block_rq_insert
,
350 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
356 * block_rq_issue - issue pending block IO request operation to device driver
357 * @q: queue holding operation
358 * @rq: block IO operation operation request
360 * Called when block operation request @rq from queue @q is sent to a
361 * device driver for processing.
363 DEFINE_EVENT(block_rq
, block_rq_issue
,
365 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
371 * block_bio_bounce - used bounce buffer when processing block operation
372 * @q: queue holding the block operation
373 * @bio: block operation
375 * A bounce buffer was used to handle the block operation @bio in @q.
376 * This occurs when hardware limitations prevent a direct transfer of
377 * data between the @bio data memory area and the IO device. Use of a
378 * bounce buffer requires extra copying of data and decreases
381 TRACE_EVENT(block_bio_bounce
,
383 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
388 __field( dev_t
, dev
)
389 __field( sector_t
, sector
)
390 __field( unsigned int, nr_sector
)
391 __field( unsigned int, rwbs
)
392 __array_text( char, comm
, TASK_COMM_LEN
)
396 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
397 tp_assign(dev
, bio
->bi_bdev
?
398 bio
->bi_bdev
->bd_dev
: 0)
399 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
400 tp_assign(nr_sector
, bio_sectors(bio
))
401 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
402 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
403 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
404 tp_assign(dev
, bio
->bi_bdev
?
405 bio
->bi_bdev
->bd_dev
: 0)
406 tp_assign(sector
, bio
->bi_sector
)
407 tp_assign(nr_sector
, bio
->bi_size
>> 9)
408 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
409 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
410 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
413 TP_printk("%d,%d %s %llu + %u [%s]",
414 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
415 __print_rwbs_flags(__entry
->rwbs
),
416 (unsigned long long)__entry
->sector
,
417 __entry
->nr_sector
, __entry
->comm
)
421 * block_bio_complete - completed all work on the block operation
422 * @q: queue holding the block operation
423 * @bio: block operation completed
424 * @error: io error value
426 * This tracepoint indicates there is no further work to do on this
427 * block IO operation @bio.
429 TRACE_EVENT(block_bio_complete
,
431 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
432 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
434 TP_ARGS(q
, bio
, error
),
436 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
442 __field( dev_t
, dev
)
443 __field( sector_t
, sector
)
444 __field( unsigned, nr_sector
)
445 __field( int, error
)
446 __field( unsigned int, rwbs
)
450 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
451 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
452 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
453 tp_assign(nr_sector
, bio_sectors(bio
))
454 tp_assign(error
, error
)
455 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
456 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
457 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
458 tp_assign(sector
, bio
->bi_sector
)
459 tp_assign(nr_sector
, bio
->bi_size
>> 9)
460 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
461 tp_assign(error
, error
)
465 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
466 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
469 TP_printk("%d,%d %s %llu + %u [%d]",
470 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
471 __print_rwbs_flags(__entry
->rwbs
),
472 (unsigned long long)__entry
->sector
,
473 __entry
->nr_sector
, __entry
->error
)
476 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
477 DECLARE_EVENT_CLASS(block_bio_merge
,
479 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
484 __field( dev_t
, dev
)
485 __field( sector_t
, sector
)
486 __field( unsigned int, nr_sector
)
487 __field( unsigned int, rwbs
)
488 __array_text( char, comm
, TASK_COMM_LEN
)
492 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
493 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
494 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
495 tp_assign(nr_sector
, bio_sectors(bio
))
496 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
497 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
498 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
499 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
500 tp_assign(sector
, bio
->bi_sector
)
501 tp_assign(nr_sector
, bio
->bi_size
>> 9)
502 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
503 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
504 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
507 TP_printk("%d,%d %s %llu + %u [%s]",
508 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
509 __print_rwbs_flags(__entry
->rwbs
),
510 (unsigned long long)__entry
->sector
,
511 __entry
->nr_sector
, __entry
->comm
)
515 * block_bio_backmerge - merging block operation to the end of an existing operation
516 * @q: queue holding operation
517 * @bio: new block operation to merge
519 * Merging block request @bio to the end of an existing block request
522 DEFINE_EVENT(block_bio_merge
, block_bio_backmerge
,
524 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
530 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
531 * @q: queue holding operation
532 * @bio: new block operation to merge
534 * Merging block IO operation @bio to the beginning of an existing block
535 * operation in queue @q.
537 DEFINE_EVENT(block_bio_merge
, block_bio_frontmerge
,
539 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
545 * block_bio_queue - putting new block IO operation in queue
546 * @q: queue holding operation
547 * @bio: new block operation
549 * About to place the block IO operation @bio into queue @q.
551 TRACE_EVENT(block_bio_queue
,
553 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
558 __field( dev_t
, dev
)
559 __field( sector_t
, sector
)
560 __field( unsigned int, nr_sector
)
561 __field( unsigned int, rwbs
)
562 __array_text( char, comm
, TASK_COMM_LEN
)
566 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
567 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
568 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
569 tp_assign(nr_sector
, bio_sectors(bio
))
570 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
571 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
572 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
573 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
574 tp_assign(sector
, bio
->bi_sector
)
575 tp_assign(nr_sector
, bio
->bi_size
>> 9)
576 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
577 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
578 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
581 TP_printk("%d,%d %s %llu + %u [%s]",
582 MAJOR(__entry
->dev
), MINOR(__entry
->dev
), __entry
->rwbs
,
583 (unsigned long long)__entry
->sector
,
584 __entry
->nr_sector
, __entry
->comm
)
587 DECLARE_EVENT_CLASS(block_bio
,
589 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
594 __field( dev_t
, dev
)
595 __field( sector_t
, sector
)
596 __field( unsigned int, nr_sector
)
597 __field( unsigned int, rwbs
)
598 __array_text( char, comm
, TASK_COMM_LEN
)
602 tp_assign(dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
603 tp_assign(sector
, bio
->bi_sector
)
604 tp_assign(nr_sector
, bio
->bi_size
>> 9)
605 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
606 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
609 TP_printk("%d,%d %s %llu + %u [%s]",
610 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
611 __print_rwbs_flags(__entry
->rwbs
),
612 (unsigned long long)__entry
->sector
,
613 __entry
->nr_sector
, __entry
->comm
)
617 * block_bio_backmerge - merging block operation to the end of an existing operation
618 * @q: queue holding operation
619 * @bio: new block operation to merge
621 * Merging block request @bio to the end of an existing block request
624 DEFINE_EVENT(block_bio
, block_bio_backmerge
,
626 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
632 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
633 * @q: queue holding operation
634 * @bio: new block operation to merge
636 * Merging block IO operation @bio to the beginning of an existing block
637 * operation in queue @q.
639 DEFINE_EVENT(block_bio
, block_bio_frontmerge
,
641 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
647 * block_bio_queue - putting new block IO operation in queue
648 * @q: queue holding operation
649 * @bio: new block operation
651 * About to place the block IO operation @bio into queue @q.
653 DEFINE_EVENT(block_bio
, block_bio_queue
,
655 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
661 DECLARE_EVENT_CLASS(block_get_rq
,
663 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
668 __field( dev_t
, dev
)
669 __field( sector_t
, sector
)
670 __field( unsigned int, nr_sector
)
671 __field( unsigned int, rwbs
)
672 __array_text( char, comm
, TASK_COMM_LEN
)
676 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
677 tp_assign(dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
678 tp_assign(sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
679 tp_assign(nr_sector
, bio
? bio_sectors(bio
) : 0)
680 blk_fill_rwbs(rwbs
, bio
? bio
->bi_rw
: 0,
681 bio
? bio_sectors(bio
) : 0)
682 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
683 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
684 tp_assign(dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
685 tp_assign(sector
, bio
? bio
->bi_sector
: 0)
686 tp_assign(nr_sector
, bio
? bio
->bi_size
>> 9 : 0)
687 blk_fill_rwbs(rwbs
, bio
? bio
->bi_rw
: 0,
688 bio
? bio
->bi_size
>> 9 : 0)
689 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
690 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
693 TP_printk("%d,%d %s %llu + %u [%s]",
694 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
695 __print_rwbs_flags(__entry
->rwbs
),
696 (unsigned long long)__entry
->sector
,
697 __entry
->nr_sector
, __entry
->comm
)
701 * block_getrq - get a free request entry in queue for block IO operations
702 * @q: queue for operations
703 * @bio: pending block IO operation
704 * @rw: low bit indicates a read (%0) or a write (%1)
706 * A request struct for queue @q has been allocated to handle the
707 * block IO operation @bio.
709 DEFINE_EVENT(block_get_rq
, block_getrq
,
711 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
717 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
718 * @q: queue for operation
719 * @bio: pending block IO operation
720 * @rw: low bit indicates a read (%0) or a write (%1)
722 * In the case where a request struct cannot be provided for queue @q
723 * the process needs to wait for an request struct to become
724 * available. This tracepoint event is generated each time the
725 * process goes to sleep waiting for request struct become available.
727 DEFINE_EVENT(block_get_rq
, block_sleeprq
,
729 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
735 * block_plug - keep operations requests in request queue
736 * @q: request queue to plug
738 * Plug the request queue @q. Do not allow block operation requests
739 * to be sent to the device driver. Instead, accumulate requests in
740 * the queue to improve throughput performance of the block device.
742 TRACE_EVENT(block_plug
,
744 TP_PROTO(struct request_queue
*q
),
749 __array_text( char, comm
, TASK_COMM_LEN
)
753 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
756 TP_printk("[%s]", __entry
->comm
)
759 DECLARE_EVENT_CLASS(block_unplug
,
761 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
762 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
764 TP_ARGS(q
, depth
, explicit),
766 TP_PROTO(struct request_queue
*q
),
772 __field( int, nr_rq
)
773 __array_text( char, comm
, TASK_COMM_LEN
)
777 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
778 tp_assign(nr_rq
, depth
)
780 tp_assign(nr_rq
, q
->rq
.count
[READ
] + q
->rq
.count
[WRITE
])
782 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
785 TP_printk("[%s] %d", __entry
->comm
, __entry
->nr_rq
)
788 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
790 * block_unplug_timer - timed release of operations requests in queue to device driver
791 * @q: request queue to unplug
793 * Unplug the request queue @q because a timer expired and allow block
794 * operation requests to be sent to the device driver.
796 DEFINE_EVENT(block_unplug
, block_unplug_timer
,
798 TP_PROTO(struct request_queue
*q
),
805 * block_unplug - release of operations requests in request queue
806 * @q: request queue to unplug
807 * @depth: number of requests just added to the queue
808 * @explicit: whether this was an explicit unplug, or one from schedule()
810 * Unplug request queue @q because device driver is scheduled to work
811 * on elements in the request queue.
813 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
814 DEFINE_EVENT(block_unplug
, block_unplug
,
816 DEFINE_EVENT(block_unplug
, block_unplug_io
,
819 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
820 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
822 TP_ARGS(q
, depth
, explicit)
824 TP_PROTO(struct request_queue
*q
),
831 * block_split - split a single bio struct into two bio structs
832 * @q: queue containing the bio
833 * @bio: block operation being split
834 * @new_sector: The starting sector for the new bio
836 * The bio request @bio in request queue @q needs to be split into two
837 * bio requests. The newly created @bio request starts at
838 * @new_sector. This split may be required due to hardware limitation
839 * such as operation crossing device boundaries in a RAID system.
841 TRACE_EVENT(block_split
,
843 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
844 unsigned int new_sector
),
846 TP_ARGS(q
, bio
, new_sector
),
849 __field( dev_t
, dev
)
850 __field( sector_t
, sector
)
851 __field( sector_t
, new_sector
)
852 __field( unsigned int, rwbs
)
853 __array_text( char, comm
, TASK_COMM_LEN
)
857 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
858 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
859 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
860 tp_assign(new_sector
, new_sector
)
861 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
862 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
863 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
864 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
865 tp_assign(sector
, bio
->bi_sector
)
866 tp_assign(new_sector
, new_sector
)
867 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
868 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
869 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
872 TP_printk("%d,%d %s %llu / %llu [%s]",
873 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
874 __print_rwbs_flags(__entry
->rwbs
),
875 (unsigned long long)__entry
->sector
,
876 (unsigned long long)__entry
->new_sector
,
881 * block_bio_remap - map request for a logical device to the raw device
882 * @q: queue holding the operation
883 * @bio: revised operation
884 * @dev: device for the operation
885 * @from: original sector for the operation
887 * An operation for a logical device has been mapped to the
890 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
891 TRACE_EVENT(block_bio_remap
,
893 TRACE_EVENT(block_remap
,
896 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
899 TP_ARGS(q
, bio
, dev
, from
),
902 __field( dev_t
, dev
)
903 __field( sector_t
, sector
)
904 __field( unsigned int, nr_sector
)
905 __field( dev_t
, old_dev
)
906 __field( sector_t
, old_sector
)
907 __field( unsigned int, rwbs
)
911 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
912 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
913 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
914 tp_assign(nr_sector
, bio_sectors(bio
))
915 tp_assign(old_dev
, dev
)
916 tp_assign(old_sector
, from
)
917 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
918 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
919 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
920 tp_assign(sector
, bio
->bi_sector
)
921 tp_assign(nr_sector
, bio
->bi_size
>> 9)
922 tp_assign(old_dev
, dev
)
923 tp_assign(old_sector
, from
)
924 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
925 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
928 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
929 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
930 __print_rwbs_flags(__entry
->rwbs
),
931 (unsigned long long)__entry
->sector
,
933 MAJOR(__entry
->old_dev
), MINOR(__entry
->old_dev
),
934 (unsigned long long)__entry
->old_sector
)
937 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
939 * block_rq_remap - map request for a block operation request
940 * @q: queue holding the operation
941 * @rq: block IO operation request
942 * @dev: device for the operation
943 * @from: original sector for the operation
945 * The block operation request @rq in @q has been remapped. The block
946 * operation request @rq holds the current information and @from hold
947 * the original sector.
949 TRACE_EVENT(block_rq_remap
,
951 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
954 TP_ARGS(q
, rq
, dev
, from
),
957 __field( dev_t
, dev
)
958 __field( sector_t
, sector
)
959 __field( unsigned int, nr_sector
)
960 __field( dev_t
, old_dev
)
961 __field( sector_t
, old_sector
)
962 __field( unsigned int, rwbs
)
966 tp_assign(dev
, disk_devt(rq
->rq_disk
))
967 tp_assign(sector
, blk_rq_pos(rq
))
968 tp_assign(nr_sector
, blk_rq_sectors(rq
))
969 tp_assign(old_dev
, dev
)
970 tp_assign(old_sector
, from
)
971 blk_fill_rwbs(rwbs
, rq
->cmd_flags
, blk_rq_bytes(rq
))
974 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
975 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
976 __print_rwbs_flags(__entry
->rwbs
),
977 (unsigned long long)__entry
->sector
,
979 MAJOR(__entry
->old_dev
), MINOR(__entry
->old_dev
),
980 (unsigned long long)__entry
->old_sector
)
984 #undef __print_rwbs_flags
987 #endif /* _TRACE_BLOCK_H */
989 /* This part must be outside protection */
990 #include "../../../probes/define_trace.h"
This page took 0.06937 seconds and 5 git commands to generate.