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>
13 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
14 #include <scsi/scsi_request.h>
15 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
17 #ifndef _TRACE_BLOCK_DEF_
18 #define _TRACE_BLOCK_DEF_
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),
31 RWBS_FLAG_PREFLUSH
= (1 << 10),
34 #endif /* _TRACE_BLOCK_DEF_ */
36 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0) || \
37 LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,114,92,0,0))
39 #define lttng_req_op(rq) req_op(rq)
40 #define lttng_req_rw(rq) ((rq)->cmd_flags)
41 #define lttng_bio_op(bio) bio_op(bio)
42 #define lttng_bio_rw(bio) ((bio)->bi_opf)
44 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
45 ctf_integer(type, rwbs, \
46 (((op) == REQ_OP_WRITE || (op) == REQ_OP_WRITE_SAME) ? RWBS_FLAG_WRITE : \
47 ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
48 ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
49 ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
50 ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
52 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
53 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
54 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
55 | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
56 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
58 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
60 #define lttng_req_op(rq)
61 #define lttng_req_rw(rq) ((rq)->cmd_flags)
62 #define lttng_bio_op(bio)
63 #define lttng_bio_rw(bio) ((bio)->bi_rw)
65 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
66 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
67 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
68 ( (bytes) ? RWBS_FLAG_READ : \
70 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
71 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
72 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
73 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \
74 | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \
75 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
77 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
79 #define lttng_req_op(rq)
80 #define lttng_req_rw(rq) ((rq)->cmd_flags)
81 #define lttng_bio_op(bio)
82 #define lttng_bio_rw(bio) ((bio)->bi_rw)
84 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
85 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
86 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
87 ( (bytes) ? RWBS_FLAG_READ : \
89 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
90 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
91 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
92 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
94 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
96 #define lttng_req_op(rq)
97 #define lttng_req_rw(rq) ((rq)->cmd_flags)
98 #define lttng_bio_op(bio)
99 #define lttng_bio_rw(bio) ((bio)->bi_rw)
101 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
102 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
103 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
104 ( (bytes) ? RWBS_FLAG_READ : \
106 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
107 | ((rw) & REQ_HARDBARRIER ? RWBS_FLAG_BARRIER : 0) \
108 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
109 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
110 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
114 #define lttng_req_op(rq)
115 #define lttng_req_rw(rq) ((rq)->cmd_flags)
116 #define lttng_bio_op(bio)
117 #define lttng_bio_rw(bio) ((bio)->bi_rw)
119 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
120 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
121 ( (rw) & (1 << BIO_RW_DISCARD) ? RWBS_FLAG_DISCARD : \
122 ( (bytes) ? RWBS_FLAG_READ : \
124 | ((rw) & (1 << BIO_RW_AHEAD) ? RWBS_FLAG_RAHEAD : 0) \
125 | ((rw) & (1 << BIO_RW_SYNCIO) ? RWBS_FLAG_SYNC : 0) \
126 | ((rw) & (1 << BIO_RW_META) ? RWBS_FLAG_META : 0) \
127 | ((rw) & (1 << BIO_RW_BARRIER) ? RWBS_FLAG_BARRIER : 0))
131 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
132 LTTNG_TRACEPOINT_EVENT_CLASS(block_buffer
,
134 TP_PROTO(struct buffer_head
*bh
),
139 ctf_integer(dev_t
, dev
, bh
->b_bdev
->bd_dev
)
140 ctf_integer(sector_t
, sector
, bh
->b_blocknr
)
141 ctf_integer(size_t, size
, bh
->b_size
)
146 * block_touch_buffer - mark a buffer accessed
147 * @bh: buffer_head being touched
149 * Called from touch_buffer().
151 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_touch_buffer
,
153 TP_PROTO(struct buffer_head
*bh
),
159 * block_dirty_buffer - mark a buffer dirty
160 * @bh: buffer_head being dirtied
162 * Called from mark_buffer_dirty().
164 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_dirty_buffer
,
166 TP_PROTO(struct buffer_head
*bh
),
172 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
173 /* block_rq_with_error event class removed in kernel 4.12 */
174 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
175 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
177 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
183 unsigned int nr_sector
;
189 if (blk_rq_is_scsi(rq
)) {
190 struct scsi_request
*scsi_rq
= scsi_req(rq
);
191 tp_locvar
->sector
= 0;
192 tp_locvar
->nr_sector
= 0;
193 tp_locvar
->cmd
= scsi_rq
->cmd
;
194 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
196 tp_locvar
->sector
= blk_rq_pos(rq
);
197 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
198 tp_locvar
->cmd
= NULL
;
199 tp_locvar
->cmd_len
= 0;
204 ctf_integer(dev_t
, dev
,
205 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
206 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
207 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
208 ctf_integer(int, errors
, rq
->errors
)
209 blk_rwbs_ctf_integer(unsigned int, rwbs
,
210 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
211 ctf_sequence_hex(unsigned char, cmd
,
212 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
217 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
218 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
220 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
226 unsigned int nr_sector
;
233 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
234 tp_locvar
->sector
= 0;
235 tp_locvar
->nr_sector
= 0;
236 tp_locvar
->cmd
= rq
->cmd
;
237 tp_locvar
->cmd_len
= rq
->cmd_len
;
239 tp_locvar
->sector
= blk_rq_pos(rq
);
240 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
241 tp_locvar
->cmd
= NULL
;
242 tp_locvar
->cmd_len
= 0;
247 ctf_integer(dev_t
, dev
,
248 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
249 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
250 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
251 ctf_integer(int, errors
, rq
->errors
)
252 blk_rwbs_ctf_integer(unsigned int, rwbs
,
253 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
254 ctf_sequence_hex(unsigned char, cmd
,
255 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
260 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
262 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0))
264 * block_rq_abort - abort block operation request
265 * @q: queue containing the block operation request
266 * @rq: block IO operation request
268 * Called immediately after pending block IO operation request @rq in
269 * queue @q is aborted. The fields in the operation request @rq
270 * can be examined to determine which device and sectors the pending
271 * operation would access.
273 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_abort
,
275 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
282 * block_rq_requeue - place block IO request back on a queue
283 * @q: queue holding operation
284 * @rq: block IO operation request
286 * The block operation request @rq is being placed back into queue
287 * @q. For some reason the request was not completed and needs to be
288 * put back in the queue.
290 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
291 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
293 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
298 ctf_integer(dev_t
, dev
,
299 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
300 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
301 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
302 blk_rwbs_ctf_integer(unsigned int, rwbs
,
303 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
307 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_requeue
,
309 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
316 * block_rq_complete - block IO operation completed by device driver
317 * @q: queue containing the block operation request
318 * @rq: block operations request
319 * @nr_bytes: number of completed bytes
321 * The block_rq_complete tracepoint event indicates that some portion
322 * of operation request has been completed by the device driver. If
323 * the @rq->bio is %NULL, then there is absolutely no additional work to
324 * do for the request. If @rq->bio is non-NULL then there is
325 * additional work required to complete the request.
327 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
328 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
330 TP_PROTO(struct request
*rq
, int error
, unsigned int nr_bytes
),
332 TP_ARGS(rq
, error
, nr_bytes
),
335 ctf_integer(dev_t
, dev
,
336 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
337 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
338 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
339 ctf_integer(int, error
, error
)
340 blk_rwbs_ctf_integer(unsigned int, rwbs
,
341 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
344 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
345 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
347 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
348 unsigned int nr_bytes
),
350 TP_ARGS(q
, rq
, nr_bytes
),
358 if (blk_rq_is_scsi(rq
)) {
359 struct scsi_request
*scsi_rq
= scsi_req(rq
);
360 tp_locvar
->cmd
= scsi_rq
->cmd
;
361 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
363 tp_locvar
->cmd
= NULL
;
364 tp_locvar
->cmd_len
= 0;
369 ctf_integer(dev_t
, dev
,
370 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
371 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
372 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
373 ctf_integer(int, errors
, rq
->errors
)
374 blk_rwbs_ctf_integer(unsigned int, rwbs
,
375 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
376 ctf_sequence_hex(unsigned char, cmd
,
377 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
382 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,5) \
383 || LTTNG_KERNEL_RANGE(3,12,21, 3,13,0) \
384 || LTTNG_KERNEL_RANGE(3,10,41, 3,11,0) \
385 || LTTNG_KERNEL_RANGE(3,4,91, 3,5,0) \
386 || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0) \
387 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,28, 3,14,0,0) \
388 || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0))
390 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
392 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
393 unsigned int nr_bytes
),
395 TP_ARGS(q
, rq
, nr_bytes
),
403 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
404 tp_locvar
->cmd
= rq
->cmd
;
405 tp_locvar
->cmd_len
= rq
->cmd_len
;
407 tp_locvar
->cmd
= NULL
;
408 tp_locvar
->cmd_len
= 0;
413 ctf_integer(dev_t
, dev
,
414 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
415 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
416 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
417 ctf_integer(int, errors
, rq
->errors
)
418 blk_rwbs_ctf_integer(unsigned int, rwbs
,
419 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
420 ctf_sequence_hex(unsigned char, cmd
,
421 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
427 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
430 * block_rq_complete - block IO operation completed by device driver
431 * @q: queue containing the block operation request
432 * @rq: block operations request
434 * The block_rq_complete tracepoint event indicates that some portion
435 * of operation request has been completed by the device driver. If
436 * the @rq->bio is %NULL, then there is absolutely no additional work to
437 * do for the request. If @rq->bio is non-NULL then there is
438 * additional work required to complete the request.
440 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_complete
,
442 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
447 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
449 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
450 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
452 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
457 ctf_integer(dev_t
, dev
,
458 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
459 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
460 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
461 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
462 ctf_integer(pid_t
, tid
, current
->pid
)
463 blk_rwbs_ctf_integer(unsigned int, rwbs
,
464 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
465 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
468 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
469 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
471 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
477 unsigned int nr_sector
;
484 if (blk_rq_is_scsi(rq
)) {
485 struct scsi_request
*scsi_rq
= scsi_req(rq
);
486 tp_locvar
->sector
= 0;
487 tp_locvar
->nr_sector
= 0;
488 tp_locvar
->bytes
= scsi_rq
->resid_len
;
489 tp_locvar
->cmd
= scsi_rq
->cmd
;
490 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
492 tp_locvar
->sector
= blk_rq_pos(rq
);
493 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
494 tp_locvar
->bytes
= 0;
495 tp_locvar
->cmd
= NULL
;
496 tp_locvar
->cmd_len
= 0;
501 ctf_integer(dev_t
, dev
,
502 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
503 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
504 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
505 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
506 ctf_integer(pid_t
, tid
, current
->pid
)
507 blk_rwbs_ctf_integer(unsigned int, rwbs
,
508 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
509 ctf_sequence_hex(unsigned char, cmd
,
510 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
511 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
516 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
517 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
519 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
525 unsigned int nr_sector
;
532 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
533 tp_locvar
->sector
= 0;
534 tp_locvar
->nr_sector
= 0;
535 tp_locvar
->bytes
= blk_rq_bytes(rq
);
536 tp_locvar
->cmd
= rq
->cmd
;
537 tp_locvar
->cmd_len
= rq
->cmd_len
;
539 tp_locvar
->sector
= blk_rq_pos(rq
);
540 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
541 tp_locvar
->bytes
= 0;
542 tp_locvar
->cmd
= NULL
;
543 tp_locvar
->cmd_len
= 0;
548 ctf_integer(dev_t
, dev
,
549 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
550 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
551 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
552 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
553 ctf_integer(pid_t
, tid
, current
->pid
)
554 blk_rwbs_ctf_integer(unsigned int, rwbs
,
555 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
556 ctf_sequence_hex(unsigned char, cmd
,
557 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
558 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
563 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
566 * block_rq_insert - insert block operation request into queue
568 * @rq: block IO operation request
570 * Called immediately before block operation request @rq is inserted
571 * into queue @q. The fields in the operation request @rq struct can
572 * be examined to determine which device and sectors the pending
573 * operation would access.
575 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
577 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
583 * block_rq_issue - issue pending block IO request operation to device driver
584 * @q: queue holding operation
585 * @rq: block IO operation operation request
587 * Called when block operation request @rq from queue @q is sent to a
588 * device driver for processing.
590 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
592 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
598 * block_bio_bounce - used bounce buffer when processing block operation
599 * @q: queue holding the block operation
600 * @bio: block operation
602 * A bounce buffer was used to handle the block operation @bio in @q.
603 * This occurs when hardware limitations prevent a direct transfer of
604 * data between the @bio data memory area and the IO device. Use of a
605 * bounce buffer requires extra copying of data and decreases
608 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
610 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
615 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
616 ctf_integer(dev_t
, dev
, bio_dev(bio
))
618 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
620 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
621 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
622 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
623 blk_rwbs_ctf_integer(unsigned int, rwbs
,
624 lttng_bio_op(bio
), lttng_bio_rw(bio
),
625 bio
->bi_iter
.bi_size
)
626 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
627 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
628 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
629 blk_rwbs_ctf_integer(unsigned int, rwbs
,
630 lttng_bio_op(bio
), lttng_bio_rw(bio
),
632 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
633 ctf_integer(pid_t
, tid
, current
->pid
)
634 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
639 * block_bio_complete - completed all work on the block operation
640 * @q: queue holding the block operation
641 * @bio: block operation completed
642 * @error: io error value
644 * This tracepoint indicates there is no further work to do on this
645 * block IO operation @bio.
647 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
649 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
650 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
652 TP_ARGS(q
, bio
, error
),
654 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
660 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
661 ctf_integer(dev_t
, dev
, bio_dev(bio
))
663 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
665 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
666 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
667 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
668 ctf_integer(int, error
, error
)
669 blk_rwbs_ctf_integer(unsigned int, rwbs
,
670 lttng_bio_op(bio
), lttng_bio_rw(bio
),
671 bio
->bi_iter
.bi_size
)
672 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
673 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
674 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
675 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
676 ctf_integer(int, error
, error
)
678 ctf_integer(int, error
, 0)
680 blk_rwbs_ctf_integer(unsigned int, rwbs
,
681 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
682 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
686 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
687 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
689 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
694 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
695 ctf_integer(dev_t
, dev
, bio_dev(bio
))
697 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
699 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
700 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
701 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
702 blk_rwbs_ctf_integer(unsigned int, rwbs
,
703 lttng_bio_op(bio
), lttng_bio_rw(bio
),
704 bio
->bi_iter
.bi_size
)
705 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
706 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
707 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
708 blk_rwbs_ctf_integer(unsigned int, rwbs
,
709 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
710 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
711 ctf_integer(pid_t
, tid
, current
->pid
)
712 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
717 * block_bio_backmerge - merging block operation to the end of an existing operation
718 * @q: queue holding operation
719 * @bio: new block operation to merge
721 * Merging block request @bio to the end of an existing block request
724 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_backmerge
,
726 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
732 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
733 * @q: queue holding operation
734 * @bio: new block operation to merge
736 * Merging block IO operation @bio to the beginning of an existing block
737 * operation in queue @q.
739 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_frontmerge
,
741 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
747 * block_bio_queue - putting new block IO operation in queue
748 * @q: queue holding operation
749 * @bio: new block operation
751 * About to place the block IO operation @bio into queue @q.
753 LTTNG_TRACEPOINT_EVENT(block_bio_queue
,
755 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
760 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
761 ctf_integer(dev_t
, dev
, bio_dev(bio
))
763 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
765 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
766 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
767 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
768 blk_rwbs_ctf_integer(unsigned int, rwbs
,
769 lttng_bio_op(bio
), lttng_bio_rw(bio
),
770 bio
->bi_iter
.bi_size
)
771 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
772 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
773 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
774 blk_rwbs_ctf_integer(unsigned int, rwbs
,
775 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
776 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
777 ctf_integer(pid_t
, tid
, current
->pid
)
778 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
781 #else /* if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
782 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
784 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
789 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
790 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
791 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
792 blk_rwbs_ctf_integer(unsigned int, rwbs
,
793 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
794 ctf_integer(pid_t
, tid
, current
->pid
)
795 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
800 * block_bio_backmerge - merging block operation to the end of an existing operation
801 * @q: queue holding operation
802 * @bio: new block operation to merge
804 * Merging block request @bio to the end of an existing block request
807 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
809 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
815 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
816 * @q: queue holding operation
817 * @bio: new block operation to merge
819 * Merging block IO operation @bio to the beginning of an existing block
820 * operation in queue @q.
822 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
824 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
830 * block_bio_queue - putting new block IO operation in queue
831 * @q: queue holding operation
832 * @bio: new block operation
834 * About to place the block IO operation @bio into queue @q.
836 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
838 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
842 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
844 LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq
,
846 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
851 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
852 ctf_integer(dev_t
, dev
, bio
? bio_dev(bio
) : 0)
854 ctf_integer(dev_t
, dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
856 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
857 ctf_integer(sector_t
, sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
858 ctf_integer(unsigned int, nr_sector
,
859 bio
? bio_sectors(bio
) : 0)
860 blk_rwbs_ctf_integer(unsigned int, rwbs
,
861 bio
? lttng_bio_op(bio
) : 0,
862 bio
? lttng_bio_rw(bio
) : 0,
863 bio
? bio
->bi_iter
.bi_size
: 0)
864 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
865 ctf_integer(sector_t
, sector
, bio
? bio
->bi_sector
: 0)
866 ctf_integer(unsigned int, nr_sector
,
867 bio
? bio
->bi_size
>> 9 : 0)
868 blk_rwbs_ctf_integer(unsigned int, rwbs
,
869 bio
? lttng_bio_op(bio
) : 0,
870 bio
? lttng_bio_rw(bio
) : 0,
871 bio
? bio
->bi_size
: 0)
872 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
873 ctf_integer(pid_t
, tid
, current
->pid
)
874 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
879 * block_getrq - get a free request entry in queue for block IO operations
880 * @q: queue for operations
881 * @bio: pending block IO operation (can be %NULL)
882 * @rw: low bit indicates a read (%0) or a write (%1)
884 * A request struct for queue @q has been allocated to handle the
885 * block IO operation @bio.
887 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_getrq
,
889 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
895 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
896 * @q: queue for operation
897 * @bio: pending block IO operation (can be %NULL)
898 * @rw: low bit indicates a read (%0) or a write (%1)
900 * In the case where a request struct cannot be provided for queue @q
901 * the process needs to wait for an request struct to become
902 * available. This tracepoint event is generated each time the
903 * process goes to sleep waiting for request struct become available.
905 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_sleeprq
,
907 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
913 * block_plug - keep operations requests in request queue
914 * @q: request queue to plug
916 * Plug the request queue @q. Do not allow block operation requests
917 * to be sent to the device driver. Instead, accumulate requests in
918 * the queue to improve throughput performance of the block device.
920 LTTNG_TRACEPOINT_EVENT(block_plug
,
922 TP_PROTO(struct request_queue
*q
),
927 ctf_integer(pid_t
, tid
, current
->pid
)
928 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
932 LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug
,
934 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
935 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
937 TP_ARGS(q
, depth
, explicit),
939 TP_PROTO(struct request_queue
*q
),
945 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
946 ctf_integer(int, nr_rq
, depth
)
948 ctf_integer(int, nr_rq
, q
->rq
.count
[READ
] + q
->rq
.count
[WRITE
])
950 ctf_integer(pid_t
, tid
, current
->pid
)
951 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
955 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
957 * block_unplug_timer - timed release of operations requests in queue to device driver
958 * @q: request queue to unplug
960 * Unplug the request queue @q because a timer expired and allow block
961 * operation requests to be sent to the device driver.
963 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_timer
,
965 TP_PROTO(struct request_queue
*q
),
972 * block_unplug - release of operations requests in request queue
973 * @q: request queue to unplug
974 * @depth: number of requests just added to the queue
975 * @explicit: whether this was an explicit unplug, or one from schedule()
977 * Unplug request queue @q because device driver is scheduled to work
978 * on elements in the request queue.
980 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
981 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug
,
983 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_io
,
986 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
987 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
989 TP_ARGS(q
, depth
, explicit)
991 TP_PROTO(struct request_queue
*q
),
998 * block_split - split a single bio struct into two bio structs
999 * @q: queue containing the bio
1000 * @bio: block operation being split
1001 * @new_sector: The starting sector for the new bio
1003 * The bio request @bio in request queue @q needs to be split into two
1004 * bio requests. The newly created @bio request starts at
1005 * @new_sector. This split may be required due to hardware limitation
1006 * such as operation crossing device boundaries in a RAID system.
1008 LTTNG_TRACEPOINT_EVENT(block_split
,
1010 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1011 unsigned int new_sector
),
1013 TP_ARGS(q
, bio
, new_sector
),
1016 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
1017 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1019 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1021 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
1022 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1023 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1024 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1025 bio
->bi_iter
.bi_size
)
1026 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1027 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1028 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1029 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1030 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1031 ctf_integer(sector_t
, new_sector
, new_sector
)
1032 ctf_integer(pid_t
, tid
, current
->pid
)
1033 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1038 * block_bio_remap - map request for a logical device to the raw device
1039 * @q: queue holding the operation
1040 * @bio: revised operation
1041 * @dev: device for the operation
1042 * @from: original sector for the operation
1044 * An operation for a logical device has been mapped to the
1047 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
1048 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1050 LTTNG_TRACEPOINT_EVENT(block_remap
,
1053 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1056 TP_ARGS(q
, bio
, dev
, from
),
1059 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
1060 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1062 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1064 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
1065 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1066 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1067 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1068 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1069 bio
->bi_iter
.bi_size
)
1070 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1071 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1072 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1073 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1074 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1075 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1076 ctf_integer(dev_t
, old_dev
, dev
)
1077 ctf_integer(sector_t
, old_sector
, from
)
1081 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
1083 * block_rq_remap - map request for a block operation request
1084 * @q: queue holding the operation
1085 * @rq: block IO operation request
1086 * @dev: device for the operation
1087 * @from: original sector for the operation
1089 * The block operation request @rq in @q has been remapped. The block
1090 * operation request @rq holds the current information and @from hold
1091 * the original sector.
1093 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1095 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
1098 TP_ARGS(q
, rq
, dev
, from
),
1101 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1102 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1103 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1104 ctf_integer(dev_t
, old_dev
, dev
)
1105 ctf_integer(sector_t
, old_sector
, from
)
1106 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1107 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1112 #undef __print_rwbs_flags
1113 #undef blk_fill_rwbs
1115 #endif /* LTTNG_TRACE_BLOCK_H */
1117 /* This part must be outside protection */
1118 #include <probes/define_trace.h>
This page took 0.0543 seconds and 4 git commands to generate.