1 // SPDX-FileCopyrightText: 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 // SPDX-License-Identifier: GPL-2.0-only
6 #define TRACE_SYSTEM block
8 #if !defined(LTTNG_TRACE_BLOCK_H) || defined(TRACE_HEADER_MULTI_READ)
9 #define LTTNG_TRACE_BLOCK_H
11 #include <lttng/tracepoint-event.h>
12 #include <linux/blktrace_api.h>
13 #include <linux/blkdev.h>
14 #include <linux/trace_seq.h>
15 #include <lttng/kernel-version.h>
17 #if LTTNG_KERNEL_RANGE(4,11,0, 5,18,0)
18 #include <scsi/scsi_request.h>
19 #endif /* LTTNG_KERNEL_RANGE(4,11,0, 5,18,0) */
21 #ifndef _TRACE_BLOCK_DEF_
22 #define _TRACE_BLOCK_DEF_
25 RWBS_FLAG_WRITE
= (1 << 0),
26 RWBS_FLAG_DISCARD
= (1 << 1),
27 RWBS_FLAG_READ
= (1 << 2),
28 RWBS_FLAG_RAHEAD
= (1 << 3),
29 RWBS_FLAG_BARRIER
= (1 << 4),
30 RWBS_FLAG_SYNC
= (1 << 5),
31 RWBS_FLAG_META
= (1 << 6),
32 RWBS_FLAG_SECURE
= (1 << 7),
33 RWBS_FLAG_FLUSH
= (1 << 8),
34 RWBS_FLAG_FUA
= (1 << 9),
35 RWBS_FLAG_PREFLUSH
= (1 << 10),
38 #endif /* _TRACE_BLOCK_DEF_ */
40 #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
41 LTTNG_TRACEPOINT_ENUM(block_rq_type
,
43 ctf_enum_value("RWBS_FLAG_WRITE", RWBS_FLAG_WRITE
)
44 ctf_enum_value("RWBS_FLAG_DISCARD", RWBS_FLAG_DISCARD
)
45 ctf_enum_value("RWBS_FLAG_READ", RWBS_FLAG_READ
)
46 ctf_enum_value("RWBS_FLAG_RAHEAD", RWBS_FLAG_RAHEAD
)
47 ctf_enum_value("RWBS_FLAG_BARRIER", RWBS_FLAG_BARRIER
)
48 ctf_enum_value("RWBS_FLAG_SYNC", RWBS_FLAG_SYNC
)
49 ctf_enum_value("RWBS_FLAG_META", RWBS_FLAG_META
)
50 ctf_enum_value("RWBS_FLAG_SECURE", RWBS_FLAG_SECURE
)
51 ctf_enum_value("RWBS_FLAG_FLUSH", RWBS_FLAG_FLUSH
)
52 ctf_enum_value("RWBS_FLAG_FUA", RWBS_FLAG_FUA
)
53 ctf_enum_value("RWBS_FLAG_PREFLUSH", RWBS_FLAG_PREFLUSH
)
56 #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */
58 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,8,0) || \
59 LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
60 LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
61 LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
62 LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,4,103,7,0,0) || \
63 LTTNG_SLE_KERNEL_RANGE(4,4,114,94,0,0, 4,4,114,95,0,0) || \
64 LTTNG_SLE_KERNEL_RANGE(4,4,120,94,0,0, 4,4,120,95,0,0) || \
65 LTTNG_SLE_KERNEL_RANGE(4,4,126,94,0,0, 4,5,0,0,0,0))
67 #define lttng_req_op(rq) req_op(rq)
68 #define lttng_req_rw(rq) ((rq)->cmd_flags)
69 #define lttng_bio_op(bio) bio_op(bio)
70 #define lttng_bio_rw(bio) ((bio)->bi_opf)
72 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0) \
73 || LTTNG_RHEL_KERNEL_RANGE(5,14,0,162,0,0, 5,15,0,0,0,0))
74 #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
75 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
76 ctf_enum(block_rq_type, type, rwbs, \
77 ( (op) == REQ_OP_WRITE ? RWBS_FLAG_WRITE : \
78 ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
79 ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
80 ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
81 ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
83 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
84 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
85 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
86 | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
87 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
89 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
90 ctf_integer(type, rwbs, \
91 ( (op) == REQ_OP_WRITE ? RWBS_FLAG_WRITE : \
92 ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
93 ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
94 ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
95 ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
97 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
98 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
99 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
100 | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
101 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
102 #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */
104 #else /* (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0)) */
106 #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
107 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
108 ctf_enum(block_rq_type, type, rwbs, \
109 (((op) == REQ_OP_WRITE || (op) == REQ_OP_WRITE_SAME) ? RWBS_FLAG_WRITE : \
110 ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
111 ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
112 ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
113 ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
115 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
116 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
117 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
118 | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
119 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
121 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
122 ctf_integer(type, rwbs, \
123 (((op) == REQ_OP_WRITE || (op) == REQ_OP_WRITE_SAME) ? RWBS_FLAG_WRITE : \
124 ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
125 ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
126 ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
127 ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
129 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
130 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
131 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
132 | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
133 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
134 #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */
135 #endif /* (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0)) */
139 #define lttng_req_op(rq)
140 #define lttng_req_rw(rq) ((rq)->cmd_flags)
141 #define lttng_bio_op(bio)
142 #define lttng_bio_rw(bio) ((bio)->bi_rw)
144 #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
145 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
146 ctf_enum(block_rq_type, type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
147 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
148 ( (bytes) ? RWBS_FLAG_READ : \
150 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
151 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
152 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
153 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \
154 | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \
155 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
157 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
158 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
159 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
160 ( (bytes) ? RWBS_FLAG_READ : \
162 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
163 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
164 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
165 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \
166 | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \
167 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
168 #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */
171 LTTNG_TRACEPOINT_EVENT_CLASS(block_buffer
,
173 TP_PROTO(struct buffer_head
*bh
),
178 ctf_integer(dev_t
, dev
, bh
->b_bdev
->bd_dev
)
179 ctf_integer(sector_t
, sector
, bh
->b_blocknr
)
180 ctf_integer(size_t, size
, bh
->b_size
)
185 * block_touch_buffer - mark a buffer accessed
186 * @bh: buffer_head being touched
188 * Called from touch_buffer().
190 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_touch_buffer
,
192 TP_PROTO(struct buffer_head
*bh
),
198 * block_dirty_buffer - mark a buffer dirty
199 * @bh: buffer_head being dirtied
201 * Called from mark_buffer_dirty().
203 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_dirty_buffer
,
205 TP_PROTO(struct buffer_head
*bh
),
210 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
211 /* block_rq_with_error event class removed in kernel 4.12 */
212 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0))
213 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
215 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
221 unsigned int nr_sector
;
227 if (blk_rq_is_scsi(rq
)) {
228 struct scsi_request
*scsi_rq
= scsi_req(rq
);
229 tp_locvar
->sector
= 0;
230 tp_locvar
->nr_sector
= 0;
231 tp_locvar
->cmd
= scsi_rq
->cmd
;
232 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
234 tp_locvar
->sector
= blk_rq_pos(rq
);
235 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
236 tp_locvar
->cmd
= NULL
;
237 tp_locvar
->cmd_len
= 0;
242 ctf_integer(dev_t
, dev
,
243 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
244 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
245 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
246 ctf_integer(int, errors
, rq
->errors
)
247 blk_rwbs_ctf_integer(unsigned int, rwbs
,
248 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
249 ctf_sequence_hex(unsigned char, cmd
,
250 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
255 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
256 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
258 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
264 unsigned int nr_sector
;
271 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
272 tp_locvar
->sector
= 0;
273 tp_locvar
->nr_sector
= 0;
274 tp_locvar
->cmd
= rq
->cmd
;
275 tp_locvar
->cmd_len
= rq
->cmd_len
;
277 tp_locvar
->sector
= blk_rq_pos(rq
);
278 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
279 tp_locvar
->cmd
= NULL
;
280 tp_locvar
->cmd_len
= 0;
285 ctf_integer(dev_t
, dev
,
286 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
287 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
288 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
289 ctf_integer(int, errors
, rq
->errors
)
290 blk_rwbs_ctf_integer(unsigned int, rwbs
,
291 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
292 ctf_sequence_hex(unsigned char, cmd
,
293 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
298 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
300 #if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(4,12,0))
302 * block_rq_abort - abort block operation request
303 * @q: queue containing the block operation request
304 * @rq: block IO operation request
306 * Called immediately after pending block IO operation request @rq in
307 * queue @q is aborted. The fields in the operation request @rq
308 * can be examined to determine which device and sectors the pending
309 * operation would access.
311 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_abort
,
313 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
319 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0) \
320 || LTTNG_RHEL_KERNEL_RANGE(5,14,0,162,0,0, 5,15,0,0,0,0))
322 * block_rq_requeue - place block IO request back on a queue
323 * @rq: block IO operation request
325 * The block operation request @rq is being placed back into queue
326 * @q. For some reason the request was not completed and needs to be
327 * put back in the queue.
329 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
331 TP_PROTO(struct request
*rq
),
336 ctf_integer(dev_t
, dev
,
337 rq
->q
->disk
? disk_devt(rq
->q
->disk
) : 0)
338 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
339 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
340 blk_rwbs_ctf_integer(unsigned int, rwbs
,
341 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
344 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
345 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
346 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
348 * block_rq_requeue - place block IO request back on a queue
349 * @rq: block IO operation request
351 * The block operation request @rq is being placed back into queue
352 * @q. For some reason the request was not completed and needs to be
353 * put back in the queue.
355 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
357 TP_PROTO(struct request
*rq
),
362 ctf_integer(dev_t
, dev
,
363 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
364 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
365 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
366 blk_rwbs_ctf_integer(unsigned int, rwbs
,
367 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
370 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
372 * block_rq_requeue - place block IO request back on a queue
373 * @q: queue holding operation
374 * @rq: block IO operation request
376 * The block operation request @rq is being placed back into queue
377 * @q. For some reason the request was not completed and needs to be
378 * put back in the queue.
380 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
382 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
387 ctf_integer(dev_t
, dev
,
388 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
389 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
390 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
391 blk_rwbs_ctf_integer(unsigned int, rwbs
,
392 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
396 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_requeue
,
398 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
405 * block_rq_complete - block IO operation completed by device driver
406 * @q: queue containing the block operation request
407 * @rq: block operations request
408 * @nr_bytes: number of completed bytes
410 * The block_rq_complete tracepoint event indicates that some portion
411 * of operation request has been completed by the device driver. If
412 * the @rq->bio is %NULL, then there is absolutely no additional work to
413 * do for the request. If @rq->bio is non-NULL then there is
414 * additional work required to complete the request.
416 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0) \
417 || LTTNG_RHEL_KERNEL_RANGE(5,14,0,162,0,0, 5,15,0,0,0,0))
418 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
420 TP_PROTO(struct request
*rq
, blk_status_t error
, unsigned int nr_bytes
),
422 TP_ARGS(rq
, error
, nr_bytes
),
425 ctf_integer(dev_t
, dev
,
426 rq
->q
->disk
? disk_devt(rq
->q
->disk
) : 0)
427 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
428 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
429 ctf_integer(int, error
, blk_status_to_errno(error
))
430 blk_rwbs_ctf_integer(unsigned int, rwbs
,
431 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
434 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,16,0) \
435 || LTTNG_RHEL_KERNEL_RANGE(5,14,0,70,0,0, 5,15,0,0,0,0))
436 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
438 TP_PROTO(struct request
*rq
, blk_status_t error
, unsigned int nr_bytes
),
440 TP_ARGS(rq
, error
, nr_bytes
),
443 ctf_integer(dev_t
, dev
,
444 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
445 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
446 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
447 ctf_integer(int, error
, blk_status_to_errno(error
))
448 blk_rwbs_ctf_integer(unsigned int, rwbs
,
449 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
452 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
453 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
455 TP_PROTO(struct request
*rq
, int error
, unsigned int nr_bytes
),
457 TP_ARGS(rq
, error
, nr_bytes
),
460 ctf_integer(dev_t
, dev
,
461 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
462 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
463 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
464 ctf_integer(int, error
, error
)
465 blk_rwbs_ctf_integer(unsigned int, rwbs
,
466 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
469 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0))
470 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
472 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
473 unsigned int nr_bytes
),
475 TP_ARGS(q
, rq
, nr_bytes
),
483 if (blk_rq_is_scsi(rq
)) {
484 struct scsi_request
*scsi_rq
= scsi_req(rq
);
485 tp_locvar
->cmd
= scsi_rq
->cmd
;
486 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
488 tp_locvar
->cmd
= NULL
;
489 tp_locvar
->cmd_len
= 0;
494 ctf_integer(dev_t
, dev
,
495 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
496 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
497 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
498 ctf_integer(int, errors
, rq
->errors
)
499 blk_rwbs_ctf_integer(unsigned int, rwbs
,
500 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
501 ctf_sequence_hex(unsigned char, cmd
,
502 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
508 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
510 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
511 unsigned int nr_bytes
),
513 TP_ARGS(q
, rq
, nr_bytes
),
521 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
522 tp_locvar
->cmd
= rq
->cmd
;
523 tp_locvar
->cmd_len
= rq
->cmd_len
;
525 tp_locvar
->cmd
= NULL
;
526 tp_locvar
->cmd_len
= 0;
531 ctf_integer(dev_t
, dev
,
532 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
533 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
534 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
535 ctf_integer(int, errors
, rq
->errors
)
536 blk_rwbs_ctf_integer(unsigned int, rwbs
,
537 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
538 ctf_sequence_hex(unsigned char, cmd
,
539 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
546 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0) \
547 || LTTNG_RHEL_KERNEL_RANGE(5,14,0,162,0,0, 5,15,0,0,0,0))
548 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
550 TP_PROTO(struct request
*rq
),
555 ctf_integer(dev_t
, dev
,
556 rq
->q
->disk
? disk_devt(rq
->q
->disk
) : 0)
557 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
558 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
559 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
560 ctf_integer(pid_t
, tid
, current
->pid
)
561 blk_rwbs_ctf_integer(unsigned int, rwbs
,
562 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
563 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
566 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
567 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
568 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
569 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
571 TP_PROTO(struct request
*rq
),
576 ctf_integer(dev_t
, dev
,
577 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
578 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
579 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
580 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
581 ctf_integer(pid_t
, tid
, current
->pid
)
582 blk_rwbs_ctf_integer(unsigned int, rwbs
,
583 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
584 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
587 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
588 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
590 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
595 ctf_integer(dev_t
, dev
,
596 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
597 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
598 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
599 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
600 ctf_integer(pid_t
, tid
, current
->pid
)
601 blk_rwbs_ctf_integer(unsigned int, rwbs
,
602 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
603 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
606 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0))
607 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
609 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
615 unsigned int nr_sector
;
622 if (blk_rq_is_scsi(rq
)) {
623 struct scsi_request
*scsi_rq
= scsi_req(rq
);
624 tp_locvar
->sector
= 0;
625 tp_locvar
->nr_sector
= 0;
626 tp_locvar
->bytes
= scsi_rq
->resid_len
;
627 tp_locvar
->cmd
= scsi_rq
->cmd
;
628 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
630 tp_locvar
->sector
= blk_rq_pos(rq
);
631 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
632 tp_locvar
->bytes
= 0;
633 tp_locvar
->cmd
= NULL
;
634 tp_locvar
->cmd_len
= 0;
639 ctf_integer(dev_t
, dev
,
640 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
641 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
642 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
643 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
644 ctf_integer(pid_t
, tid
, current
->pid
)
645 blk_rwbs_ctf_integer(unsigned int, rwbs
,
646 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
647 ctf_sequence_hex(unsigned char, cmd
,
648 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
649 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
654 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
655 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
657 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
663 unsigned int nr_sector
;
670 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
671 tp_locvar
->sector
= 0;
672 tp_locvar
->nr_sector
= 0;
673 tp_locvar
->bytes
= blk_rq_bytes(rq
);
674 tp_locvar
->cmd
= rq
->cmd
;
675 tp_locvar
->cmd_len
= rq
->cmd_len
;
677 tp_locvar
->sector
= blk_rq_pos(rq
);
678 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
679 tp_locvar
->bytes
= 0;
680 tp_locvar
->cmd
= NULL
;
681 tp_locvar
->cmd_len
= 0;
686 ctf_integer(dev_t
, dev
,
687 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
688 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
689 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
690 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
691 ctf_integer(pid_t
, tid
, current
->pid
)
692 blk_rwbs_ctf_integer(unsigned int, rwbs
,
693 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
694 ctf_sequence_hex(unsigned char, cmd
,
695 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
696 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
701 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
703 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
704 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
705 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
707 * block_rq_insert - insert block operation request into queue
708 * @rq: block IO operation request
710 * Called immediately before block operation request @rq is inserted
711 * into queue @q. The fields in the operation request @rq struct can
712 * be examined to determine which device and sectors the pending
713 * operation would access.
715 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
717 TP_PROTO(struct request
*rq
),
723 * block_rq_insert - insert block operation request into queue
725 * @rq: block IO operation request
727 * Called immediately before block operation request @rq is inserted
728 * into queue @q. The fields in the operation request @rq struct can
729 * be examined to determine which device and sectors the pending
730 * operation would access.
732 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
734 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
740 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
741 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
742 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
744 * block_rq_issue - issue pending block IO request operation to device driver
745 * @rq: block IO operation operation request
747 * Called when block operation request @rq from queue @q is sent to a
748 * device driver for processing.
750 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
752 TP_PROTO(struct request
*rq
),
758 * block_rq_issue - issue pending block IO request operation to device driver
759 * @q: queue holding operation
760 * @rq: block IO operation operation request
762 * Called when block operation request @rq from queue @q is sent to a
763 * device driver for processing.
765 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
767 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
773 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
774 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0))
776 * block_rq_merge - merge request with another one in the elevator
777 * @rq: block IO operation operation request
779 * Called when block operation request @rq from queue @q is merged to another
780 * request queued in the elevator.
782 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_merge
,
784 TP_PROTO(struct request
*rq
),
788 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,9,0))
790 * block_rq_merge - merge request with another one in the elevator
791 * @q: queue holding operation
792 * @rq: block IO operation operation request
794 * Called when block operation request @rq from queue @q is merged to another
795 * request queued in the elevator.
797 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_merge
,
799 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
805 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,8,0) || \
806 LTTNG_RHEL_KERNEL_RANGE(4,18,0,305,0,0, 4,19,0,0,0,0))
809 * block_bio_complete - completed all work on the block operation
810 * @q: queue holding the block operation
811 * @bio: block operation completed
812 * @error: io error value
814 * This tracepoint indicates there is no further work to do on this
815 * block IO operation @bio.
817 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
819 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
824 ctf_integer(dev_t
, dev
, bio_dev(bio
))
825 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
826 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
827 ctf_integer(int, error
, blk_status_to_errno(bio
->bi_status
))
828 blk_rwbs_ctf_integer(unsigned int, rwbs
,
829 lttng_bio_op(bio
), lttng_bio_rw(bio
),
830 bio
->bi_iter
.bi_size
)
833 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
835 * block_bio_complete - completed all work on the block operation
836 * @q: queue holding the block operation
837 * @bio: block operation completed
838 * @error: io error value
840 * This tracepoint indicates there is no further work to do on this
841 * block IO operation @bio.
843 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
845 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
847 TP_ARGS(q
, bio
, error
),
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 ctf_integer(int, error
, error
)
854 blk_rwbs_ctf_integer(unsigned int, rwbs
,
855 lttng_bio_op(bio
), lttng_bio_rw(bio
),
856 bio
->bi_iter
.bi_size
)
861 * block_bio_complete - completed all work on the block operation
862 * @q: queue holding the block operation
863 * @bio: block operation completed
864 * @error: io error value
866 * This tracepoint indicates there is no further work to do on this
867 * block IO operation @bio.
869 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
871 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
873 TP_ARGS(q
, bio
, error
),
876 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
877 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
878 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
879 ctf_integer(int, error
, error
)
880 blk_rwbs_ctf_integer(unsigned int, rwbs
,
881 lttng_bio_op(bio
), lttng_bio_rw(bio
),
882 bio
->bi_iter
.bi_size
)
887 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
888 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
890 TP_PROTO(struct bio
*bio
),
895 ctf_integer(dev_t
, dev
, bio_dev(bio
))
896 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
897 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
898 blk_rwbs_ctf_integer(unsigned int, rwbs
,
899 lttng_bio_op(bio
), lttng_bio_rw(bio
),
900 bio
->bi_iter
.bi_size
)
901 ctf_integer(pid_t
, tid
, current
->pid
)
902 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
905 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
906 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
908 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
913 ctf_integer(dev_t
, dev
, bio_dev(bio
))
914 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
915 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
916 blk_rwbs_ctf_integer(unsigned int, rwbs
,
917 lttng_bio_op(bio
), lttng_bio_rw(bio
),
918 bio
->bi_iter
.bi_size
)
919 ctf_integer(pid_t
, tid
, current
->pid
)
920 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
924 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
926 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
931 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
932 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
933 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
934 blk_rwbs_ctf_integer(unsigned int, rwbs
,
935 lttng_bio_op(bio
), lttng_bio_rw(bio
),
936 bio
->bi_iter
.bi_size
)
937 ctf_integer(pid_t
, tid
, current
->pid
)
938 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
945 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
947 * block_bio_bounce - used bounce buffer when processing block operation
948 * @bio: block operation
950 * A bounce buffer was used to handle the block operation @bio in @q.
951 * This occurs when hardware limitations prevent a direct transfer of
952 * data between the @bio data memory area and the IO device. Use of a
953 * bounce buffer requires extra copying of data and decreases
956 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_bounce
,
958 TP_PROTO(struct bio
*bio
),
962 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
964 * block_bio_bounce - used bounce buffer when processing block operation
965 * @q: queue holding the block operation
966 * @bio: block operation
968 * A bounce buffer was used to handle the block operation @bio in @q.
969 * This occurs when hardware limitations prevent a direct transfer of
970 * data between the @bio data memory area and the IO device. Use of a
971 * bounce buffer requires extra copying of data and decreases
974 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
976 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
981 ctf_integer(dev_t
, dev
, bio_dev(bio
))
982 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
983 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
984 blk_rwbs_ctf_integer(unsigned int, rwbs
,
985 lttng_bio_op(bio
), lttng_bio_rw(bio
),
986 bio
->bi_iter
.bi_size
)
987 ctf_integer(pid_t
, tid
, current
->pid
)
988 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
992 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
994 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
999 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
1000 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1001 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1002 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1003 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1004 bio
->bi_iter
.bi_size
)
1005 ctf_integer(pid_t
, tid
, current
->pid
)
1006 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1012 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1014 * block_bio_backmerge - merging block operation to the end of an existing operation
1015 * @bio: new block operation to merge
1017 * Merging block request @bio to the end of an existing block request.
1019 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
1021 TP_PROTO(struct bio
*bio
),
1027 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
1028 * @bio: new block operation to merge
1030 * Merging block IO operation @bio to the beginning of an existing block request.
1032 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
1034 TP_PROTO(struct bio
*bio
),
1040 * block_bio_queue - putting new block IO operation in queue
1041 * @bio: new block operation
1043 * About to place the block IO operation @bio into queue @q.
1045 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
1047 TP_PROTO(struct bio
*bio
),
1053 * block_bio_backmerge - merging block operation to the end of an existing operation
1054 * @q: queue holding operation
1055 * @rq: request bio is being merged into
1056 * @bio: new block operation to merge
1058 * Merging block request @bio to the end of an existing block request
1061 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_backmerge
,
1063 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
1069 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
1070 * @q: queue holding operation
1071 * @rq: request bio is being merged into
1072 * @bio: new block operation to merge
1074 * Merging block IO operation @bio to the beginning of an existing block
1075 * operation in queue @q.
1077 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_frontmerge
,
1079 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
1085 * block_bio_queue - putting new block IO operation in queue
1086 * @q: queue holding operation
1087 * @bio: new block operation
1089 * About to place the block IO operation @bio into queue @q.
1091 LTTNG_TRACEPOINT_EVENT(block_bio_queue
,
1093 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1098 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1099 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1101 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1103 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1104 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1105 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1106 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1107 bio
->bi_iter
.bi_size
)
1108 ctf_integer(pid_t
, tid
, current
->pid
)
1109 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1112 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) */
1114 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1116 * block_getrq - get a free request entry in queue for block IO operations
1117 * @bio: pending block IO operation (can be %NULL)
1119 * A request struct has been allocated to handle the block IO operation @bio.
1121 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_getrq
,
1123 TP_PROTO(struct bio
*bio
),
1128 LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq
,
1130 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1132 TP_ARGS(q
, bio
, rw
),
1135 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1136 ctf_integer(dev_t
, dev
, bio
? bio_dev(bio
) : 0)
1138 ctf_integer(dev_t
, dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
1140 ctf_integer(sector_t
, sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
1141 ctf_integer(unsigned int, nr_sector
,
1142 bio
? bio_sectors(bio
) : 0)
1143 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1144 bio
? lttng_bio_op(bio
) : 0,
1145 bio
? lttng_bio_rw(bio
) : 0,
1146 bio
? bio
->bi_iter
.bi_size
: 0)
1147 ctf_integer(pid_t
, tid
, current
->pid
)
1148 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1153 * block_getrq - get a free request entry in queue for block IO operations
1154 * @q: queue for operations
1155 * @bio: pending block IO operation (can be %NULL)
1156 * @rw: low bit indicates a read (%0) or a write (%1)
1158 * A request struct for queue @q has been allocated to handle the
1159 * block IO operation @bio.
1161 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_getrq
,
1163 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1169 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
1170 * @q: queue for operation
1171 * @bio: pending block IO operation (can be %NULL)
1172 * @rw: low bit indicates a read (%0) or a write (%1)
1174 * In the case where a request struct cannot be provided for queue @q
1175 * the process needs to wait for an request struct to become
1176 * available. This tracepoint event is generated each time the
1177 * process goes to sleep waiting for request struct become available.
1179 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_sleeprq
,
1181 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1188 * block_plug - keep operations requests in request queue
1189 * @q: request queue to plug
1191 * Plug the request queue @q. Do not allow block operation requests
1192 * to be sent to the device driver. Instead, accumulate requests in
1193 * the queue to improve throughput performance of the block device.
1195 LTTNG_TRACEPOINT_EVENT(block_plug
,
1197 TP_PROTO(struct request_queue
*q
),
1202 ctf_integer(pid_t
, tid
, current
->pid
)
1203 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1207 LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug
,
1209 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
1211 TP_ARGS(q
, depth
, explicit),
1214 ctf_integer(int, nr_rq
, depth
)
1215 ctf_integer(pid_t
, tid
, current
->pid
)
1216 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1221 * block_unplug - release of operations requests in request queue
1222 * @q: request queue to unplug
1223 * @depth: number of requests just added to the queue
1224 * @explicit: whether this was an explicit unplug, or one from schedule()
1226 * Unplug request queue @q because device driver is scheduled to work
1227 * on elements in the request queue.
1229 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug
,
1231 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
1233 TP_ARGS(q
, depth
, explicit)
1236 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1238 * block_split - split a single bio struct into two bio structs
1239 * @bio: block operation being split
1240 * @new_sector: The starting sector for the new bio
1242 * The bio request @bio needs to be split into two bio requests. The newly
1243 * created @bio request starts at @new_sector. This split may be required due to
1244 * hardware limitations such as operation crossing device boundaries in a RAID
1247 LTTNG_TRACEPOINT_EVENT(block_split
,
1249 TP_PROTO(struct bio
*bio
, unsigned int new_sector
),
1251 TP_ARGS(bio
, new_sector
),
1254 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1255 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1256 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1257 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1258 bio
->bi_iter
.bi_size
)
1259 ctf_integer(sector_t
, new_sector
, new_sector
)
1260 ctf_integer(pid_t
, tid
, current
->pid
)
1261 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1265 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1267 * block_split - split a single bio struct into two bio structs
1268 * @q: queue containing the bio
1269 * @bio: block operation being split
1270 * @new_sector: The starting sector for the new bio
1272 * The bio request @bio in request queue @q needs to be split into two
1273 * bio requests. The newly created @bio request starts at
1274 * @new_sector. This split may be required due to hardware limitation
1275 * such as operation crossing device boundaries in a RAID system.
1277 LTTNG_TRACEPOINT_EVENT(block_split
,
1279 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1280 unsigned int new_sector
),
1282 TP_ARGS(q
, bio
, new_sector
),
1285 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1286 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1287 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1288 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1289 bio
->bi_iter
.bi_size
)
1290 ctf_integer(sector_t
, new_sector
, new_sector
)
1291 ctf_integer(pid_t
, tid
, current
->pid
)
1292 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1296 LTTNG_TRACEPOINT_EVENT(block_split
,
1298 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1299 unsigned int new_sector
),
1301 TP_ARGS(q
, bio
, new_sector
),
1304 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1305 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1306 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1307 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1308 bio
->bi_iter
.bi_size
)
1309 ctf_integer(sector_t
, new_sector
, new_sector
)
1310 ctf_integer(pid_t
, tid
, current
->pid
)
1311 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1316 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1318 * block_bio_remap - map request for a logical device to the raw device
1319 * @bio: revised operation
1320 * @dev: original device for the operation
1321 * @from: original sector for the operation
1323 * An operation for a logical device has been mapped to the
1326 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1328 TP_PROTO(struct bio
*bio
, dev_t dev
, sector_t from
),
1330 TP_ARGS(bio
, dev
, from
),
1333 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1334 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1335 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1336 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1337 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1338 bio
->bi_iter
.bi_size
)
1339 ctf_integer(dev_t
, old_dev
, dev
)
1340 ctf_integer(sector_t
, old_sector
, from
)
1343 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1345 * block_bio_remap - map request for a logical device to the raw device
1346 * @q: queue holding the operation
1347 * @bio: revised operation
1348 * @dev: device for the operation
1349 * @from: original sector for the operation
1351 * An operation for a logical device has been mapped to the
1354 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1356 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1359 TP_ARGS(q
, bio
, dev
, from
),
1362 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1363 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1364 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1365 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1366 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1367 bio
->bi_iter
.bi_size
)
1368 ctf_integer(dev_t
, old_dev
, dev
)
1369 ctf_integer(sector_t
, old_sector
, from
)
1373 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1375 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1378 TP_ARGS(q
, bio
, dev
, from
),
1381 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1382 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1383 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1384 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1385 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1386 bio
->bi_iter
.bi_size
)
1387 ctf_integer(dev_t
, old_dev
, dev
)
1388 ctf_integer(sector_t
, old_sector
, from
)
1393 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0) \
1394 || LTTNG_RHEL_KERNEL_RANGE(5,14,0,162,0,0, 5,15,0,0,0,0))
1396 * block_rq_remap - map request for a block operation request
1397 * @rq: block IO operation request
1398 * @dev: device for the operation
1399 * @from: original sector for the operation
1401 * The block operation request @rq in @q has been remapped. The block
1402 * operation request @rq holds the current information and @from hold
1403 * the original sector.
1405 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1407 TP_PROTO(struct request
*rq
, dev_t dev
, sector_t from
),
1409 TP_ARGS(rq
, dev
, from
),
1412 ctf_integer(dev_t
, dev
, disk_devt(rq
->q
->disk
))
1413 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1414 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1415 ctf_integer(dev_t
, old_dev
, dev
)
1416 ctf_integer(sector_t
, old_sector
, from
)
1417 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1418 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1421 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
1422 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
1423 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
1425 * block_rq_remap - map request for a block operation request
1426 * @rq: block IO operation request
1427 * @dev: device for the operation
1428 * @from: original sector for the operation
1430 * The block operation request @rq in @q has been remapped. The block
1431 * operation request @rq holds the current information and @from hold
1432 * the original sector.
1434 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1436 TP_PROTO(struct request
*rq
, dev_t dev
, sector_t from
),
1438 TP_ARGS(rq
, dev
, from
),
1441 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1442 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1443 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1444 ctf_integer(dev_t
, old_dev
, dev
)
1445 ctf_integer(sector_t
, old_sector
, from
)
1446 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1447 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1452 * block_rq_remap - map request for a block operation request
1453 * @q: queue holding the operation
1454 * @rq: block IO operation request
1455 * @dev: device for the operation
1456 * @from: original sector for the operation
1458 * The block operation request @rq in @q has been remapped. The block
1459 * operation request @rq holds the current information and @from hold
1460 * the original sector.
1462 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1464 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
1467 TP_ARGS(q
, rq
, dev
, from
),
1470 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1471 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1472 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1473 ctf_integer(dev_t
, old_dev
, dev
)
1474 ctf_integer(sector_t
, old_sector
, from
)
1475 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1476 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1481 #undef __print_rwbs_flags
1482 #undef blk_fill_rwbs
1484 #endif /* LTTNG_TRACE_BLOCK_H */
1486 /* This part must be outside protection */
1487 #include <lttng/define_trace.h>
This page took 0.088806 seconds and 5 git commands to generate.