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
),
225 * block_rq_complete - block IO operation completed by device driver
226 * @q: queue containing the block operation request
227 * @rq: block operations request
229 * The block_rq_complete tracepoint event indicates that some portion
230 * of operation request has been completed by the device driver. If
231 * the @rq->bio is %NULL, then there is absolutely no additional work to
232 * do for the request. If @rq->bio is non-NULL then there is
233 * additional work required to complete the request.
235 DEFINE_EVENT(block_rq_with_error
, block_rq_complete
,
237 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
242 DECLARE_EVENT_CLASS(block_rq
,
244 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
249 __field( dev_t
, dev
)
250 __field( sector_t
, sector
)
251 __field( unsigned int, nr_sector
)
252 __field( unsigned int, bytes
)
253 __field( unsigned int, rwbs
)
254 __array_text( char, comm
, TASK_COMM_LEN
)
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
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
264 tp_assign(nr_sector
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
265 0 : blk_rq_sectors(rq
))
266 tp_assign(bytes
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
267 blk_rq_bytes(rq
) : 0)
268 blk_fill_rwbs(rwbs
, rq
->cmd_flags
, blk_rq_bytes(rq
))
269 tp_memcpy_dyn(cmd
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
271 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
274 TP_printk("%d,%d %s %u (%s) %llu + %u [%s]",
275 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
276 __print_rwbs_flags(__entry
->rwbs
),
278 __blk_dump_cmd(__get_dynamic_array(cmd
),
279 __get_dynamic_array_len(cmd
)),
280 (unsigned long long)__entry
->sector
,
281 __entry
->nr_sector
, __entry
->comm
)
285 * block_rq_insert - insert block operation request into queue
287 * @rq: block IO operation request
289 * Called immediately before block operation request @rq is inserted
290 * into queue @q. The fields in the operation request @rq struct can
291 * be examined to determine which device and sectors the pending
292 * operation would access.
294 DEFINE_EVENT(block_rq
, block_rq_insert
,
296 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
302 * block_rq_issue - issue pending block IO request operation to device driver
303 * @q: queue holding operation
304 * @rq: block IO operation operation request
306 * Called when block operation request @rq from queue @q is sent to a
307 * device driver for processing.
309 DEFINE_EVENT(block_rq
, block_rq_issue
,
311 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
317 * block_bio_bounce - used bounce buffer when processing block operation
318 * @q: queue holding the block operation
319 * @bio: block operation
321 * A bounce buffer was used to handle the block operation @bio in @q.
322 * This occurs when hardware limitations prevent a direct transfer of
323 * data between the @bio data memory area and the IO device. Use of a
324 * bounce buffer requires extra copying of data and decreases
327 TRACE_EVENT(block_bio_bounce
,
329 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
334 __field( dev_t
, dev
)
335 __field( sector_t
, sector
)
336 __field( unsigned int, nr_sector
)
337 __field( unsigned int, rwbs
)
338 __array_text( char, comm
, TASK_COMM_LEN
)
342 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
343 tp_assign(dev
, bio
->bi_bdev
?
344 bio
->bi_bdev
->bd_dev
: 0)
345 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
346 tp_assign(nr_sector
, bio_sectors(bio
))
347 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
348 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
349 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
350 tp_assign(dev
, bio
->bi_bdev
?
351 bio
->bi_bdev
->bd_dev
: 0)
352 tp_assign(sector
, bio
->bi_sector
)
353 tp_assign(nr_sector
, bio
->bi_size
>> 9)
354 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
355 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
356 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
359 TP_printk("%d,%d %s %llu + %u [%s]",
360 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
361 __print_rwbs_flags(__entry
->rwbs
),
362 (unsigned long long)__entry
->sector
,
363 __entry
->nr_sector
, __entry
->comm
)
367 * block_bio_complete - completed all work on the block operation
368 * @q: queue holding the block operation
369 * @bio: block operation completed
370 * @error: io error value
372 * This tracepoint indicates there is no further work to do on this
373 * block IO operation @bio.
375 TRACE_EVENT(block_bio_complete
,
377 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
378 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
380 TP_ARGS(q
, bio
, error
),
382 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
388 __field( dev_t
, dev
)
389 __field( sector_t
, sector
)
390 __field( unsigned, nr_sector
)
391 __field( int, error
)
392 __field( unsigned int, rwbs
)
396 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
397 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
398 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
399 tp_assign(nr_sector
, bio_sectors(bio
))
400 tp_assign(error
, error
)
401 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
402 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
403 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
404 tp_assign(sector
, bio
->bi_sector
)
405 tp_assign(nr_sector
, bio
->bi_size
>> 9)
406 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
407 tp_assign(error
, error
)
411 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
412 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
415 TP_printk("%d,%d %s %llu + %u [%d]",
416 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
417 __print_rwbs_flags(__entry
->rwbs
),
418 (unsigned long long)__entry
->sector
,
419 __entry
->nr_sector
, __entry
->error
)
422 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
423 DECLARE_EVENT_CLASS(block_bio_merge
,
425 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
430 __field( dev_t
, dev
)
431 __field( sector_t
, sector
)
432 __field( unsigned int, nr_sector
)
433 __field( unsigned int, rwbs
)
434 __array_text( char, comm
, TASK_COMM_LEN
)
438 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
439 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
440 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
441 tp_assign(nr_sector
, bio_sectors(bio
))
442 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
443 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
444 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
445 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
446 tp_assign(sector
, bio
->bi_sector
)
447 tp_assign(nr_sector
, bio
->bi_size
>> 9)
448 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
449 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
450 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
453 TP_printk("%d,%d %s %llu + %u [%s]",
454 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
455 __print_rwbs_flags(__entry
->rwbs
),
456 (unsigned long long)__entry
->sector
,
457 __entry
->nr_sector
, __entry
->comm
)
461 * block_bio_backmerge - merging block operation to the end of an existing operation
462 * @q: queue holding operation
463 * @bio: new block operation to merge
465 * Merging block request @bio to the end of an existing block request
468 DEFINE_EVENT(block_bio_merge
, block_bio_backmerge
,
470 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
476 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
477 * @q: queue holding operation
478 * @bio: new block operation to merge
480 * Merging block IO operation @bio to the beginning of an existing block
481 * operation in queue @q.
483 DEFINE_EVENT(block_bio_merge
, block_bio_frontmerge
,
485 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
491 * block_bio_queue - putting new block IO operation in queue
492 * @q: queue holding operation
493 * @bio: new block operation
495 * About to place the block IO operation @bio into queue @q.
497 TRACE_EVENT(block_bio_queue
,
499 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
504 __field( dev_t
, dev
)
505 __field( sector_t
, sector
)
506 __field( unsigned int, nr_sector
)
507 __array( char, rwbs
, RWBS_LEN
)
508 __array( char, comm
, TASK_COMM_LEN
)
512 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
513 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
514 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
515 tp_assign(nr_sector
, bio_sectors(bio
))
516 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
517 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
518 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
519 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
520 tp_assign(sector
, bio
->bi_sector
)
521 tp_assign(nr_sector
, bio
->bi_size
>> 9)
522 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
523 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
524 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
527 TP_printk("%d,%d %s %llu + %u [%s]",
528 MAJOR(__entry
->dev
), MINOR(__entry
->dev
), __entry
->rwbs
,
529 (unsigned long long)__entry
->sector
,
530 __entry
->nr_sector
, __entry
->comm
)
533 DECLARE_EVENT_CLASS(block_bio
,
535 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
540 __field( dev_t
, dev
)
541 __field( sector_t
, sector
)
542 __field( unsigned int, nr_sector
)
543 __field( unsigned int, rwbs
)
544 __array_text( char, comm
, TASK_COMM_LEN
)
548 tp_assign(dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
549 tp_assign(sector
, bio
->bi_sector
)
550 tp_assign(nr_sector
, bio
->bi_size
>> 9)
551 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
552 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
555 TP_printk("%d,%d %s %llu + %u [%s]",
556 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
557 __print_rwbs_flags(__entry
->rwbs
),
558 (unsigned long long)__entry
->sector
,
559 __entry
->nr_sector
, __entry
->comm
)
563 * block_bio_backmerge - merging block operation to the end of an existing operation
564 * @q: queue holding operation
565 * @bio: new block operation to merge
567 * Merging block request @bio to the end of an existing block request
570 DEFINE_EVENT(block_bio
, block_bio_backmerge
,
572 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
578 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
579 * @q: queue holding operation
580 * @bio: new block operation to merge
582 * Merging block IO operation @bio to the beginning of an existing block
583 * operation in queue @q.
585 DEFINE_EVENT(block_bio
, block_bio_frontmerge
,
587 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
593 * block_bio_queue - putting new block IO operation in queue
594 * @q: queue holding operation
595 * @bio: new block operation
597 * About to place the block IO operation @bio into queue @q.
599 DEFINE_EVENT(block_bio
, block_bio_queue
,
601 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
607 DECLARE_EVENT_CLASS(block_get_rq
,
609 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
614 __field( dev_t
, dev
)
615 __field( sector_t
, sector
)
616 __field( unsigned int, nr_sector
)
617 __field( unsigned int, rwbs
)
618 __array_text( char, comm
, TASK_COMM_LEN
)
622 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
623 tp_assign(dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
624 tp_assign(sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
625 tp_assign(nr_sector
, bio
? bio_sectors(bio
) : 0)
626 blk_fill_rwbs(rwbs
, bio
? bio
->bi_rw
: 0,
627 bio
? bio_sectors(bio
) : 0)
628 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
629 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
630 tp_assign(dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
631 tp_assign(sector
, bio
? bio
->bi_sector
: 0)
632 tp_assign(nr_sector
, bio
? bio
->bi_size
>> 9 : 0)
633 blk_fill_rwbs(rwbs
, bio
? bio
->bi_rw
: 0,
634 bio
? bio
->bi_size
>> 9 : 0)
635 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
636 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
639 TP_printk("%d,%d %s %llu + %u [%s]",
640 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
641 __print_rwbs_flags(__entry
->rwbs
),
642 (unsigned long long)__entry
->sector
,
643 __entry
->nr_sector
, __entry
->comm
)
647 * block_getrq - get a free request entry in queue for block IO operations
648 * @q: queue for operations
649 * @bio: pending block IO operation
650 * @rw: low bit indicates a read (%0) or a write (%1)
652 * A request struct for queue @q has been allocated to handle the
653 * block IO operation @bio.
655 DEFINE_EVENT(block_get_rq
, block_getrq
,
657 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
663 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
664 * @q: queue for operation
665 * @bio: pending block IO operation
666 * @rw: low bit indicates a read (%0) or a write (%1)
668 * In the case where a request struct cannot be provided for queue @q
669 * the process needs to wait for an request struct to become
670 * available. This tracepoint event is generated each time the
671 * process goes to sleep waiting for request struct become available.
673 DEFINE_EVENT(block_get_rq
, block_sleeprq
,
675 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
681 * block_plug - keep operations requests in request queue
682 * @q: request queue to plug
684 * Plug the request queue @q. Do not allow block operation requests
685 * to be sent to the device driver. Instead, accumulate requests in
686 * the queue to improve throughput performance of the block device.
688 TRACE_EVENT(block_plug
,
690 TP_PROTO(struct request_queue
*q
),
695 __array_text( char, comm
, TASK_COMM_LEN
)
699 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
702 TP_printk("[%s]", __entry
->comm
)
705 DECLARE_EVENT_CLASS(block_unplug
,
707 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
708 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
710 TP_ARGS(q
, depth
, explicit),
712 TP_PROTO(struct request_queue
*q
),
718 __field( int, nr_rq
)
719 __array_text( char, comm
, TASK_COMM_LEN
)
723 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
724 tp_assign(nr_rq
, depth
)
726 tp_assign(nr_rq
, q
->rq
.count
[READ
] + q
->rq
.count
[WRITE
])
728 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
731 TP_printk("[%s] %d", __entry
->comm
, __entry
->nr_rq
)
734 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
736 * block_unplug_timer - timed release of operations requests in queue to device driver
737 * @q: request queue to unplug
739 * Unplug the request queue @q because a timer expired and allow block
740 * operation requests to be sent to the device driver.
742 DEFINE_EVENT(block_unplug
, block_unplug_timer
,
744 TP_PROTO(struct request_queue
*q
),
751 * block_unplug - release of operations requests in request queue
752 * @q: request queue to unplug
753 * @depth: number of requests just added to the queue
754 * @explicit: whether this was an explicit unplug, or one from schedule()
756 * Unplug request queue @q because device driver is scheduled to work
757 * on elements in the request queue.
759 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
760 DEFINE_EVENT(block_unplug
, block_unplug
,
762 DEFINE_EVENT(block_unplug
, block_unplug_io
,
765 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
766 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
768 TP_ARGS(q
, depth
, explicit)
770 TP_PROTO(struct request_queue
*q
),
777 * block_split - split a single bio struct into two bio structs
778 * @q: queue containing the bio
779 * @bio: block operation being split
780 * @new_sector: The starting sector for the new bio
782 * The bio request @bio in request queue @q needs to be split into two
783 * bio requests. The newly created @bio request starts at
784 * @new_sector. This split may be required due to hardware limitation
785 * such as operation crossing device boundaries in a RAID system.
787 TRACE_EVENT(block_split
,
789 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
790 unsigned int new_sector
),
792 TP_ARGS(q
, bio
, new_sector
),
795 __field( dev_t
, dev
)
796 __field( sector_t
, sector
)
797 __field( sector_t
, new_sector
)
798 __field( unsigned int, rwbs
)
799 __array_text( char, comm
, TASK_COMM_LEN
)
803 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
804 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
805 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
806 tp_assign(new_sector
, new_sector
)
807 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
808 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
809 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
810 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
811 tp_assign(sector
, bio
->bi_sector
)
812 tp_assign(new_sector
, new_sector
)
813 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
814 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
815 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
818 TP_printk("%d,%d %s %llu / %llu [%s]",
819 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
820 __print_rwbs_flags(__entry
->rwbs
),
821 (unsigned long long)__entry
->sector
,
822 (unsigned long long)__entry
->new_sector
,
827 * block_bio_remap - map request for a logical device to the raw device
828 * @q: queue holding the operation
829 * @bio: revised operation
830 * @dev: device for the operation
831 * @from: original sector for the operation
833 * An operation for a logical device has been mapped to the
836 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
837 TRACE_EVENT(block_bio_remap
,
839 TRACE_EVENT(block_remap
,
842 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
845 TP_ARGS(q
, bio
, dev
, from
),
848 __field( dev_t
, dev
)
849 __field( sector_t
, sector
)
850 __field( unsigned int, nr_sector
)
851 __field( dev_t
, old_dev
)
852 __field( sector_t
, old_sector
)
853 __field( unsigned int, rwbs
)
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(nr_sector
, bio_sectors(bio
))
861 tp_assign(old_dev
, dev
)
862 tp_assign(old_sector
, from
)
863 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
864 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
865 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
866 tp_assign(sector
, bio
->bi_sector
)
867 tp_assign(nr_sector
, bio
->bi_size
>> 9)
868 tp_assign(old_dev
, dev
)
869 tp_assign(old_sector
, from
)
870 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
871 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
874 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
875 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
876 __print_rwbs_flags(__entry
->rwbs
),
877 (unsigned long long)__entry
->sector
,
879 MAJOR(__entry
->old_dev
), MINOR(__entry
->old_dev
),
880 (unsigned long long)__entry
->old_sector
)
883 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
885 * block_rq_remap - map request for a block operation request
886 * @q: queue holding the operation
887 * @rq: block IO operation request
888 * @dev: device for the operation
889 * @from: original sector for the operation
891 * The block operation request @rq in @q has been remapped. The block
892 * operation request @rq holds the current information and @from hold
893 * the original sector.
895 TRACE_EVENT(block_rq_remap
,
897 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
900 TP_ARGS(q
, rq
, dev
, from
),
903 __field( dev_t
, dev
)
904 __field( sector_t
, sector
)
905 __field( unsigned int, nr_sector
)
906 __field( dev_t
, old_dev
)
907 __field( sector_t
, old_sector
)
908 __field( unsigned int, rwbs
)
912 tp_assign(dev
, disk_devt(rq
->rq_disk
))
913 tp_assign(sector
, blk_rq_pos(rq
))
914 tp_assign(nr_sector
, blk_rq_sectors(rq
))
915 tp_assign(old_dev
, dev
)
916 tp_assign(old_sector
, from
)
917 blk_fill_rwbs(rwbs
, rq
->cmd_flags
, blk_rq_bytes(rq
))
920 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
921 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
922 __print_rwbs_flags(__entry
->rwbs
),
923 (unsigned long long)__entry
->sector
,
925 MAJOR(__entry
->old_dev
), MINOR(__entry
->old_dev
),
926 (unsigned long long)__entry
->old_sector
)
930 #undef __print_rwbs_flags
933 #endif /* _TRACE_BLOCK_H */
935 /* This part must be outside protection */
936 #include "../../../probes/define_trace.h"
This page took 0.059243 seconds and 5 git commands to generate.