2 #define TRACE_SYSTEM block
4 #if !defined(LTTNG_TRACE_BLOCK_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define LTTNG_TRACE_BLOCK_H
7 #include "../../../probes/lttng-tracepoint-event.h"
8 #include <linux/blktrace_api.h>
9 #include <linux/blkdev.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 LTTNG_TRACEPOINT_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 LTTNG_TRACEPOINT_EVENT_INSTANCE(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 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_dirty_buffer
,
147 TP_PROTO(struct buffer_head
*bh
),
153 LTTNG_TRACEPOINT_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 LTTNG_TRACEPOINT_EVENT_INSTANCE(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 LTTNG_TRACEPOINT_EVENT_INSTANCE(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))
231 * block_rq_complete - block IO operation completed by device driver
232 * @q: queue containing the block operation request
233 * @rq: block operations request
234 * @nr_bytes: number of completed bytes
236 * The block_rq_complete tracepoint event indicates that some portion
237 * of operation request has been completed by the device driver. If
238 * the @rq->bio is %NULL, then there is absolutely no additional work to
239 * do for the request. If @rq->bio is non-NULL then there is
240 * additional work required to complete the request.
242 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
244 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
245 unsigned int nr_bytes
),
247 TP_ARGS(q
, rq
, nr_bytes
),
250 __field( dev_t
, dev
)
251 __field( sector_t
, sector
)
252 __field( unsigned int, nr_sector
)
253 __field( int, errors
)
254 __field( unsigned int, rwbs
)
255 __dynamic_array_hex( unsigned char, cmd
,
256 (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
261 tp_assign(dev
, rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
262 tp_assign(sector
, blk_rq_pos(rq
))
263 tp_assign(nr_sector
, nr_bytes
>> 9)
264 tp_assign(errors
, rq
->errors
)
265 blk_fill_rwbs(rwbs
, rq
->cmd_flags
, nr_bytes
)
266 tp_memcpy_dyn(cmd
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
270 TP_printk("%d,%d %s (%s) %llu + %u [%d]",
271 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
272 __entry
->rwbs
, __get_str(cmd
),
273 (unsigned long long)__entry
->sector
,
274 __entry
->nr_sector
, __entry
->errors
)
277 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
280 * block_rq_complete - block IO operation completed by device driver
281 * @q: queue containing the block operation request
282 * @rq: block operations request
284 * The block_rq_complete tracepoint event indicates that some portion
285 * of operation request has been completed by the device driver. If
286 * the @rq->bio is %NULL, then there is absolutely no additional work to
287 * do for the request. If @rq->bio is non-NULL then there is
288 * additional work required to complete the request.
290 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_complete
,
292 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
297 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
299 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
301 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
306 __field( dev_t
, dev
)
307 __field( sector_t
, sector
)
308 __field( unsigned int, nr_sector
)
309 __field( unsigned int, bytes
)
310 __field( unsigned int, rwbs
)
311 __field( pid_t
, tid
)
312 __array_text( char, comm
, TASK_COMM_LEN
)
313 __dynamic_array_hex( unsigned char, cmd
,
314 (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
319 tp_assign(dev
, rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
320 tp_assign(sector
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
322 tp_assign(nr_sector
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
323 0 : blk_rq_sectors(rq
))
324 tp_assign(bytes
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
325 blk_rq_bytes(rq
) : 0)
326 blk_fill_rwbs(rwbs
, rq
->cmd_flags
, blk_rq_bytes(rq
))
327 tp_memcpy_dyn(cmd
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
329 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
330 tp_assign(tid
, current
->pid
)
333 TP_printk("%d,%d %s %u (%s) %llu + %u [%s] %d",
334 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
335 __print_rwbs_flags(__entry
->rwbs
),
337 __blk_dump_cmd(__get_dynamic_array(cmd
),
338 __get_dynamic_array_len(cmd
)),
339 (unsigned long long)__entry
->sector
,
340 __entry
->nr_sector
, __entry
->comm
, __entry
->tid
)
344 * block_rq_insert - insert block operation request into queue
346 * @rq: block IO operation request
348 * Called immediately before block operation request @rq is inserted
349 * into queue @q. The fields in the operation request @rq struct can
350 * be examined to determine which device and sectors the pending
351 * operation would access.
353 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
355 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
361 * block_rq_issue - issue pending block IO request operation to device driver
362 * @q: queue holding operation
363 * @rq: block IO operation operation request
365 * Called when block operation request @rq from queue @q is sent to a
366 * device driver for processing.
368 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
370 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
376 * block_bio_bounce - used bounce buffer when processing block operation
377 * @q: queue holding the block operation
378 * @bio: block operation
380 * A bounce buffer was used to handle the block operation @bio in @q.
381 * This occurs when hardware limitations prevent a direct transfer of
382 * data between the @bio data memory area and the IO device. Use of a
383 * bounce buffer requires extra copying of data and decreases
386 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
388 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
393 __field( dev_t
, dev
)
394 __field( sector_t
, sector
)
395 __field( unsigned int, nr_sector
)
396 __field( unsigned int, rwbs
)
397 __field( pid_t
, tid
)
398 __array_text( char, comm
, TASK_COMM_LEN
)
402 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
403 tp_assign(dev
, bio
->bi_bdev
?
404 bio
->bi_bdev
->bd_dev
: 0)
405 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
406 tp_assign(nr_sector
, bio_sectors(bio
))
407 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
408 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
409 tp_assign(tid
, current
->pid
)
410 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
411 tp_assign(dev
, bio
->bi_bdev
?
412 bio
->bi_bdev
->bd_dev
: 0)
413 tp_assign(sector
, bio
->bi_sector
)
414 tp_assign(nr_sector
, bio
->bi_size
>> 9)
415 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
416 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
417 tp_assign(tid
, current
->pid
)
418 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
421 TP_printk("%d,%d %s %llu + %u [%s] %d",
422 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
423 __print_rwbs_flags(__entry
->rwbs
),
424 (unsigned long long)__entry
->sector
,
425 __entry
->nr_sector
, __entry
->comm
, __entry
->tid
)
429 * block_bio_complete - completed all work on the block operation
430 * @q: queue holding the block operation
431 * @bio: block operation completed
432 * @error: io error value
434 * This tracepoint indicates there is no further work to do on this
435 * block IO operation @bio.
437 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
439 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
440 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
442 TP_ARGS(q
, bio
, error
),
444 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
450 __field( dev_t
, dev
)
451 __field( sector_t
, sector
)
452 __field( unsigned, nr_sector
)
453 __field( int, error
)
454 __field( unsigned int, rwbs
)
458 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
459 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
460 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
461 tp_assign(nr_sector
, bio_sectors(bio
))
462 tp_assign(error
, error
)
463 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
464 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
465 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
466 tp_assign(sector
, bio
->bi_sector
)
467 tp_assign(nr_sector
, bio
->bi_size
>> 9)
468 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
469 tp_assign(error
, error
)
473 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
474 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
477 TP_printk("%d,%d %s %llu + %u [%d]",
478 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
479 __print_rwbs_flags(__entry
->rwbs
),
480 (unsigned long long)__entry
->sector
,
481 __entry
->nr_sector
, __entry
->error
)
484 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
485 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
487 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
492 __field( dev_t
, dev
)
493 __field( sector_t
, sector
)
494 __field( unsigned int, nr_sector
)
495 __field( unsigned int, rwbs
)
496 __field( pid_t
, tid
)
497 __array_text( char, comm
, TASK_COMM_LEN
)
501 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
502 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
503 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
504 tp_assign(nr_sector
, bio_sectors(bio
))
505 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
506 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
507 tp_assign(tid
, current
->pid
)
508 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
509 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
510 tp_assign(sector
, bio
->bi_sector
)
511 tp_assign(nr_sector
, bio
->bi_size
>> 9)
512 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
513 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
514 tp_assign(tid
, current
->pid
)
515 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
518 TP_printk("%d,%d %s %llu + %u [%s] %d",
519 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
520 __print_rwbs_flags(__entry
->rwbs
),
521 (unsigned long long)__entry
->sector
,
522 __entry
->nr_sector
, __entry
->comm
, __entry
->tid
)
526 * block_bio_backmerge - merging block operation to the end of an existing operation
527 * @q: queue holding operation
528 * @bio: new block operation to merge
530 * Merging block request @bio to the end of an existing block request
533 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_backmerge
,
535 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
541 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
542 * @q: queue holding operation
543 * @bio: new block operation to merge
545 * Merging block IO operation @bio to the beginning of an existing block
546 * operation in queue @q.
548 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_frontmerge
,
550 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
556 * block_bio_queue - putting new block IO operation in queue
557 * @q: queue holding operation
558 * @bio: new block operation
560 * About to place the block IO operation @bio into queue @q.
562 LTTNG_TRACEPOINT_EVENT(block_bio_queue
,
564 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
569 __field( dev_t
, dev
)
570 __field( sector_t
, sector
)
571 __field( unsigned int, nr_sector
)
572 __field( unsigned int, rwbs
)
573 __field( pid_t
, tid
)
574 __array_text( char, comm
, TASK_COMM_LEN
)
578 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
579 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
580 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
581 tp_assign(nr_sector
, bio_sectors(bio
))
582 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
583 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
584 tp_assign(tid
, current
->pid
)
585 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
586 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
587 tp_assign(sector
, bio
->bi_sector
)
588 tp_assign(nr_sector
, bio
->bi_size
>> 9)
589 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
590 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
591 tp_assign(tid
, current
->pid
)
592 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
595 TP_printk("%d,%d %s %llu + %u [%s] %d",
596 MAJOR(__entry
->dev
), MINOR(__entry
->dev
), __entry
->rwbs
,
597 (unsigned long long)__entry
->sector
,
598 __entry
->nr_sector
, __entry
->comm
, __entry
->tid
)
601 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
603 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
608 __field( dev_t
, dev
)
609 __field( sector_t
, sector
)
610 __field( unsigned int, nr_sector
)
611 __field( unsigned int, rwbs
)
612 __field( pid_t
, tid
)
613 __array_text( char, comm
, TASK_COMM_LEN
)
617 tp_assign(dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
618 tp_assign(sector
, bio
->bi_sector
)
619 tp_assign(nr_sector
, bio
->bi_size
>> 9)
620 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
621 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
622 tp_assign(tid
, current
->pid
)
625 TP_printk("%d,%d %s %llu + %u [%s] %d",
626 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
627 __print_rwbs_flags(__entry
->rwbs
),
628 (unsigned long long)__entry
->sector
,
629 __entry
->nr_sector
, __entry
->comm
, __entry
->tid
)
633 * block_bio_backmerge - merging block operation to the end of an existing operation
634 * @q: queue holding operation
635 * @bio: new block operation to merge
637 * Merging block request @bio to the end of an existing block request
640 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
642 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
648 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
649 * @q: queue holding operation
650 * @bio: new block operation to merge
652 * Merging block IO operation @bio to the beginning of an existing block
653 * operation in queue @q.
655 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
657 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
663 * block_bio_queue - putting new block IO operation in queue
664 * @q: queue holding operation
665 * @bio: new block operation
667 * About to place the block IO operation @bio into queue @q.
669 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
671 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
677 LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq
,
679 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
684 __field( dev_t
, dev
)
685 __field( sector_t
, sector
)
686 __field( unsigned int, nr_sector
)
687 __field( unsigned int, rwbs
)
688 __field( pid_t
, tid
)
689 __array_text( char, comm
, TASK_COMM_LEN
)
693 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
694 tp_assign(dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
695 tp_assign(sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
696 tp_assign(nr_sector
, bio
? bio_sectors(bio
) : 0)
697 blk_fill_rwbs(rwbs
, bio
? bio
->bi_rw
: 0,
698 bio
? bio_sectors(bio
) : 0)
699 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
700 tp_assign(tid
, current
->pid
)
701 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
702 tp_assign(dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
703 tp_assign(sector
, bio
? bio
->bi_sector
: 0)
704 tp_assign(nr_sector
, bio
? bio
->bi_size
>> 9 : 0)
705 blk_fill_rwbs(rwbs
, bio
? bio
->bi_rw
: 0,
706 bio
? bio
->bi_size
>> 9 : 0)
707 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
708 tp_assign(tid
, current
->pid
)
709 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
712 TP_printk("%d,%d %s %llu + %u [%s] %d",
713 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
714 __print_rwbs_flags(__entry
->rwbs
),
715 (unsigned long long)__entry
->sector
,
716 __entry
->nr_sector
, __entry
->comm
, __entry
->tid
)
720 * block_getrq - get a free request entry in queue for block IO operations
721 * @q: queue for operations
722 * @bio: pending block IO operation
723 * @rw: low bit indicates a read (%0) or a write (%1)
725 * A request struct for queue @q has been allocated to handle the
726 * block IO operation @bio.
728 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_getrq
,
730 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
736 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
737 * @q: queue for operation
738 * @bio: pending block IO operation
739 * @rw: low bit indicates a read (%0) or a write (%1)
741 * In the case where a request struct cannot be provided for queue @q
742 * the process needs to wait for an request struct to become
743 * available. This tracepoint event is generated each time the
744 * process goes to sleep waiting for request struct become available.
746 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_sleeprq
,
748 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
754 * block_plug - keep operations requests in request queue
755 * @q: request queue to plug
757 * Plug the request queue @q. Do not allow block operation requests
758 * to be sent to the device driver. Instead, accumulate requests in
759 * the queue to improve throughput performance of the block device.
761 LTTNG_TRACEPOINT_EVENT(block_plug
,
763 TP_PROTO(struct request_queue
*q
),
768 __field( pid_t
, tid
)
769 __array_text( char, comm
, TASK_COMM_LEN
)
773 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
774 tp_assign(tid
, current
->pid
)
777 TP_printk("[%s] %d", __entry
->comm
, __entry
->tid
)
780 LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug
,
782 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
783 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
785 TP_ARGS(q
, depth
, explicit),
787 TP_PROTO(struct request_queue
*q
),
793 __field( int, nr_rq
)
794 __field( pid_t
, tid
)
795 __array_text( char, comm
, TASK_COMM_LEN
)
799 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
800 tp_assign(nr_rq
, depth
)
802 tp_assign(nr_rq
, q
->rq
.count
[READ
] + q
->rq
.count
[WRITE
])
804 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
805 tp_assign(tid
, current
->pid
)
808 TP_printk("[%s] %d %d", __entry
->comm
, , __entry
->tid
,
812 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
814 * block_unplug_timer - timed release of operations requests in queue to device driver
815 * @q: request queue to unplug
817 * Unplug the request queue @q because a timer expired and allow block
818 * operation requests to be sent to the device driver.
820 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_timer
,
822 TP_PROTO(struct request_queue
*q
),
829 * block_unplug - release of operations requests in request queue
830 * @q: request queue to unplug
831 * @depth: number of requests just added to the queue
832 * @explicit: whether this was an explicit unplug, or one from schedule()
834 * Unplug request queue @q because device driver is scheduled to work
835 * on elements in the request queue.
837 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
838 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug
,
840 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_io
,
843 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
844 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
846 TP_ARGS(q
, depth
, explicit)
848 TP_PROTO(struct request_queue
*q
),
855 * block_split - split a single bio struct into two bio structs
856 * @q: queue containing the bio
857 * @bio: block operation being split
858 * @new_sector: The starting sector for the new bio
860 * The bio request @bio in request queue @q needs to be split into two
861 * bio requests. The newly created @bio request starts at
862 * @new_sector. This split may be required due to hardware limitation
863 * such as operation crossing device boundaries in a RAID system.
865 LTTNG_TRACEPOINT_EVENT(block_split
,
867 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
868 unsigned int new_sector
),
870 TP_ARGS(q
, bio
, new_sector
),
873 __field( dev_t
, dev
)
874 __field( sector_t
, sector
)
875 __field( sector_t
, new_sector
)
876 __field( unsigned int, rwbs
)
877 __field( pid_t
, tid
)
878 __array_text( char, comm
, TASK_COMM_LEN
)
882 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
883 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
884 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
885 tp_assign(new_sector
, new_sector
)
886 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
887 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
888 tp_assign(tid
, current
->pid
)
889 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
890 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
891 tp_assign(sector
, bio
->bi_sector
)
892 tp_assign(new_sector
, new_sector
)
893 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
894 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
895 tp_assign(tid
, current
->pid
)
896 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
899 TP_printk("%d,%d %s %llu / %llu [%s] %d",
900 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
901 __print_rwbs_flags(__entry
->rwbs
),
902 (unsigned long long)__entry
->sector
,
903 (unsigned long long)__entry
->new_sector
,
904 __entry
->comm
, __entry
->tid
)
908 * block_bio_remap - map request for a logical device to the raw device
909 * @q: queue holding the operation
910 * @bio: revised operation
911 * @dev: device for the operation
912 * @from: original sector for the operation
914 * An operation for a logical device has been mapped to the
917 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
918 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
920 LTTNG_TRACEPOINT_EVENT(block_remap
,
923 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
926 TP_ARGS(q
, bio
, dev
, from
),
929 __field( dev_t
, dev
)
930 __field( sector_t
, sector
)
931 __field( unsigned int, nr_sector
)
932 __field( dev_t
, old_dev
)
933 __field( sector_t
, old_sector
)
934 __field( unsigned int, rwbs
)
938 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
939 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
940 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
941 tp_assign(nr_sector
, bio_sectors(bio
))
942 tp_assign(old_dev
, dev
)
943 tp_assign(old_sector
, from
)
944 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
945 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
946 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
947 tp_assign(sector
, bio
->bi_sector
)
948 tp_assign(nr_sector
, bio
->bi_size
>> 9)
949 tp_assign(old_dev
, dev
)
950 tp_assign(old_sector
, from
)
951 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
952 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
955 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
956 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
957 __print_rwbs_flags(__entry
->rwbs
),
958 (unsigned long long)__entry
->sector
,
960 MAJOR(__entry
->old_dev
), MINOR(__entry
->old_dev
),
961 (unsigned long long)__entry
->old_sector
)
964 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
966 * block_rq_remap - map request for a block operation request
967 * @q: queue holding the operation
968 * @rq: block IO operation request
969 * @dev: device for the operation
970 * @from: original sector for the operation
972 * The block operation request @rq in @q has been remapped. The block
973 * operation request @rq holds the current information and @from hold
974 * the original sector.
976 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
978 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
981 TP_ARGS(q
, rq
, dev
, from
),
984 __field( dev_t
, dev
)
985 __field( sector_t
, sector
)
986 __field( unsigned int, nr_sector
)
987 __field( dev_t
, old_dev
)
988 __field( sector_t
, old_sector
)
989 __field( unsigned int, rwbs
)
993 tp_assign(dev
, disk_devt(rq
->rq_disk
))
994 tp_assign(sector
, blk_rq_pos(rq
))
995 tp_assign(nr_sector
, blk_rq_sectors(rq
))
996 tp_assign(old_dev
, dev
)
997 tp_assign(old_sector
, from
)
998 blk_fill_rwbs(rwbs
, rq
->cmd_flags
, blk_rq_bytes(rq
))
1001 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
1002 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
1003 __print_rwbs_flags(__entry
->rwbs
),
1004 (unsigned long long)__entry
->sector
,
1006 MAJOR(__entry
->old_dev
), MINOR(__entry
->old_dev
),
1007 (unsigned long long)__entry
->old_sector
)
1011 #undef __print_rwbs_flags
1012 #undef blk_fill_rwbs
1014 #endif /* LTTNG_TRACE_BLOCK_H */
1016 /* This part must be outside protection */
1017 #include "../../../probes/define_trace.h"
This page took 0.056389 seconds and 5 git commands to generate.