1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM block
5 #if !defined(LTTNG_TRACE_BLOCK_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define LTTNG_TRACE_BLOCK_H
8 #include <probes/lttng-tracepoint-event.h>
9 #include <linux/blktrace_api.h>
10 #include <linux/blkdev.h>
11 #include <linux/trace_seq.h>
12 #include <linux/version.h>
14 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
15 #include <scsi/scsi_request.h>
16 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
18 #ifndef _TRACE_BLOCK_DEF_
19 #define _TRACE_BLOCK_DEF_
22 RWBS_FLAG_WRITE
= (1 << 0),
23 RWBS_FLAG_DISCARD
= (1 << 1),
24 RWBS_FLAG_READ
= (1 << 2),
25 RWBS_FLAG_RAHEAD
= (1 << 3),
26 RWBS_FLAG_BARRIER
= (1 << 4),
27 RWBS_FLAG_SYNC
= (1 << 5),
28 RWBS_FLAG_META
= (1 << 6),
29 RWBS_FLAG_SECURE
= (1 << 7),
30 RWBS_FLAG_FLUSH
= (1 << 8),
31 RWBS_FLAG_FUA
= (1 << 9),
32 RWBS_FLAG_PREFLUSH
= (1 << 10),
35 #endif /* _TRACE_BLOCK_DEF_ */
37 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0) || \
38 LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
39 LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
40 LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
41 LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,4,103,7,0,0) || \
42 LTTNG_SLE_KERNEL_RANGE(4,4,114,94,0,0, 4,4,114,95,0,0) || \
43 LTTNG_SLE_KERNEL_RANGE(4,4,120,94,0,0, 4,4,120,95,0,0) || \
44 LTTNG_SLE_KERNEL_RANGE(4,4,126,94,0,0, 4,5,0,0,0,0))
46 #define lttng_req_op(rq) req_op(rq)
47 #define lttng_req_rw(rq) ((rq)->cmd_flags)
48 #define lttng_bio_op(bio) bio_op(bio)
49 #define lttng_bio_rw(bio) ((bio)->bi_opf)
51 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
52 ctf_integer(type, rwbs, \
53 (((op) == REQ_OP_WRITE || (op) == REQ_OP_WRITE_SAME) ? RWBS_FLAG_WRITE : \
54 ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
55 ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
56 ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
57 ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
59 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
60 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
61 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
62 | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
63 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
65 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
67 #define lttng_req_op(rq)
68 #define lttng_req_rw(rq) ((rq)->cmd_flags)
69 #define lttng_bio_op(bio)
70 #define lttng_bio_rw(bio) ((bio)->bi_rw)
72 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
73 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
74 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
75 ( (bytes) ? RWBS_FLAG_READ : \
77 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
78 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
79 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
80 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \
81 | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \
82 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
84 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
86 #define lttng_req_op(rq)
87 #define lttng_req_rw(rq) ((rq)->cmd_flags)
88 #define lttng_bio_op(bio)
89 #define lttng_bio_rw(bio) ((bio)->bi_rw)
91 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
92 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
93 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
94 ( (bytes) ? RWBS_FLAG_READ : \
96 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
97 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
98 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
99 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
101 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
103 #define lttng_req_op(rq)
104 #define lttng_req_rw(rq) ((rq)->cmd_flags)
105 #define lttng_bio_op(bio)
106 #define lttng_bio_rw(bio) ((bio)->bi_rw)
108 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
109 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
110 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
111 ( (bytes) ? RWBS_FLAG_READ : \
113 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
114 | ((rw) & REQ_HARDBARRIER ? RWBS_FLAG_BARRIER : 0) \
115 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
116 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
117 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
121 #define lttng_req_op(rq)
122 #define lttng_req_rw(rq) ((rq)->cmd_flags)
123 #define lttng_bio_op(bio)
124 #define lttng_bio_rw(bio) ((bio)->bi_rw)
126 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
127 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
128 ( (rw) & (1 << BIO_RW_DISCARD) ? RWBS_FLAG_DISCARD : \
129 ( (bytes) ? RWBS_FLAG_READ : \
131 | ((rw) & (1 << BIO_RW_AHEAD) ? RWBS_FLAG_RAHEAD : 0) \
132 | ((rw) & (1 << BIO_RW_SYNCIO) ? RWBS_FLAG_SYNC : 0) \
133 | ((rw) & (1 << BIO_RW_META) ? RWBS_FLAG_META : 0) \
134 | ((rw) & (1 << BIO_RW_BARRIER) ? RWBS_FLAG_BARRIER : 0))
138 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
139 LTTNG_TRACEPOINT_EVENT_CLASS(block_buffer
,
141 TP_PROTO(struct buffer_head
*bh
),
146 ctf_integer(dev_t
, dev
, bh
->b_bdev
->bd_dev
)
147 ctf_integer(sector_t
, sector
, bh
->b_blocknr
)
148 ctf_integer(size_t, size
, bh
->b_size
)
153 * block_touch_buffer - mark a buffer accessed
154 * @bh: buffer_head being touched
156 * Called from touch_buffer().
158 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_touch_buffer
,
160 TP_PROTO(struct buffer_head
*bh
),
166 * block_dirty_buffer - mark a buffer dirty
167 * @bh: buffer_head being dirtied
169 * Called from mark_buffer_dirty().
171 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_dirty_buffer
,
173 TP_PROTO(struct buffer_head
*bh
),
179 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
180 /* block_rq_with_error event class removed in kernel 4.12 */
181 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
182 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
184 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
190 unsigned int nr_sector
;
196 if (blk_rq_is_scsi(rq
)) {
197 struct scsi_request
*scsi_rq
= scsi_req(rq
);
198 tp_locvar
->sector
= 0;
199 tp_locvar
->nr_sector
= 0;
200 tp_locvar
->cmd
= scsi_rq
->cmd
;
201 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
203 tp_locvar
->sector
= blk_rq_pos(rq
);
204 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
205 tp_locvar
->cmd
= NULL
;
206 tp_locvar
->cmd_len
= 0;
211 ctf_integer(dev_t
, dev
,
212 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
213 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
214 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
215 ctf_integer(int, errors
, rq
->errors
)
216 blk_rwbs_ctf_integer(unsigned int, rwbs
,
217 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
218 ctf_sequence_hex(unsigned char, cmd
,
219 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
224 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
225 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
227 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
233 unsigned int nr_sector
;
240 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
241 tp_locvar
->sector
= 0;
242 tp_locvar
->nr_sector
= 0;
243 tp_locvar
->cmd
= rq
->cmd
;
244 tp_locvar
->cmd_len
= rq
->cmd_len
;
246 tp_locvar
->sector
= blk_rq_pos(rq
);
247 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
248 tp_locvar
->cmd
= NULL
;
249 tp_locvar
->cmd_len
= 0;
254 ctf_integer(dev_t
, dev
,
255 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
256 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
257 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
258 ctf_integer(int, errors
, rq
->errors
)
259 blk_rwbs_ctf_integer(unsigned int, rwbs
,
260 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
261 ctf_sequence_hex(unsigned char, cmd
,
262 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
267 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
269 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0))
271 * block_rq_abort - abort block operation request
272 * @q: queue containing the block operation request
273 * @rq: block IO operation request
275 * Called immediately after pending block IO operation request @rq in
276 * queue @q is aborted. The fields in the operation request @rq
277 * can be examined to determine which device and sectors the pending
278 * operation would access.
280 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_abort
,
282 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
288 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
290 * block_rq_requeue - place block IO request back on a queue
291 * @rq: block IO operation request
293 * The block operation request @rq is being placed back into queue
294 * @q. For some reason the request was not completed and needs to be
295 * put back in the queue.
297 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
299 TP_PROTO(struct request
*rq
),
304 ctf_integer(dev_t
, dev
,
305 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
306 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
307 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
308 blk_rwbs_ctf_integer(unsigned int, rwbs
,
309 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
312 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
314 * block_rq_requeue - place block IO request back on a queue
315 * @q: queue holding operation
316 * @rq: block IO operation request
318 * The block operation request @rq is being placed back into queue
319 * @q. For some reason the request was not completed and needs to be
320 * put back in the queue.
322 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
324 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
329 ctf_integer(dev_t
, dev
,
330 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
331 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
332 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
333 blk_rwbs_ctf_integer(unsigned int, rwbs
,
334 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
338 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_requeue
,
340 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
347 * block_rq_complete - block IO operation completed by device driver
348 * @q: queue containing the block operation request
349 * @rq: block operations request
350 * @nr_bytes: number of completed bytes
352 * The block_rq_complete tracepoint event indicates that some portion
353 * of operation request has been completed by the device driver. If
354 * the @rq->bio is %NULL, then there is absolutely no additional work to
355 * do for the request. If @rq->bio is non-NULL then there is
356 * additional work required to complete the request.
358 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
359 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
361 TP_PROTO(struct request
*rq
, int error
, unsigned int nr_bytes
),
363 TP_ARGS(rq
, error
, nr_bytes
),
366 ctf_integer(dev_t
, dev
,
367 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
368 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
369 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
370 ctf_integer(int, error
, error
)
371 blk_rwbs_ctf_integer(unsigned int, rwbs
,
372 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
375 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
376 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
378 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
379 unsigned int nr_bytes
),
381 TP_ARGS(q
, rq
, nr_bytes
),
389 if (blk_rq_is_scsi(rq
)) {
390 struct scsi_request
*scsi_rq
= scsi_req(rq
);
391 tp_locvar
->cmd
= scsi_rq
->cmd
;
392 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
394 tp_locvar
->cmd
= NULL
;
395 tp_locvar
->cmd_len
= 0;
400 ctf_integer(dev_t
, dev
,
401 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
402 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
403 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
404 ctf_integer(int, errors
, rq
->errors
)
405 blk_rwbs_ctf_integer(unsigned int, rwbs
,
406 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
407 ctf_sequence_hex(unsigned char, cmd
,
408 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
413 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,5) \
414 || LTTNG_KERNEL_RANGE(3,12,21, 3,13,0) \
415 || LTTNG_KERNEL_RANGE(3,10,41, 3,11,0) \
416 || LTTNG_KERNEL_RANGE(3,4,91, 3,5,0) \
417 || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0) \
418 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,28, 3,14,0,0) \
419 || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0))
421 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
423 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
424 unsigned int nr_bytes
),
426 TP_ARGS(q
, rq
, nr_bytes
),
434 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
435 tp_locvar
->cmd
= rq
->cmd
;
436 tp_locvar
->cmd_len
= rq
->cmd_len
;
438 tp_locvar
->cmd
= NULL
;
439 tp_locvar
->cmd_len
= 0;
444 ctf_integer(dev_t
, dev
,
445 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
446 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
447 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
448 ctf_integer(int, errors
, rq
->errors
)
449 blk_rwbs_ctf_integer(unsigned int, rwbs
,
450 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
451 ctf_sequence_hex(unsigned char, cmd
,
452 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
458 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
461 * block_rq_complete - block IO operation completed by device driver
462 * @q: queue containing the block operation request
463 * @rq: block operations request
465 * The block_rq_complete tracepoint event indicates that some portion
466 * of operation request has been completed by the device driver. If
467 * the @rq->bio is %NULL, then there is absolutely no additional work to
468 * do for the request. If @rq->bio is non-NULL then there is
469 * additional work required to complete the request.
471 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_complete
,
473 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
478 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
480 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
481 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
483 TP_PROTO(struct request
*rq
),
488 ctf_integer(dev_t
, dev
,
489 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
490 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
491 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
492 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
493 ctf_integer(pid_t
, tid
, current
->pid
)
494 blk_rwbs_ctf_integer(unsigned int, rwbs
,
495 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
496 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
499 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
500 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
502 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
507 ctf_integer(dev_t
, dev
,
508 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
509 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
510 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
511 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
512 ctf_integer(pid_t
, tid
, current
->pid
)
513 blk_rwbs_ctf_integer(unsigned int, rwbs
,
514 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
515 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
518 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
519 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
521 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
527 unsigned int nr_sector
;
534 if (blk_rq_is_scsi(rq
)) {
535 struct scsi_request
*scsi_rq
= scsi_req(rq
);
536 tp_locvar
->sector
= 0;
537 tp_locvar
->nr_sector
= 0;
538 tp_locvar
->bytes
= scsi_rq
->resid_len
;
539 tp_locvar
->cmd
= scsi_rq
->cmd
;
540 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
542 tp_locvar
->sector
= blk_rq_pos(rq
);
543 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
544 tp_locvar
->bytes
= 0;
545 tp_locvar
->cmd
= NULL
;
546 tp_locvar
->cmd_len
= 0;
551 ctf_integer(dev_t
, dev
,
552 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
553 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
554 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
555 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
556 ctf_integer(pid_t
, tid
, current
->pid
)
557 blk_rwbs_ctf_integer(unsigned int, rwbs
,
558 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
559 ctf_sequence_hex(unsigned char, cmd
,
560 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
561 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
566 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
567 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
569 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
575 unsigned int nr_sector
;
582 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
583 tp_locvar
->sector
= 0;
584 tp_locvar
->nr_sector
= 0;
585 tp_locvar
->bytes
= blk_rq_bytes(rq
);
586 tp_locvar
->cmd
= rq
->cmd
;
587 tp_locvar
->cmd_len
= rq
->cmd_len
;
589 tp_locvar
->sector
= blk_rq_pos(rq
);
590 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
591 tp_locvar
->bytes
= 0;
592 tp_locvar
->cmd
= NULL
;
593 tp_locvar
->cmd_len
= 0;
598 ctf_integer(dev_t
, dev
,
599 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
600 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
601 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
602 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
603 ctf_integer(pid_t
, tid
, current
->pid
)
604 blk_rwbs_ctf_integer(unsigned int, rwbs
,
605 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
606 ctf_sequence_hex(unsigned char, cmd
,
607 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
608 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
613 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
615 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
617 * block_rq_insert - insert block operation request into queue
618 * @rq: block IO operation request
620 * Called immediately before block operation request @rq is inserted
621 * into queue @q. The fields in the operation request @rq struct can
622 * be examined to determine which device and sectors the pending
623 * operation would access.
625 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
627 TP_PROTO(struct request
*rq
),
633 * block_rq_insert - insert block operation request into queue
635 * @rq: block IO operation request
637 * Called immediately before block operation request @rq is inserted
638 * into queue @q. The fields in the operation request @rq struct can
639 * be examined to determine which device and sectors the pending
640 * operation would access.
642 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
644 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
650 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
652 * block_rq_issue - issue pending block IO request operation to device driver
653 * @rq: block IO operation operation request
655 * Called when block operation request @rq from queue @q is sent to a
656 * device driver for processing.
658 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
660 TP_PROTO(struct request
*rq
),
666 * block_rq_issue - issue pending block IO request operation to device driver
667 * @q: queue holding operation
668 * @rq: block IO operation operation request
670 * Called when block operation request @rq from queue @q is sent to a
671 * device driver for processing.
673 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
675 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
681 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
683 * block_rq_merge - merge request with another one in the elevator
684 * @rq: block IO operation operation request
686 * Called when block operation request @rq from queue @q is merged to another
687 * request queued in the elevator.
689 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_merge
,
691 TP_PROTO(struct request
*rq
),
695 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
697 * block_rq_merge - merge request with another one in the elevator
698 * @q: queue holding operation
699 * @rq: block IO operation operation request
701 * Called when block operation request @rq from queue @q is merged to another
702 * request queued in the elevator.
704 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_merge
,
706 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
712 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
714 * block_bio_complete - completed all work on the block operation
715 * @q: queue holding the block operation
716 * @bio: block operation completed
717 * @error: io error value
719 * This tracepoint indicates there is no further work to do on this
720 * block IO operation @bio.
722 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
724 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
729 ctf_integer(dev_t
, dev
, bio_dev(bio
))
730 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
731 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
732 ctf_integer(int, error
, blk_status_to_errno(bio
->bi_status
))
733 blk_rwbs_ctf_integer(unsigned int, rwbs
,
734 lttng_bio_op(bio
), lttng_bio_rw(bio
),
735 bio
->bi_iter
.bi_size
)
738 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
740 * block_bio_complete - completed all work on the block operation
741 * @q: queue holding the block operation
742 * @bio: block operation completed
743 * @error: io error value
745 * This tracepoint indicates there is no further work to do on this
746 * block IO operation @bio.
748 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
750 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
752 TP_ARGS(q
, bio
, error
),
755 ctf_integer(dev_t
, dev
, bio_dev(bio
))
756 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
757 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
758 ctf_integer(int, error
, error
)
759 blk_rwbs_ctf_integer(unsigned int, rwbs
,
760 lttng_bio_op(bio
), lttng_bio_rw(bio
),
761 bio
->bi_iter
.bi_size
)
764 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
766 * block_bio_complete - completed all work on the block operation
767 * @q: queue holding the block operation
768 * @bio: block operation completed
769 * @error: io error value
771 * This tracepoint indicates there is no further work to do on this
772 * block IO operation @bio.
774 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
776 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
778 TP_ARGS(q
, bio
, error
),
781 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
782 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
783 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
784 ctf_integer(int, error
, error
)
785 blk_rwbs_ctf_integer(unsigned int, rwbs
,
786 lttng_bio_op(bio
), lttng_bio_rw(bio
),
787 bio
->bi_iter
.bi_size
)
790 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
792 * block_bio_complete - completed all work on the block operation
793 * @q: queue holding the block operation
794 * @bio: block operation completed
795 * @error: io error value
797 * This tracepoint indicates there is no further work to do on this
798 * block IO operation @bio.
800 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
802 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
804 TP_ARGS(q
, bio
, error
),
807 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
808 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
809 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
810 ctf_integer(int, error
, error
)
811 blk_rwbs_ctf_integer(unsigned int, rwbs
,
812 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
817 * block_bio_complete - completed all work on the block operation
818 * @q: queue holding the block operation
819 * @bio: block operation completed
820 * @error: io error value
822 * This tracepoint indicates there is no further work to do on this
823 * block IO operation @bio.
825 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
827 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
832 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
833 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
834 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
835 ctf_integer(int, error
, 0)
836 blk_rwbs_ctf_integer(unsigned int, rwbs
,
837 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
842 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
843 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
845 TP_PROTO(struct bio
*bio
),
850 ctf_integer(dev_t
, dev
, bio_dev(bio
))
851 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
852 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
853 blk_rwbs_ctf_integer(unsigned int, rwbs
,
854 lttng_bio_op(bio
), lttng_bio_rw(bio
),
855 bio
->bi_iter
.bi_size
)
856 ctf_integer(pid_t
, tid
, current
->pid
)
857 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
860 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
861 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
863 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
868 ctf_integer(dev_t
, dev
, bio_dev(bio
))
869 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
870 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
871 blk_rwbs_ctf_integer(unsigned int, rwbs
,
872 lttng_bio_op(bio
), lttng_bio_rw(bio
),
873 bio
->bi_iter
.bi_size
)
874 ctf_integer(pid_t
, tid
, current
->pid
)
875 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
878 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
879 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
881 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
886 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
887 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
888 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
889 blk_rwbs_ctf_integer(unsigned int, rwbs
,
890 lttng_bio_op(bio
), lttng_bio_rw(bio
),
891 bio
->bi_iter
.bi_size
)
892 ctf_integer(pid_t
, tid
, current
->pid
)
893 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
896 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
897 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
899 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
904 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
905 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
906 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
907 blk_rwbs_ctf_integer(unsigned int, rwbs
,
908 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
909 ctf_integer(pid_t
, tid
, current
->pid
)
910 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
917 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
919 * block_bio_bounce - used bounce buffer when processing block operation
920 * @bio: block operation
922 * A bounce buffer was used to handle the block operation @bio in @q.
923 * This occurs when hardware limitations prevent a direct transfer of
924 * data between the @bio data memory area and the IO device. Use of a
925 * bounce buffer requires extra copying of data and decreases
928 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_bounce
,
930 TP_PROTO(struct bio
*bio
),
934 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
936 * block_bio_bounce - used bounce buffer when processing block operation
937 * @q: queue holding the block operation
938 * @bio: block operation
940 * A bounce buffer was used to handle the block operation @bio in @q.
941 * This occurs when hardware limitations prevent a direct transfer of
942 * data between the @bio data memory area and the IO device. Use of a
943 * bounce buffer requires extra copying of data and decreases
946 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
948 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
953 ctf_integer(dev_t
, dev
, bio_dev(bio
))
954 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
955 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
956 blk_rwbs_ctf_integer(unsigned int, rwbs
,
957 lttng_bio_op(bio
), lttng_bio_rw(bio
),
958 bio
->bi_iter
.bi_size
)
959 ctf_integer(pid_t
, tid
, current
->pid
)
960 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
963 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
964 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
966 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
971 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
972 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
973 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
974 blk_rwbs_ctf_integer(unsigned int, rwbs
,
975 lttng_bio_op(bio
), lttng_bio_rw(bio
),
976 bio
->bi_iter
.bi_size
)
977 ctf_integer(pid_t
, tid
, current
->pid
)
978 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
982 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
984 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
989 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
990 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
991 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
992 blk_rwbs_ctf_integer(unsigned int, rwbs
,
993 lttng_bio_op(bio
), lttng_bio_rw(bio
),
995 ctf_integer(pid_t
, tid
, current
->pid
)
996 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1002 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
1004 * block_bio_backmerge - merging block operation to the end of an existing operation
1005 * @bio: new block operation to merge
1007 * Merging block request @bio to the end of an existing block request.
1009 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
1011 TP_PROTO(struct bio
*bio
),
1017 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
1018 * @bio: new block operation to merge
1020 * Merging block IO operation @bio to the beginning of an existing block request.
1022 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
1024 TP_PROTO(struct bio
*bio
),
1030 * block_bio_queue - putting new block IO operation in queue
1031 * @bio: new block operation
1033 * About to place the block IO operation @bio into queue @q.
1035 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
1037 TP_PROTO(struct bio
*bio
),
1041 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
1043 * block_bio_backmerge - merging block operation to the end of an existing operation
1044 * @q: queue holding operation
1045 * @rq: request bio is being merged into
1046 * @bio: new block operation to merge
1048 * Merging block request @bio to the end of an existing block request
1051 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_backmerge
,
1053 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
1059 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
1060 * @q: queue holding operation
1061 * @rq: request bio is being merged into
1062 * @bio: new block operation to merge
1064 * Merging block IO operation @bio to the beginning of an existing block
1065 * operation in queue @q.
1067 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_frontmerge
,
1069 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
1075 * block_bio_queue - putting new block IO operation in queue
1076 * @q: queue holding operation
1077 * @bio: new block operation
1079 * About to place the block IO operation @bio into queue @q.
1081 LTTNG_TRACEPOINT_EVENT(block_bio_queue
,
1083 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1088 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
1089 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1091 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1093 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
1094 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1095 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1096 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1097 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1098 bio
->bi_iter
.bi_size
)
1099 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1100 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1101 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1102 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1103 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1104 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1105 ctf_integer(pid_t
, tid
, current
->pid
)
1106 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1109 #else /* if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
1110 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
1112 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1117 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
1118 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1119 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1120 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1121 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1122 ctf_integer(pid_t
, tid
, current
->pid
)
1123 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1128 * block_bio_backmerge - merging block operation to the end of an existing operation
1129 * @q: queue holding operation
1130 * @bio: new block operation to merge
1132 * Merging block request @bio to the end of an existing block request
1135 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
1137 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1143 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
1144 * @q: queue holding operation
1145 * @bio: new block operation to merge
1147 * Merging block IO operation @bio to the beginning of an existing block
1148 * operation in queue @q.
1150 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
1152 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1158 * block_bio_queue - putting new block IO operation in queue
1159 * @q: queue holding operation
1160 * @bio: new block operation
1162 * About to place the block IO operation @bio into queue @q.
1164 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
1166 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1170 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
1172 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
1174 * block_getrq - get a free request entry in queue for block IO operations
1175 * @bio: pending block IO operation (can be %NULL)
1177 * A request struct has been allocated to handle the block IO operation @bio.
1179 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_getrq
,
1181 TP_PROTO(struct bio
*bio
),
1186 LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq
,
1188 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1190 TP_ARGS(q
, bio
, rw
),
1193 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
1194 ctf_integer(dev_t
, dev
, bio
? bio_dev(bio
) : 0)
1196 ctf_integer(dev_t
, dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
1198 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
1199 ctf_integer(sector_t
, sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
1200 ctf_integer(unsigned int, nr_sector
,
1201 bio
? bio_sectors(bio
) : 0)
1202 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1203 bio
? lttng_bio_op(bio
) : 0,
1204 bio
? lttng_bio_rw(bio
) : 0,
1205 bio
? bio
->bi_iter
.bi_size
: 0)
1206 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1207 ctf_integer(sector_t
, sector
, bio
? bio
->bi_sector
: 0)
1208 ctf_integer(unsigned int, nr_sector
,
1209 bio
? bio
->bi_size
>> 9 : 0)
1210 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1211 bio
? lttng_bio_op(bio
) : 0,
1212 bio
? lttng_bio_rw(bio
) : 0,
1213 bio
? bio
->bi_size
: 0)
1214 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1215 ctf_integer(pid_t
, tid
, current
->pid
)
1216 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1221 * block_getrq - get a free request entry in queue for block IO operations
1222 * @q: queue for operations
1223 * @bio: pending block IO operation (can be %NULL)
1224 * @rw: low bit indicates a read (%0) or a write (%1)
1226 * A request struct for queue @q has been allocated to handle the
1227 * block IO operation @bio.
1229 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_getrq
,
1231 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1237 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
1238 * @q: queue for operation
1239 * @bio: pending block IO operation (can be %NULL)
1240 * @rw: low bit indicates a read (%0) or a write (%1)
1242 * In the case where a request struct cannot be provided for queue @q
1243 * the process needs to wait for an request struct to become
1244 * available. This tracepoint event is generated each time the
1245 * process goes to sleep waiting for request struct become available.
1247 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_sleeprq
,
1249 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1256 * block_plug - keep operations requests in request queue
1257 * @q: request queue to plug
1259 * Plug the request queue @q. Do not allow block operation requests
1260 * to be sent to the device driver. Instead, accumulate requests in
1261 * the queue to improve throughput performance of the block device.
1263 LTTNG_TRACEPOINT_EVENT(block_plug
,
1265 TP_PROTO(struct request_queue
*q
),
1270 ctf_integer(pid_t
, tid
, current
->pid
)
1271 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1275 LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug
,
1277 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
1278 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
1280 TP_ARGS(q
, depth
, explicit),
1282 TP_PROTO(struct request_queue
*q
),
1288 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
1289 ctf_integer(int, nr_rq
, depth
)
1291 ctf_integer(int, nr_rq
, q
->rq
.count
[READ
] + q
->rq
.count
[WRITE
])
1293 ctf_integer(pid_t
, tid
, current
->pid
)
1294 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1298 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
1300 * block_unplug_timer - timed release of operations requests in queue to device driver
1301 * @q: request queue to unplug
1303 * Unplug the request queue @q because a timer expired and allow block
1304 * operation requests to be sent to the device driver.
1306 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_timer
,
1308 TP_PROTO(struct request_queue
*q
),
1315 * block_unplug - release of operations requests in request queue
1316 * @q: request queue to unplug
1317 * @depth: number of requests just added to the queue
1318 * @explicit: whether this was an explicit unplug, or one from schedule()
1320 * Unplug request queue @q because device driver is scheduled to work
1321 * on elements in the request queue.
1323 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
1324 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug
,
1326 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_io
,
1329 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
1330 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
1332 TP_ARGS(q
, depth
, explicit)
1334 TP_PROTO(struct request_queue
*q
),
1340 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
1342 * block_split - split a single bio struct into two bio structs
1343 * @bio: block operation being split
1344 * @new_sector: The starting sector for the new bio
1346 * The bio request @bio needs to be split into two bio requests. The newly
1347 * created @bio request starts at @new_sector. This split may be required due to
1348 * hardware limitations such as operation crossing device boundaries in a RAID
1351 LTTNG_TRACEPOINT_EVENT(block_split
,
1353 TP_PROTO(struct bio
*bio
, unsigned int new_sector
),
1355 TP_ARGS(bio
, new_sector
),
1358 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1359 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1360 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1361 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1362 bio
->bi_iter
.bi_size
)
1363 ctf_integer(sector_t
, new_sector
, new_sector
)
1364 ctf_integer(pid_t
, tid
, current
->pid
)
1365 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1369 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
1371 * block_split - split a single bio struct into two bio structs
1372 * @q: queue containing the bio
1373 * @bio: block operation being split
1374 * @new_sector: The starting sector for the new bio
1376 * The bio request @bio in request queue @q needs to be split into two
1377 * bio requests. The newly created @bio request starts at
1378 * @new_sector. This split may be required due to hardware limitation
1379 * such as operation crossing device boundaries in a RAID system.
1381 LTTNG_TRACEPOINT_EVENT(block_split
,
1383 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1384 unsigned int new_sector
),
1386 TP_ARGS(q
, bio
, new_sector
),
1389 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1390 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1391 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1392 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1393 bio
->bi_iter
.bi_size
)
1394 ctf_integer(sector_t
, new_sector
, new_sector
)
1395 ctf_integer(pid_t
, tid
, current
->pid
)
1396 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1399 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
1400 LTTNG_TRACEPOINT_EVENT(block_split
,
1402 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1403 unsigned int new_sector
),
1405 TP_ARGS(q
, bio
, new_sector
),
1408 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1409 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1410 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1411 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1412 bio
->bi_iter
.bi_size
)
1413 ctf_integer(sector_t
, new_sector
, new_sector
)
1414 ctf_integer(pid_t
, tid
, current
->pid
)
1415 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1419 LTTNG_TRACEPOINT_EVENT(block_split
,
1421 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1422 unsigned int new_sector
),
1424 TP_ARGS(q
, bio
, new_sector
),
1427 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1428 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1429 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1430 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1431 ctf_integer(sector_t
, new_sector
, new_sector
)
1432 ctf_integer(pid_t
, tid
, current
->pid
)
1433 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1438 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
1440 * block_bio_remap - map request for a logical device to the raw device
1441 * @bio: revised operation
1442 * @dev: original device for the operation
1443 * @from: original sector for the operation
1445 * An operation for a logical device has been mapped to the
1448 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1450 TP_PROTO(struct bio
*bio
, dev_t dev
, sector_t from
),
1452 TP_ARGS(bio
, dev
, from
),
1455 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1456 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1457 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1458 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1459 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1460 bio
->bi_iter
.bi_size
)
1461 ctf_integer(dev_t
, old_dev
, dev
)
1462 ctf_integer(sector_t
, old_sector
, from
)
1465 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
1467 * block_bio_remap - map request for a logical device to the raw device
1468 * @q: queue holding the operation
1469 * @bio: revised operation
1470 * @dev: device for the operation
1471 * @from: original sector for the operation
1473 * An operation for a logical device has been mapped to the
1476 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
1477 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1479 LTTNG_TRACEPOINT_EVENT(block_remap
,
1482 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1485 TP_ARGS(q
, bio
, dev
, from
),
1488 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1489 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1490 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1491 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1492 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1493 bio
->bi_iter
.bi_size
)
1494 ctf_integer(dev_t
, old_dev
, dev
)
1495 ctf_integer(sector_t
, old_sector
, from
)
1498 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
1499 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1501 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1504 TP_ARGS(q
, bio
, dev
, from
),
1507 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1508 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1509 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1510 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1511 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1512 bio
->bi_iter
.bi_size
)
1513 ctf_integer(dev_t
, old_dev
, dev
)
1514 ctf_integer(sector_t
, old_sector
, from
)
1518 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1520 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1523 TP_ARGS(q
, bio
, dev
, from
),
1526 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1527 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1528 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1529 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1530 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1531 ctf_integer(dev_t
, old_dev
, dev
)
1532 ctf_integer(sector_t
, old_sector
, from
)
1537 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
1539 * block_rq_remap - map request for a block operation request
1540 * @rq: block IO operation request
1541 * @dev: device for the operation
1542 * @from: original sector for the operation
1544 * The block operation request @rq in @q has been remapped. The block
1545 * operation request @rq holds the current information and @from hold
1546 * the original sector.
1548 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1550 TP_PROTO(struct request
*rq
, dev_t dev
, sector_t from
),
1552 TP_ARGS(rq
, dev
, from
),
1555 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1556 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1557 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1558 ctf_integer(dev_t
, old_dev
, dev
)
1559 ctf_integer(sector_t
, old_sector
, from
)
1560 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1561 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1564 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
1566 * block_rq_remap - map request for a block operation request
1567 * @q: queue holding the operation
1568 * @rq: block IO operation request
1569 * @dev: device for the operation
1570 * @from: original sector for the operation
1572 * The block operation request @rq in @q has been remapped. The block
1573 * operation request @rq holds the current information and @from hold
1574 * the original sector.
1576 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1578 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
1581 TP_ARGS(q
, rq
, dev
, from
),
1584 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1585 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1586 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1587 ctf_integer(dev_t
, old_dev
, dev
)
1588 ctf_integer(sector_t
, old_sector
, from
)
1589 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1590 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1595 #undef __print_rwbs_flags
1596 #undef blk_fill_rwbs
1598 #endif /* LTTNG_TRACE_BLOCK_H */
1600 /* This part must be outside protection */
1601 #include <probes/define_trace.h>
This page took 0.062809 seconds and 4 git commands to generate.