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,0) \
228 || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0) \
229 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,31, 3,14,0,0) \
230 || LTTNG_RHEL_KERNEL_RANGE(3,10,0,7,1, 3,11,0,0,0))
233 * block_rq_complete - block IO operation completed by device driver
234 * @q: queue containing the block operation request
235 * @rq: block operations request
236 * @nr_bytes: number of completed bytes
238 * The block_rq_complete tracepoint event indicates that some portion
239 * of operation request has been completed by the device driver. If
240 * the @rq->bio is %NULL, then there is absolutely no additional work to
241 * do for the request. If @rq->bio is non-NULL then there is
242 * additional work required to complete the request.
244 TRACE_EVENT(block_rq_complete
,
246 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
247 unsigned int nr_bytes
),
249 TP_ARGS(q
, rq
, nr_bytes
),
252 __field( dev_t
, dev
)
253 __field( sector_t
, sector
)
254 __field( unsigned int, nr_sector
)
255 __field( int, errors
)
256 __field( unsigned int, rwbs
)
257 __dynamic_array_hex( unsigned char, cmd
,
258 (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
263 tp_assign(dev
, rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
264 tp_assign(sector
, blk_rq_pos(rq
))
265 tp_assign(nr_sector
, nr_bytes
>> 9)
266 tp_assign(errors
, rq
->errors
)
267 blk_fill_rwbs(rwbs
, rq
->cmd_flags
, nr_bytes
)
268 tp_memcpy_dyn(cmd
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
272 TP_printk("%d,%d %s (%s) %llu + %u [%d]",
273 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
274 __entry
->rwbs
, __get_str(cmd
),
275 (unsigned long long)__entry
->sector
,
276 __entry
->nr_sector
, __entry
->errors
)
279 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
282 * block_rq_complete - block IO operation completed by device driver
283 * @q: queue containing the block operation request
284 * @rq: block operations request
286 * The block_rq_complete tracepoint event indicates that some portion
287 * of operation request has been completed by the device driver. If
288 * the @rq->bio is %NULL, then there is absolutely no additional work to
289 * do for the request. If @rq->bio is non-NULL then there is
290 * additional work required to complete the request.
292 DEFINE_EVENT(block_rq_with_error
, block_rq_complete
,
294 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
299 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
301 DECLARE_EVENT_CLASS(block_rq
,
303 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
308 __field( dev_t
, dev
)
309 __field( sector_t
, sector
)
310 __field( unsigned int, nr_sector
)
311 __field( unsigned int, bytes
)
312 __field( unsigned int, rwbs
)
313 __field( pid_t
, tid
)
314 __array_text( char, comm
, TASK_COMM_LEN
)
315 __dynamic_array_hex( unsigned char, cmd
,
316 (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
321 tp_assign(dev
, rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
322 tp_assign(sector
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
324 tp_assign(nr_sector
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
325 0 : blk_rq_sectors(rq
))
326 tp_assign(bytes
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
327 blk_rq_bytes(rq
) : 0)
328 blk_fill_rwbs(rwbs
, rq
->cmd_flags
, blk_rq_bytes(rq
))
329 tp_memcpy_dyn(cmd
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
331 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
332 tp_assign(tid
, current
->pid
)
335 TP_printk("%d,%d %s %u (%s) %llu + %u [%s] %d",
336 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
337 __print_rwbs_flags(__entry
->rwbs
),
339 __blk_dump_cmd(__get_dynamic_array(cmd
),
340 __get_dynamic_array_len(cmd
)),
341 (unsigned long long)__entry
->sector
,
342 __entry
->nr_sector
, __entry
->comm
, __entry
->tid
)
346 * block_rq_insert - insert block operation request into queue
348 * @rq: block IO operation request
350 * Called immediately before block operation request @rq is inserted
351 * into queue @q. The fields in the operation request @rq struct can
352 * be examined to determine which device and sectors the pending
353 * operation would access.
355 DEFINE_EVENT(block_rq
, block_rq_insert
,
357 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
363 * block_rq_issue - issue pending block IO request operation to device driver
364 * @q: queue holding operation
365 * @rq: block IO operation operation request
367 * Called when block operation request @rq from queue @q is sent to a
368 * device driver for processing.
370 DEFINE_EVENT(block_rq
, block_rq_issue
,
372 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
378 * block_bio_bounce - used bounce buffer when processing block operation
379 * @q: queue holding the block operation
380 * @bio: block operation
382 * A bounce buffer was used to handle the block operation @bio in @q.
383 * This occurs when hardware limitations prevent a direct transfer of
384 * data between the @bio data memory area and the IO device. Use of a
385 * bounce buffer requires extra copying of data and decreases
388 TRACE_EVENT(block_bio_bounce
,
390 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
395 __field( dev_t
, dev
)
396 __field( sector_t
, sector
)
397 __field( unsigned int, nr_sector
)
398 __field( unsigned int, rwbs
)
399 __field( pid_t
, tid
)
400 __array_text( char, comm
, TASK_COMM_LEN
)
404 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
405 tp_assign(dev
, bio
->bi_bdev
?
406 bio
->bi_bdev
->bd_dev
: 0)
407 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
408 tp_assign(nr_sector
, bio_sectors(bio
))
409 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
410 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
411 tp_assign(tid
, current
->pid
)
412 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
413 tp_assign(dev
, bio
->bi_bdev
?
414 bio
->bi_bdev
->bd_dev
: 0)
415 tp_assign(sector
, bio
->bi_sector
)
416 tp_assign(nr_sector
, bio
->bi_size
>> 9)
417 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
418 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
419 tp_assign(tid
, current
->pid
)
420 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
423 TP_printk("%d,%d %s %llu + %u [%s] %d",
424 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
425 __print_rwbs_flags(__entry
->rwbs
),
426 (unsigned long long)__entry
->sector
,
427 __entry
->nr_sector
, __entry
->comm
, __entry
->tid
)
431 * block_bio_complete - completed all work on the block operation
432 * @q: queue holding the block operation
433 * @bio: block operation completed
434 * @error: io error value
436 * This tracepoint indicates there is no further work to do on this
437 * block IO operation @bio.
439 TRACE_EVENT(block_bio_complete
,
441 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
442 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
444 TP_ARGS(q
, bio
, error
),
446 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
452 __field( dev_t
, dev
)
453 __field( sector_t
, sector
)
454 __field( unsigned, nr_sector
)
455 __field( int, error
)
456 __field( unsigned int, rwbs
)
460 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
461 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
462 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
463 tp_assign(nr_sector
, bio_sectors(bio
))
464 tp_assign(error
, error
)
465 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
466 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
467 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
468 tp_assign(sector
, bio
->bi_sector
)
469 tp_assign(nr_sector
, bio
->bi_size
>> 9)
470 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
471 tp_assign(error
, error
)
475 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
476 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
479 TP_printk("%d,%d %s %llu + %u [%d]",
480 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
481 __print_rwbs_flags(__entry
->rwbs
),
482 (unsigned long long)__entry
->sector
,
483 __entry
->nr_sector
, __entry
->error
)
486 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
487 DECLARE_EVENT_CLASS(block_bio_merge
,
489 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
494 __field( dev_t
, dev
)
495 __field( sector_t
, sector
)
496 __field( unsigned int, nr_sector
)
497 __field( unsigned int, rwbs
)
498 __field( pid_t
, tid
)
499 __array_text( char, comm
, TASK_COMM_LEN
)
503 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
504 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
505 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
506 tp_assign(nr_sector
, bio_sectors(bio
))
507 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
508 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
509 tp_assign(tid
, current
->pid
)
510 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
511 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
512 tp_assign(sector
, bio
->bi_sector
)
513 tp_assign(nr_sector
, bio
->bi_size
>> 9)
514 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
515 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
516 tp_assign(tid
, current
->pid
)
517 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
520 TP_printk("%d,%d %s %llu + %u [%s] %d",
521 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
522 __print_rwbs_flags(__entry
->rwbs
),
523 (unsigned long long)__entry
->sector
,
524 __entry
->nr_sector
, __entry
->comm
, __entry
->tid
)
528 * block_bio_backmerge - merging block operation to the end of an existing operation
529 * @q: queue holding operation
530 * @bio: new block operation to merge
532 * Merging block request @bio to the end of an existing block request
535 DEFINE_EVENT(block_bio_merge
, block_bio_backmerge
,
537 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
543 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
544 * @q: queue holding operation
545 * @bio: new block operation to merge
547 * Merging block IO operation @bio to the beginning of an existing block
548 * operation in queue @q.
550 DEFINE_EVENT(block_bio_merge
, block_bio_frontmerge
,
552 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
558 * block_bio_queue - putting new block IO operation in queue
559 * @q: queue holding operation
560 * @bio: new block operation
562 * About to place the block IO operation @bio into queue @q.
564 TRACE_EVENT(block_bio_queue
,
566 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
571 __field( dev_t
, dev
)
572 __field( sector_t
, sector
)
573 __field( unsigned int, nr_sector
)
574 __field( unsigned int, rwbs
)
575 __field( pid_t
, tid
)
576 __array_text( char, comm
, TASK_COMM_LEN
)
580 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
581 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
582 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
583 tp_assign(nr_sector
, bio_sectors(bio
))
584 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
585 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
586 tp_assign(tid
, current
->pid
)
587 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
588 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
589 tp_assign(sector
, bio
->bi_sector
)
590 tp_assign(nr_sector
, bio
->bi_size
>> 9)
591 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
592 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
593 tp_assign(tid
, current
->pid
)
594 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
597 TP_printk("%d,%d %s %llu + %u [%s] %d",
598 MAJOR(__entry
->dev
), MINOR(__entry
->dev
), __entry
->rwbs
,
599 (unsigned long long)__entry
->sector
,
600 __entry
->nr_sector
, __entry
->comm
, __entry
->tid
)
603 DECLARE_EVENT_CLASS(block_bio
,
605 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
610 __field( dev_t
, dev
)
611 __field( sector_t
, sector
)
612 __field( unsigned int, nr_sector
)
613 __field( unsigned int, rwbs
)
614 __field( pid_t
, tid
)
615 __array_text( char, comm
, TASK_COMM_LEN
)
619 tp_assign(dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
620 tp_assign(sector
, bio
->bi_sector
)
621 tp_assign(nr_sector
, bio
->bi_size
>> 9)
622 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
623 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
624 tp_assign(tid
, current
->pid
)
627 TP_printk("%d,%d %s %llu + %u [%s] %d",
628 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
629 __print_rwbs_flags(__entry
->rwbs
),
630 (unsigned long long)__entry
->sector
,
631 __entry
->nr_sector
, __entry
->comm
, __entry
->tid
)
635 * block_bio_backmerge - merging block operation to the end of an existing operation
636 * @q: queue holding operation
637 * @bio: new block operation to merge
639 * Merging block request @bio to the end of an existing block request
642 DEFINE_EVENT(block_bio
, block_bio_backmerge
,
644 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
650 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
651 * @q: queue holding operation
652 * @bio: new block operation to merge
654 * Merging block IO operation @bio to the beginning of an existing block
655 * operation in queue @q.
657 DEFINE_EVENT(block_bio
, block_bio_frontmerge
,
659 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
665 * block_bio_queue - putting new block IO operation in queue
666 * @q: queue holding operation
667 * @bio: new block operation
669 * About to place the block IO operation @bio into queue @q.
671 DEFINE_EVENT(block_bio
, block_bio_queue
,
673 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
679 DECLARE_EVENT_CLASS(block_get_rq
,
681 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
686 __field( dev_t
, dev
)
687 __field( sector_t
, sector
)
688 __field( unsigned int, nr_sector
)
689 __field( unsigned int, rwbs
)
690 __field( pid_t
, tid
)
691 __array_text( char, comm
, TASK_COMM_LEN
)
695 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
696 tp_assign(dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
697 tp_assign(sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
698 tp_assign(nr_sector
, bio
? bio_sectors(bio
) : 0)
699 blk_fill_rwbs(rwbs
, bio
? bio
->bi_rw
: 0,
700 bio
? bio_sectors(bio
) : 0)
701 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
702 tp_assign(tid
, current
->pid
)
703 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
704 tp_assign(dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
705 tp_assign(sector
, bio
? bio
->bi_sector
: 0)
706 tp_assign(nr_sector
, bio
? bio
->bi_size
>> 9 : 0)
707 blk_fill_rwbs(rwbs
, bio
? bio
->bi_rw
: 0,
708 bio
? bio
->bi_size
>> 9 : 0)
709 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
710 tp_assign(tid
, current
->pid
)
711 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
714 TP_printk("%d,%d %s %llu + %u [%s] %d",
715 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
716 __print_rwbs_flags(__entry
->rwbs
),
717 (unsigned long long)__entry
->sector
,
718 __entry
->nr_sector
, __entry
->comm
, __entry
->tid
)
722 * block_getrq - get a free request entry in queue for block IO operations
723 * @q: queue for operations
724 * @bio: pending block IO operation
725 * @rw: low bit indicates a read (%0) or a write (%1)
727 * A request struct for queue @q has been allocated to handle the
728 * block IO operation @bio.
730 DEFINE_EVENT(block_get_rq
, block_getrq
,
732 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
738 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
739 * @q: queue for operation
740 * @bio: pending block IO operation
741 * @rw: low bit indicates a read (%0) or a write (%1)
743 * In the case where a request struct cannot be provided for queue @q
744 * the process needs to wait for an request struct to become
745 * available. This tracepoint event is generated each time the
746 * process goes to sleep waiting for request struct become available.
748 DEFINE_EVENT(block_get_rq
, block_sleeprq
,
750 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
756 * block_plug - keep operations requests in request queue
757 * @q: request queue to plug
759 * Plug the request queue @q. Do not allow block operation requests
760 * to be sent to the device driver. Instead, accumulate requests in
761 * the queue to improve throughput performance of the block device.
763 TRACE_EVENT(block_plug
,
765 TP_PROTO(struct request_queue
*q
),
770 __field( pid_t
, tid
)
771 __array_text( char, comm
, TASK_COMM_LEN
)
775 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
776 tp_assign(tid
, current
->pid
)
779 TP_printk("[%s] %d", __entry
->comm
, __entry
->tid
)
782 DECLARE_EVENT_CLASS(block_unplug
,
784 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
785 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
787 TP_ARGS(q
, depth
, explicit),
789 TP_PROTO(struct request_queue
*q
),
795 __field( int, nr_rq
)
796 __field( pid_t
, tid
)
797 __array_text( char, comm
, TASK_COMM_LEN
)
801 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
802 tp_assign(nr_rq
, depth
)
804 tp_assign(nr_rq
, q
->rq
.count
[READ
] + q
->rq
.count
[WRITE
])
806 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
807 tp_assign(tid
, current
->pid
)
810 TP_printk("[%s] %d %d", __entry
->comm
, , __entry
->tid
,
814 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
816 * block_unplug_timer - timed release of operations requests in queue to device driver
817 * @q: request queue to unplug
819 * Unplug the request queue @q because a timer expired and allow block
820 * operation requests to be sent to the device driver.
822 DEFINE_EVENT(block_unplug
, block_unplug_timer
,
824 TP_PROTO(struct request_queue
*q
),
831 * block_unplug - release of operations requests in request queue
832 * @q: request queue to unplug
833 * @depth: number of requests just added to the queue
834 * @explicit: whether this was an explicit unplug, or one from schedule()
836 * Unplug request queue @q because device driver is scheduled to work
837 * on elements in the request queue.
839 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
840 DEFINE_EVENT(block_unplug
, block_unplug
,
842 DEFINE_EVENT(block_unplug
, block_unplug_io
,
845 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
846 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
848 TP_ARGS(q
, depth
, explicit)
850 TP_PROTO(struct request_queue
*q
),
857 * block_split - split a single bio struct into two bio structs
858 * @q: queue containing the bio
859 * @bio: block operation being split
860 * @new_sector: The starting sector for the new bio
862 * The bio request @bio in request queue @q needs to be split into two
863 * bio requests. The newly created @bio request starts at
864 * @new_sector. This split may be required due to hardware limitation
865 * such as operation crossing device boundaries in a RAID system.
867 TRACE_EVENT(block_split
,
869 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
870 unsigned int new_sector
),
872 TP_ARGS(q
, bio
, new_sector
),
875 __field( dev_t
, dev
)
876 __field( sector_t
, sector
)
877 __field( sector_t
, new_sector
)
878 __field( unsigned int, rwbs
)
879 __field( pid_t
, tid
)
880 __array_text( char, comm
, TASK_COMM_LEN
)
884 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
885 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
886 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
887 tp_assign(new_sector
, new_sector
)
888 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
889 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
890 tp_assign(tid
, current
->pid
)
891 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
892 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
893 tp_assign(sector
, bio
->bi_sector
)
894 tp_assign(new_sector
, new_sector
)
895 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
896 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
897 tp_assign(tid
, current
->pid
)
898 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
901 TP_printk("%d,%d %s %llu / %llu [%s] %d",
902 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
903 __print_rwbs_flags(__entry
->rwbs
),
904 (unsigned long long)__entry
->sector
,
905 (unsigned long long)__entry
->new_sector
,
906 __entry
->comm
, __entry
->tid
)
910 * block_bio_remap - map request for a logical device to the raw device
911 * @q: queue holding the operation
912 * @bio: revised operation
913 * @dev: device for the operation
914 * @from: original sector for the operation
916 * An operation for a logical device has been mapped to the
919 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
920 TRACE_EVENT(block_bio_remap
,
922 TRACE_EVENT(block_remap
,
925 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
928 TP_ARGS(q
, bio
, dev
, from
),
931 __field( dev_t
, dev
)
932 __field( sector_t
, sector
)
933 __field( unsigned int, nr_sector
)
934 __field( dev_t
, old_dev
)
935 __field( sector_t
, old_sector
)
936 __field( unsigned int, rwbs
)
940 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
941 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
942 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
943 tp_assign(nr_sector
, bio_sectors(bio
))
944 tp_assign(old_dev
, dev
)
945 tp_assign(old_sector
, from
)
946 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
947 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
948 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
949 tp_assign(sector
, bio
->bi_sector
)
950 tp_assign(nr_sector
, bio
->bi_size
>> 9)
951 tp_assign(old_dev
, dev
)
952 tp_assign(old_sector
, from
)
953 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
954 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
957 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
958 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
959 __print_rwbs_flags(__entry
->rwbs
),
960 (unsigned long long)__entry
->sector
,
962 MAJOR(__entry
->old_dev
), MINOR(__entry
->old_dev
),
963 (unsigned long long)__entry
->old_sector
)
966 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
968 * block_rq_remap - map request for a block operation request
969 * @q: queue holding the operation
970 * @rq: block IO operation request
971 * @dev: device for the operation
972 * @from: original sector for the operation
974 * The block operation request @rq in @q has been remapped. The block
975 * operation request @rq holds the current information and @from hold
976 * the original sector.
978 TRACE_EVENT(block_rq_remap
,
980 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
983 TP_ARGS(q
, rq
, dev
, from
),
986 __field( dev_t
, dev
)
987 __field( sector_t
, sector
)
988 __field( unsigned int, nr_sector
)
989 __field( dev_t
, old_dev
)
990 __field( sector_t
, old_sector
)
991 __field( unsigned int, rwbs
)
995 tp_assign(dev
, disk_devt(rq
->rq_disk
))
996 tp_assign(sector
, blk_rq_pos(rq
))
997 tp_assign(nr_sector
, blk_rq_sectors(rq
))
998 tp_assign(old_dev
, dev
)
999 tp_assign(old_sector
, from
)
1000 blk_fill_rwbs(rwbs
, rq
->cmd_flags
, blk_rq_bytes(rq
))
1003 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
1004 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
1005 __print_rwbs_flags(__entry
->rwbs
),
1006 (unsigned long long)__entry
->sector
,
1008 MAJOR(__entry
->old_dev
), MINOR(__entry
->old_dev
),
1009 (unsigned long long)__entry
->old_sector
)
1013 #undef __print_rwbs_flags
1014 #undef blk_fill_rwbs
1016 #endif /* _TRACE_BLOCK_H */
1018 /* This part must be outside protection */
1019 #include "../../../probes/define_trace.h"
This page took 0.051237 seconds and 4 git commands to generate.