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 tp_assign(dev, bio->bi_bdev ?
343 bio->bi_bdev->bd_dev : 0)
344 tp_assign(sector, bio->bi_sector)
345 tp_assign(nr_sector, bio->bi_size >> 9)
346 blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size)
347 tp_memcpy(comm, current->comm, TASK_COMM_LEN)
350 TP_printk("%d,%d %s %llu + %u [%s]",
351 MAJOR(__entry->dev), MINOR(__entry->dev),
352 __print_rwbs_flags(__entry->rwbs),
353 (unsigned long long)__entry->sector,
354 __entry->nr_sector, __entry->comm)
358 * block_bio_complete - completed all work on the block operation
359 * @q: queue holding the block operation
360 * @bio: block operation completed
361 * @error: io error value
363 * This tracepoint indicates there is no further work to do on this
364 * block IO operation @bio.
366 TRACE_EVENT(block_bio_complete,
368 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
369 TP_PROTO(struct request_queue *q, struct bio *bio, int error),
371 TP_ARGS(q, bio, error),
373 TP_PROTO(struct request_queue *q, struct bio *bio),
379 __field( dev_t, dev )
380 __field( sector_t, sector )
381 __field( unsigned, nr_sector )
382 __field( int, error )
383 __field( unsigned int, rwbs )
387 tp_assign(dev, bio->bi_bdev->bd_dev)
388 tp_assign(sector, bio->bi_sector)
389 tp_assign(nr_sector, bio->bi_size >> 9)
390 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
391 tp_assign(error, error)
395 blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size)
398 TP_printk("%d,%d %s %llu + %u [%d]",
399 MAJOR(__entry->dev), MINOR(__entry->dev),
400 __print_rwbs_flags(__entry->rwbs),
401 (unsigned long long)__entry->sector,
402 __entry->nr_sector, __entry->error)
405 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
406 DECLARE_EVENT_CLASS(block_bio_merge,
408 TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
413 __field( dev_t, dev )
414 __field( sector_t, sector )
415 __field( unsigned int, nr_sector )
416 __field( unsigned int, rwbs )
417 __array_text( char, comm, TASK_COMM_LEN )
421 tp_assign(dev, bio->bi_bdev->bd_dev)
422 tp_assign(sector, bio->bi_sector)
423 tp_assign(nr_sector, bio->bi_size >> 9)
424 blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size)
425 tp_memcpy(comm, current->comm, TASK_COMM_LEN)
428 TP_printk("%d,%d %s %llu + %u [%s]",
429 MAJOR(__entry->dev), MINOR(__entry->dev),
430 __print_rwbs_flags(__entry->rwbs),
431 (unsigned long long)__entry->sector,
432 __entry->nr_sector, __entry->comm)
436 * block_bio_backmerge - merging block operation to the end of an existing operation
437 * @q: queue holding operation
438 * @bio: new block operation to merge
440 * Merging block request @bio to the end of an existing block request
443 DEFINE_EVENT(block_bio_merge, block_bio_backmerge,
445 TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
451 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
452 * @q: queue holding operation
453 * @bio: new block operation to merge
455 * Merging block IO operation @bio to the beginning of an existing block
456 * operation in queue @q.
458 DEFINE_EVENT(block_bio_merge, block_bio_frontmerge,
460 TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
466 * block_bio_queue - putting new block IO operation in queue
467 * @q: queue holding operation
468 * @bio: new block operation
470 * About to place the block IO operation @bio into queue @q.
472 TRACE_EVENT(block_bio_queue,
474 TP_PROTO(struct request_queue *q, struct bio *bio),
479 __field( dev_t, dev )
480 __field( sector_t, sector )
481 __field( unsigned int, nr_sector )
482 __array( char, rwbs, RWBS_LEN )
483 __array( char, comm, TASK_COMM_LEN )
487 tp_assign(dev, bio->bi_bdev->bd_dev)
488 tp_assign(sector, bio->bi_sector)
489 tp_assign(nr_sector, bio->bi_size >> 9)
490 blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size)
491 tp_memcpy(comm, current->comm, TASK_COMM_LEN)
494 TP_printk("%d,%d %s %llu + %u [%s]",
495 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
496 (unsigned long long)__entry->sector,
497 __entry->nr_sector, __entry->comm)
500 DECLARE_EVENT_CLASS(block_bio,
502 TP_PROTO(struct request_queue *q, struct bio *bio),
507 __field( dev_t, dev )
508 __field( sector_t, sector )
509 __field( unsigned int, nr_sector )
510 __field( unsigned int, rwbs )
511 __array_text( char, comm, TASK_COMM_LEN )
515 tp_assign(dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0)
516 tp_assign(sector, bio->bi_sector)
517 tp_assign(nr_sector, bio->bi_size >> 9)
518 blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size)
519 tp_memcpy(comm, current->comm, TASK_COMM_LEN)
522 TP_printk("%d,%d %s %llu + %u [%s]",
523 MAJOR(__entry->dev), MINOR(__entry->dev),
524 __print_rwbs_flags(__entry->rwbs),
525 (unsigned long long)__entry->sector,
526 __entry->nr_sector, __entry->comm)
530 * block_bio_backmerge - merging block operation to the end of an existing operation
531 * @q: queue holding operation
532 * @bio: new block operation to merge
534 * Merging block request @bio to the end of an existing block request
537 DEFINE_EVENT(block_bio, block_bio_backmerge,
539 TP_PROTO(struct request_queue *q, struct bio *bio),
545 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
546 * @q: queue holding operation
547 * @bio: new block operation to merge
549 * Merging block IO operation @bio to the beginning of an existing block
550 * operation in queue @q.
552 DEFINE_EVENT(block_bio, block_bio_frontmerge,
554 TP_PROTO(struct request_queue *q, struct bio *bio),
560 * block_bio_queue - putting new block IO operation in queue
561 * @q: queue holding operation
562 * @bio: new block operation
564 * About to place the block IO operation @bio into queue @q.
566 DEFINE_EVENT(block_bio, block_bio_queue,
568 TP_PROTO(struct request_queue *q, struct bio *bio),
574 DECLARE_EVENT_CLASS(block_get_rq,
576 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
581 __field( dev_t, dev )
582 __field( sector_t, sector )
583 __field( unsigned int, nr_sector )
584 __field( unsigned int, rwbs )
585 __array_text( char, comm, TASK_COMM_LEN )
589 tp_assign(dev, bio ? bio->bi_bdev->bd_dev : 0)
590 tp_assign(sector, bio ? bio->bi_sector : 0)
591 tp_assign(nr_sector, bio ? bio->bi_size >> 9 : 0)
592 blk_fill_rwbs(rwbs, bio ? bio->bi_rw : 0,
593 bio ? bio->bi_size >> 9 : 0)
594 tp_memcpy(comm, current->comm, TASK_COMM_LEN)
597 TP_printk("%d,%d %s %llu + %u [%s]",
598 MAJOR(__entry->dev), MINOR(__entry->dev),
599 __print_rwbs_flags(__entry->rwbs),
600 (unsigned long long)__entry->sector,
601 __entry->nr_sector, __entry->comm)
605 * block_getrq - get a free request entry in queue for block IO operations
606 * @q: queue for operations
607 * @bio: pending block IO operation
608 * @rw: low bit indicates a read (%0) or a write (%1)
610 * A request struct for queue @q has been allocated to handle the
611 * block IO operation @bio.
613 DEFINE_EVENT(block_get_rq, block_getrq,
615 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
621 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
622 * @q: queue for operation
623 * @bio: pending block IO operation
624 * @rw: low bit indicates a read (%0) or a write (%1)
626 * In the case where a request struct cannot be provided for queue @q
627 * the process needs to wait for an request struct to become
628 * available. This tracepoint event is generated each time the
629 * process goes to sleep waiting for request struct become available.
631 DEFINE_EVENT(block_get_rq, block_sleeprq,
633 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
639 * block_plug - keep operations requests in request queue
640 * @q: request queue to plug
642 * Plug the request queue @q. Do not allow block operation requests
643 * to be sent to the device driver. Instead, accumulate requests in
644 * the queue to improve throughput performance of the block device.
646 TRACE_EVENT(block_plug,
648 TP_PROTO(struct request_queue *q),
653 __array_text( char, comm, TASK_COMM_LEN )
657 tp_memcpy(comm, current->comm, TASK_COMM_LEN)
660 TP_printk("[%s]", __entry->comm)
663 DECLARE_EVENT_CLASS(block_unplug,
665 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
666 TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit),
668 TP_ARGS(q, depth, explicit),
670 TP_PROTO(struct request_queue *q),
676 __field( int, nr_rq )
677 __array_text( char, comm, TASK_COMM_LEN )
681 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
682 tp_assign(nr_rq, depth)
684 tp_assign(nr_rq, q->rq.count[READ] + q->rq.count[WRITE])
686 tp_memcpy(comm, current->comm, TASK_COMM_LEN)
689 TP_printk("[%s] %d", __entry->comm, __entry->nr_rq)
692 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
694 * block_unplug_timer - timed release of operations requests in queue to device driver
695 * @q: request queue to unplug
697 * Unplug the request queue @q because a timer expired and allow block
698 * operation requests to be sent to the device driver.
700 DEFINE_EVENT(block_unplug, block_unplug_timer,
702 TP_PROTO(struct request_queue *q),
709 * block_unplug - release of operations requests in request queue
710 * @q: request queue to unplug
711 * @depth: number of requests just added to the queue
712 * @explicit: whether this was an explicit unplug, or one from schedule()
714 * Unplug request queue @q because device driver is scheduled to work
715 * on elements in the request queue.
717 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
718 DEFINE_EVENT(block_unplug, block_unplug,
720 DEFINE_EVENT(block_unplug, block_unplug_io,
723 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
724 TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit),
726 TP_ARGS(q, depth, explicit)
728 TP_PROTO(struct request_queue *q),
735 * block_split - split a single bio struct into two bio structs
736 * @q: queue containing the bio
737 * @bio: block operation being split
738 * @new_sector: The starting sector for the new bio
740 * The bio request @bio in request queue @q needs to be split into two
741 * bio requests. The newly created @bio request starts at
742 * @new_sector. This split may be required due to hardware limitation
743 * such as operation crossing device boundaries in a RAID system.
745 TRACE_EVENT(block_split,
747 TP_PROTO(struct request_queue *q, struct bio *bio,
748 unsigned int new_sector),
750 TP_ARGS(q, bio, new_sector),
753 __field( dev_t, dev )
754 __field( sector_t, sector )
755 __field( sector_t, new_sector )
756 __field( unsigned int, rwbs )
757 __array_text( char, comm, TASK_COMM_LEN )
761 tp_assign(dev, bio->bi_bdev->bd_dev)
762 tp_assign(sector, bio->bi_sector)
763 tp_assign(new_sector, new_sector)
764 blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size)
765 tp_memcpy(comm, current->comm, TASK_COMM_LEN)
768 TP_printk("%d,%d %s %llu / %llu [%s]",
769 MAJOR(__entry->dev), MINOR(__entry->dev),
770 __print_rwbs_flags(__entry->rwbs),
771 (unsigned long long)__entry->sector,
772 (unsigned long long)__entry->new_sector,
777 * block_bio_remap - map request for a logical device to the raw device
778 * @q: queue holding the operation
779 * @bio: revised operation
780 * @dev: device for the operation
781 * @from: original sector for the operation
783 * An operation for a logical device has been mapped to the
786 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
787 TRACE_EVENT(block_bio_remap,
789 TRACE_EVENT(block_remap,
792 TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev,
795 TP_ARGS(q, bio, dev, from),
798 __field( dev_t, dev )
799 __field( sector_t, sector )
800 __field( unsigned int, nr_sector )
801 __field( dev_t, old_dev )
802 __field( sector_t, old_sector )
803 __field( unsigned int, rwbs )
807 tp_assign(dev, bio->bi_bdev->bd_dev)
808 tp_assign(sector, bio->bi_sector)
809 tp_assign(nr_sector, bio->bi_size >> 9)
810 tp_assign(old_dev, dev)
811 tp_assign(old_sector, from)
812 blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size)
815 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
816 MAJOR(__entry->dev), MINOR(__entry->dev),
817 __print_rwbs_flags(__entry->rwbs),
818 (unsigned long long)__entry->sector,
820 MAJOR(__entry->old_dev), MINOR(__entry->old_dev),
821 (unsigned long long)__entry->old_sector)
824 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
826 * block_rq_remap - map request for a block operation request
827 * @q: queue holding the operation
828 * @rq: block IO operation request
829 * @dev: device for the operation
830 * @from: original sector for the operation
832 * The block operation request @rq in @q has been remapped. The block
833 * operation request @rq holds the current information and @from hold
834 * the original sector.
836 TRACE_EVENT(block_rq_remap,
838 TP_PROTO(struct request_queue *q, struct request *rq, dev_t dev,
841 TP_ARGS(q, rq, dev, from),
844 __field( dev_t, dev )
845 __field( sector_t, sector )
846 __field( unsigned int, nr_sector )
847 __field( dev_t, old_dev )
848 __field( sector_t, old_sector )
849 __field( unsigned int, rwbs )
853 tp_assign(dev, disk_devt(rq->rq_disk))
854 tp_assign(sector, blk_rq_pos(rq))
855 tp_assign(nr_sector, blk_rq_sectors(rq))
856 tp_assign(old_dev, dev)
857 tp_assign(old_sector, from)
858 blk_fill_rwbs(rwbs, rq->cmd_flags, blk_rq_bytes(rq))
861 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
862 MAJOR(__entry->dev), MINOR(__entry->dev),
863 __print_rwbs_flags(__entry->rwbs),
864 (unsigned long long)__entry->sector,
866 MAJOR(__entry->old_dev), MINOR(__entry->old_dev),
867 (unsigned long long)__entry->old_sector)
871 #undef __print_rwbs_flags
874 #endif /* _TRACE_BLOCK_H */
876 /* This part must be outside protection */
877 #include "../../../probes/define_trace.h"