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 <lttng-kernel-version.h>
14 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0))
15 #include <scsi/scsi_request.h>
16 #endif /* (LTTNG_LINUX_VERSION_CODE >= LTTNG_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 #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
38 LTTNG_TRACEPOINT_ENUM(block_rq_type
,
40 ctf_enum_value("RWBS_FLAG_WRITE", RWBS_FLAG_WRITE
)
41 ctf_enum_value("RWBS_FLAG_DISCARD", RWBS_FLAG_DISCARD
)
42 ctf_enum_value("RWBS_FLAG_READ", RWBS_FLAG_READ
)
43 ctf_enum_value("RWBS_FLAG_RAHEAD", RWBS_FLAG_RAHEAD
)
44 ctf_enum_value("RWBS_FLAG_BARRIER", RWBS_FLAG_BARRIER
)
45 ctf_enum_value("RWBS_FLAG_SYNC", RWBS_FLAG_SYNC
)
46 ctf_enum_value("RWBS_FLAG_META", RWBS_FLAG_META
)
47 ctf_enum_value("RWBS_FLAG_SECURE", RWBS_FLAG_SECURE
)
48 ctf_enum_value("RWBS_FLAG_FLUSH", RWBS_FLAG_FLUSH
)
49 ctf_enum_value("RWBS_FLAG_FUA", RWBS_FLAG_FUA
)
50 ctf_enum_value("RWBS_FLAG_PREFLUSH", RWBS_FLAG_PREFLUSH
)
53 #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */
55 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,8,0) || \
56 LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
57 LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
58 LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
59 LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,4,103,7,0,0) || \
60 LTTNG_SLE_KERNEL_RANGE(4,4,114,94,0,0, 4,4,114,95,0,0) || \
61 LTTNG_SLE_KERNEL_RANGE(4,4,120,94,0,0, 4,4,120,95,0,0) || \
62 LTTNG_SLE_KERNEL_RANGE(4,4,126,94,0,0, 4,5,0,0,0,0))
64 #define lttng_req_op(rq) req_op(rq)
65 #define lttng_req_rw(rq) ((rq)->cmd_flags)
66 #define lttng_bio_op(bio) bio_op(bio)
67 #define lttng_bio_rw(bio) ((bio)->bi_opf)
69 #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
70 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
71 ctf_enum(block_rq_type, type, rwbs, \
72 (((op) == REQ_OP_WRITE || (op) == REQ_OP_WRITE_SAME) ? RWBS_FLAG_WRITE : \
73 ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
74 ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
75 ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
76 ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
78 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
79 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
80 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
81 | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
82 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
84 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
85 ctf_integer(type, rwbs, \
86 (((op) == REQ_OP_WRITE || (op) == REQ_OP_WRITE_SAME) ? RWBS_FLAG_WRITE : \
87 ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
88 ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
89 ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
90 ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
92 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
93 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
94 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
95 | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
96 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
97 #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */
99 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,1,0))
101 #define lttng_req_op(rq)
102 #define lttng_req_rw(rq) ((rq)->cmd_flags)
103 #define lttng_bio_op(bio)
104 #define lttng_bio_rw(bio) ((bio)->bi_rw)
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, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
109 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
110 ( (bytes) ? RWBS_FLAG_READ : \
112 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
113 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
114 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
115 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \
116 | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \
117 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
119 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
120 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
121 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
122 ( (bytes) ? RWBS_FLAG_READ : \
124 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
125 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
126 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
127 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \
128 | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \
129 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
130 #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */
134 #define lttng_req_op(rq)
135 #define lttng_req_rw(rq) ((rq)->cmd_flags)
136 #define lttng_bio_op(bio)
137 #define lttng_bio_rw(bio) ((bio)->bi_rw)
139 #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
140 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
141 ctf_enum(block_rq_type, type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
142 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
143 ( (bytes) ? RWBS_FLAG_READ : \
145 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
146 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
147 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
148 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
150 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
151 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
152 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
153 ( (bytes) ? RWBS_FLAG_READ : \
155 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
156 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
157 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
158 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
159 #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */
163 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0))
164 LTTNG_TRACEPOINT_EVENT_CLASS(block_buffer
,
166 TP_PROTO(struct buffer_head
*bh
),
171 ctf_integer(dev_t
, dev
, bh
->b_bdev
->bd_dev
)
172 ctf_integer(sector_t
, sector
, bh
->b_blocknr
)
173 ctf_integer(size_t, size
, bh
->b_size
)
178 * block_touch_buffer - mark a buffer accessed
179 * @bh: buffer_head being touched
181 * Called from touch_buffer().
183 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_touch_buffer
,
185 TP_PROTO(struct buffer_head
*bh
),
191 * block_dirty_buffer - mark a buffer dirty
192 * @bh: buffer_head being dirtied
194 * Called from mark_buffer_dirty().
196 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_dirty_buffer
,
198 TP_PROTO(struct buffer_head
*bh
),
204 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
205 /* block_rq_with_error event class removed in kernel 4.12 */
206 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0))
207 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
209 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
215 unsigned int nr_sector
;
221 if (blk_rq_is_scsi(rq
)) {
222 struct scsi_request
*scsi_rq
= scsi_req(rq
);
223 tp_locvar
->sector
= 0;
224 tp_locvar
->nr_sector
= 0;
225 tp_locvar
->cmd
= scsi_rq
->cmd
;
226 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
228 tp_locvar
->sector
= blk_rq_pos(rq
);
229 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
230 tp_locvar
->cmd
= NULL
;
231 tp_locvar
->cmd_len
= 0;
236 ctf_integer(dev_t
, dev
,
237 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
238 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
239 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
240 ctf_integer(int, errors
, rq
->errors
)
241 blk_rwbs_ctf_integer(unsigned int, rwbs
,
242 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
243 ctf_sequence_hex(unsigned char, cmd
,
244 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
249 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
250 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
252 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
258 unsigned int nr_sector
;
265 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
266 tp_locvar
->sector
= 0;
267 tp_locvar
->nr_sector
= 0;
268 tp_locvar
->cmd
= rq
->cmd
;
269 tp_locvar
->cmd_len
= rq
->cmd_len
;
271 tp_locvar
->sector
= blk_rq_pos(rq
);
272 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
273 tp_locvar
->cmd
= NULL
;
274 tp_locvar
->cmd_len
= 0;
279 ctf_integer(dev_t
, dev
,
280 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
281 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
282 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
283 ctf_integer(int, errors
, rq
->errors
)
284 blk_rwbs_ctf_integer(unsigned int, rwbs
,
285 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
286 ctf_sequence_hex(unsigned char, cmd
,
287 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
292 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
294 #if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(4,12,0))
296 * block_rq_abort - abort block operation request
297 * @q: queue containing the block operation request
298 * @rq: block IO operation request
300 * Called immediately after pending block IO operation request @rq in
301 * queue @q is aborted. The fields in the operation request @rq
302 * can be examined to determine which device and sectors the pending
303 * operation would access.
305 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_abort
,
307 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
313 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
315 * block_rq_requeue - place block IO request back on a queue
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
*rq
),
329 ctf_integer(dev_t
, dev
,
330 rq
->q
->disk
? disk_devt(rq
->q
->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
))
337 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
338 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0))
340 * block_rq_requeue - place block IO request back on a queue
341 * @rq: block IO operation request
343 * The block operation request @rq is being placed back into queue
344 * @q. For some reason the request was not completed and needs to be
345 * put back in the queue.
347 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
349 TP_PROTO(struct request
*rq
),
354 ctf_integer(dev_t
, dev
,
355 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
356 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
357 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
358 blk_rwbs_ctf_integer(unsigned int, rwbs
,
359 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
362 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
364 * block_rq_requeue - place block IO request back on a queue
365 * @q: queue holding operation
366 * @rq: block IO operation request
368 * The block operation request @rq is being placed back into queue
369 * @q. For some reason the request was not completed and needs to be
370 * put back in the queue.
372 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
374 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
379 ctf_integer(dev_t
, dev
,
380 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
381 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
382 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
383 blk_rwbs_ctf_integer(unsigned int, rwbs
,
384 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
388 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_requeue
,
390 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
397 * block_rq_complete - block IO operation completed by device driver
398 * @q: queue containing the block operation request
399 * @rq: block operations request
400 * @nr_bytes: number of completed bytes
402 * The block_rq_complete tracepoint event indicates that some portion
403 * of operation request has been completed by the device driver. If
404 * the @rq->bio is %NULL, then there is absolutely no additional work to
405 * do for the request. If @rq->bio is non-NULL then there is
406 * additional work required to complete the request.
408 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
409 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
411 TP_PROTO(struct request
*rq
, blk_status_t error
, unsigned int nr_bytes
),
413 TP_ARGS(rq
, error
, nr_bytes
),
416 ctf_integer(dev_t
, dev
,
417 rq
->q
->disk
? disk_devt(rq
->q
->disk
) : 0)
418 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
419 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
420 ctf_integer(int, error
, blk_status_to_errno(error
))
421 blk_rwbs_ctf_integer(unsigned int, rwbs
,
422 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
425 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,16,0))
426 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
428 TP_PROTO(struct request
*rq
, blk_status_t error
, unsigned int nr_bytes
),
430 TP_ARGS(rq
, error
, nr_bytes
),
433 ctf_integer(dev_t
, dev
,
434 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
435 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
436 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
437 ctf_integer(int, error
, blk_status_to_errno(error
))
438 blk_rwbs_ctf_integer(unsigned int, rwbs
,
439 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
442 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
443 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
445 TP_PROTO(struct request
*rq
, int error
, unsigned int nr_bytes
),
447 TP_ARGS(rq
, error
, nr_bytes
),
450 ctf_integer(dev_t
, dev
,
451 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
452 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
453 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
454 ctf_integer(int, error
, error
)
455 blk_rwbs_ctf_integer(unsigned int, rwbs
,
456 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
459 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0))
460 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
462 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
463 unsigned int nr_bytes
),
465 TP_ARGS(q
, rq
, nr_bytes
),
473 if (blk_rq_is_scsi(rq
)) {
474 struct scsi_request
*scsi_rq
= scsi_req(rq
);
475 tp_locvar
->cmd
= scsi_rq
->cmd
;
476 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
478 tp_locvar
->cmd
= NULL
;
479 tp_locvar
->cmd_len
= 0;
484 ctf_integer(dev_t
, dev
,
485 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
486 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
487 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
488 ctf_integer(int, errors
, rq
->errors
)
489 blk_rwbs_ctf_integer(unsigned int, rwbs
,
490 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
491 ctf_sequence_hex(unsigned char, cmd
,
492 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
497 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,5) \
498 || LTTNG_KERNEL_RANGE(3,12,21, 3,13,0) \
499 || LTTNG_KERNEL_RANGE(3,10,41, 3,11,0) \
500 || LTTNG_KERNEL_RANGE(3,4,91, 3,5,0) \
501 || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0) \
502 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,28, 3,14,0,0) \
503 || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0))
505 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
507 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
508 unsigned int nr_bytes
),
510 TP_ARGS(q
, rq
, nr_bytes
),
518 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
519 tp_locvar
->cmd
= rq
->cmd
;
520 tp_locvar
->cmd_len
= rq
->cmd_len
;
522 tp_locvar
->cmd
= NULL
;
523 tp_locvar
->cmd_len
= 0;
528 ctf_integer(dev_t
, dev
,
529 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
530 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
531 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
532 ctf_integer(int, errors
, rq
->errors
)
533 blk_rwbs_ctf_integer(unsigned int, rwbs
,
534 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
535 ctf_sequence_hex(unsigned char, cmd
,
536 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
542 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,15,0)) */
545 * block_rq_complete - block IO operation completed by device driver
546 * @q: queue containing the block operation request
547 * @rq: block operations request
549 * The block_rq_complete tracepoint event indicates that some portion
550 * of operation request has been completed by the device driver. If
551 * the @rq->bio is %NULL, then there is absolutely no additional work to
552 * do for the request. If @rq->bio is non-NULL then there is
553 * additional work required to complete the request.
555 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_complete
,
557 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
562 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,15,0)) */
564 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
565 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
567 TP_PROTO(struct request
*rq
),
572 ctf_integer(dev_t
, dev
,
573 rq
->q
->disk
? disk_devt(rq
->q
->disk
) : 0)
574 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
575 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
576 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
577 ctf_integer(pid_t
, tid
, current
->pid
)
578 blk_rwbs_ctf_integer(unsigned int, rwbs
,
579 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
580 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
583 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
584 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0))
585 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
587 TP_PROTO(struct request
*rq
),
592 ctf_integer(dev_t
, dev
,
593 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
594 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
595 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
596 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
597 ctf_integer(pid_t
, tid
, current
->pid
)
598 blk_rwbs_ctf_integer(unsigned int, rwbs
,
599 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
600 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
603 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
604 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
606 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
611 ctf_integer(dev_t
, dev
,
612 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
613 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
614 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
615 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
616 ctf_integer(pid_t
, tid
, current
->pid
)
617 blk_rwbs_ctf_integer(unsigned int, rwbs
,
618 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
619 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
622 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0))
623 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
625 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
631 unsigned int nr_sector
;
638 if (blk_rq_is_scsi(rq
)) {
639 struct scsi_request
*scsi_rq
= scsi_req(rq
);
640 tp_locvar
->sector
= 0;
641 tp_locvar
->nr_sector
= 0;
642 tp_locvar
->bytes
= scsi_rq
->resid_len
;
643 tp_locvar
->cmd
= scsi_rq
->cmd
;
644 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
646 tp_locvar
->sector
= blk_rq_pos(rq
);
647 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
648 tp_locvar
->bytes
= 0;
649 tp_locvar
->cmd
= NULL
;
650 tp_locvar
->cmd_len
= 0;
655 ctf_integer(dev_t
, dev
,
656 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
657 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
658 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
659 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
660 ctf_integer(pid_t
, tid
, current
->pid
)
661 blk_rwbs_ctf_integer(unsigned int, rwbs
,
662 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
663 ctf_sequence_hex(unsigned char, cmd
,
664 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
665 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
670 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
671 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
673 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
679 unsigned int nr_sector
;
686 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
687 tp_locvar
->sector
= 0;
688 tp_locvar
->nr_sector
= 0;
689 tp_locvar
->bytes
= blk_rq_bytes(rq
);
690 tp_locvar
->cmd
= rq
->cmd
;
691 tp_locvar
->cmd_len
= rq
->cmd_len
;
693 tp_locvar
->sector
= blk_rq_pos(rq
);
694 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
695 tp_locvar
->bytes
= 0;
696 tp_locvar
->cmd
= NULL
;
697 tp_locvar
->cmd_len
= 0;
702 ctf_integer(dev_t
, dev
,
703 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
704 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
705 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
706 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
707 ctf_integer(pid_t
, tid
, current
->pid
)
708 blk_rwbs_ctf_integer(unsigned int, rwbs
,
709 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
710 ctf_sequence_hex(unsigned char, cmd
,
711 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
712 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
717 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
719 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
720 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0))
722 * block_rq_insert - insert block operation request into queue
723 * @rq: block IO operation request
725 * Called immediately before block operation request @rq is inserted
726 * into queue @q. The fields in the operation request @rq struct can
727 * be examined to determine which device and sectors the pending
728 * operation would access.
730 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
732 TP_PROTO(struct request
*rq
),
738 * block_rq_insert - insert block operation request into queue
740 * @rq: block IO operation request
742 * Called immediately before block operation request @rq is inserted
743 * into queue @q. The fields in the operation request @rq struct can
744 * be examined to determine which device and sectors the pending
745 * operation would access.
747 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
749 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
755 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
756 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0))
758 * block_rq_issue - issue pending block IO request operation to device driver
759 * @rq: block IO operation operation request
761 * Called when block operation request @rq from queue @q is sent to a
762 * device driver for processing.
764 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
766 TP_PROTO(struct request
*rq
),
772 * block_rq_issue - issue pending block IO request operation to device driver
773 * @q: queue holding operation
774 * @rq: block IO operation operation request
776 * Called when block operation request @rq from queue @q is sent to a
777 * device driver for processing.
779 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
781 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
787 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
788 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0))
790 * block_rq_merge - merge request with another one in the elevator
791 * @rq: block IO operation operation request
793 * Called when block operation request @rq from queue @q is merged to another
794 * request queued in the elevator.
796 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_merge
,
798 TP_PROTO(struct request
*rq
),
802 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,9,0))
804 * block_rq_merge - merge request with another one in the elevator
805 * @q: queue holding operation
806 * @rq: block IO operation operation request
808 * Called when block operation request @rq from queue @q is merged to another
809 * request queued in the elevator.
811 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_merge
,
813 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
819 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,8,0) || \
820 LTTNG_RHEL_KERNEL_RANGE(4,18,0,305,0,0, 4,19,0,0,0,0))
823 * block_bio_complete - completed all work on the block operation
824 * @q: queue holding the block operation
825 * @bio: block operation completed
826 * @error: io error value
828 * This tracepoint indicates there is no further work to do on this
829 * block IO operation @bio.
831 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
833 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
838 ctf_integer(dev_t
, dev
, bio_dev(bio
))
839 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
840 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
841 ctf_integer(int, error
, blk_status_to_errno(bio
->bi_status
))
842 blk_rwbs_ctf_integer(unsigned int, rwbs
,
843 lttng_bio_op(bio
), lttng_bio_rw(bio
),
844 bio
->bi_iter
.bi_size
)
847 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
849 * block_bio_complete - completed all work on the block operation
850 * @q: queue holding the block operation
851 * @bio: block operation completed
852 * @error: io error value
854 * This tracepoint indicates there is no further work to do on this
855 * block IO operation @bio.
857 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
859 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
861 TP_ARGS(q
, bio
, error
),
864 ctf_integer(dev_t
, dev
, bio_dev(bio
))
865 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
866 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
867 ctf_integer(int, error
, error
)
868 blk_rwbs_ctf_integer(unsigned int, rwbs
,
869 lttng_bio_op(bio
), lttng_bio_rw(bio
),
870 bio
->bi_iter
.bi_size
)
873 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
875 * block_bio_complete - completed all work on the block operation
876 * @q: queue holding the block operation
877 * @bio: block operation completed
878 * @error: io error value
880 * This tracepoint indicates there is no further work to do on this
881 * block IO operation @bio.
883 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
885 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
887 TP_ARGS(q
, bio
, error
),
890 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
891 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
892 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
893 ctf_integer(int, error
, error
)
894 blk_rwbs_ctf_integer(unsigned int, rwbs
,
895 lttng_bio_op(bio
), lttng_bio_rw(bio
),
896 bio
->bi_iter
.bi_size
)
901 * block_bio_complete - completed all work on the block operation
902 * @q: queue holding the block operation
903 * @bio: block operation completed
904 * @error: io error value
906 * This tracepoint indicates there is no further work to do on this
907 * block IO operation @bio.
909 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
911 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
913 TP_ARGS(q
, bio
, error
),
916 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
917 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
918 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
919 ctf_integer(int, error
, error
)
920 blk_rwbs_ctf_integer(unsigned int, rwbs
,
921 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
926 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
927 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
929 TP_PROTO(struct bio
*bio
),
934 ctf_integer(dev_t
, dev
, bio_dev(bio
))
935 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
936 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
937 blk_rwbs_ctf_integer(unsigned int, rwbs
,
938 lttng_bio_op(bio
), lttng_bio_rw(bio
),
939 bio
->bi_iter
.bi_size
)
940 ctf_integer(pid_t
, tid
, current
->pid
)
941 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
944 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
945 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
947 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
952 ctf_integer(dev_t
, dev
, bio_dev(bio
))
953 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
954 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
955 blk_rwbs_ctf_integer(unsigned int, rwbs
,
956 lttng_bio_op(bio
), lttng_bio_rw(bio
),
957 bio
->bi_iter
.bi_size
)
958 ctf_integer(pid_t
, tid
, current
->pid
)
959 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
962 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
963 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
965 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
970 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
971 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
972 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
973 blk_rwbs_ctf_integer(unsigned int, rwbs
,
974 lttng_bio_op(bio
), lttng_bio_rw(bio
),
975 bio
->bi_iter
.bi_size
)
976 ctf_integer(pid_t
, tid
, current
->pid
)
977 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
980 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0))
981 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
983 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
988 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
989 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
990 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
991 blk_rwbs_ctf_integer(unsigned int, rwbs
,
992 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
993 ctf_integer(pid_t
, tid
, current
->pid
)
994 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1001 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1003 * block_bio_bounce - used bounce buffer when processing block operation
1004 * @bio: block operation
1006 * A bounce buffer was used to handle the block operation @bio in @q.
1007 * This occurs when hardware limitations prevent a direct transfer of
1008 * data between the @bio data memory area and the IO device. Use of a
1009 * bounce buffer requires extra copying of data and decreases
1012 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_bounce
,
1014 TP_PROTO(struct bio
*bio
),
1018 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1020 * block_bio_bounce - used bounce buffer when processing block operation
1021 * @q: queue holding the block operation
1022 * @bio: block operation
1024 * A bounce buffer was used to handle the block operation @bio in @q.
1025 * This occurs when hardware limitations prevent a direct transfer of
1026 * data between the @bio data memory area and the IO device. Use of a
1027 * bounce buffer requires extra copying of data and decreases
1030 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
1032 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1037 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1038 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1039 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1040 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1041 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1042 bio
->bi_iter
.bi_size
)
1043 ctf_integer(pid_t
, tid
, current
->pid
)
1044 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1047 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
1048 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
1050 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1055 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
1056 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1057 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1058 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1059 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1060 bio
->bi_iter
.bi_size
)
1061 ctf_integer(pid_t
, tid
, current
->pid
)
1062 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1066 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
1068 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1073 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
1074 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1075 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1076 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1077 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1079 ctf_integer(pid_t
, tid
, current
->pid
)
1080 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1086 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1088 * block_bio_backmerge - merging block operation to the end of an existing operation
1089 * @bio: new block operation to merge
1091 * Merging block request @bio to the end of an existing block request.
1093 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
1095 TP_PROTO(struct bio
*bio
),
1101 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
1102 * @bio: new block operation to merge
1104 * Merging block IO operation @bio to the beginning of an existing block request.
1106 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
1108 TP_PROTO(struct bio
*bio
),
1114 * block_bio_queue - putting new block IO operation in queue
1115 * @bio: new block operation
1117 * About to place the block IO operation @bio into queue @q.
1119 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
1121 TP_PROTO(struct bio
*bio
),
1125 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0))
1127 * block_bio_backmerge - merging block operation to the end of an existing operation
1128 * @q: queue holding operation
1129 * @rq: request bio is being merged into
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_merge
, block_bio_backmerge
,
1137 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
1143 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
1144 * @q: queue holding operation
1145 * @rq: request bio is being merged into
1146 * @bio: new block operation to merge
1148 * Merging block IO operation @bio to the beginning of an existing block
1149 * operation in queue @q.
1151 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_frontmerge
,
1153 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
1159 * block_bio_queue - putting new block IO operation in queue
1160 * @q: queue holding operation
1161 * @bio: new block operation
1163 * About to place the block IO operation @bio into queue @q.
1165 LTTNG_TRACEPOINT_EVENT(block_bio_queue
,
1167 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1172 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1173 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1175 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1177 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
1178 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1179 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1180 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1181 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1182 bio
->bi_iter
.bi_size
)
1183 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */
1184 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1185 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1186 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1187 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1188 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */
1189 ctf_integer(pid_t
, tid
, current
->pid
)
1190 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1193 #else /* if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) */
1194 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
1196 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1201 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
1202 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1203 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1204 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1205 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1206 ctf_integer(pid_t
, tid
, current
->pid
)
1207 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1212 * block_bio_backmerge - merging block operation to the end of an existing operation
1213 * @q: queue holding operation
1214 * @bio: new block operation to merge
1216 * Merging block request @bio to the end of an existing block request
1219 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
1221 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1227 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
1228 * @q: queue holding operation
1229 * @bio: new block operation to merge
1231 * Merging block IO operation @bio to the beginning of an existing block
1232 * operation in queue @q.
1234 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
1236 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1242 * block_bio_queue - putting new block IO operation in queue
1243 * @q: queue holding operation
1244 * @bio: new block operation
1246 * About to place the block IO operation @bio into queue @q.
1248 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
1250 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1254 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) */
1256 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1258 * block_getrq - get a free request entry in queue for block IO operations
1259 * @bio: pending block IO operation (can be %NULL)
1261 * A request struct has been allocated to handle the block IO operation @bio.
1263 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_getrq
,
1265 TP_PROTO(struct bio
*bio
),
1270 LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq
,
1272 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1274 TP_ARGS(q
, bio
, rw
),
1277 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1278 ctf_integer(dev_t
, dev
, bio
? bio_dev(bio
) : 0)
1280 ctf_integer(dev_t
, dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
1282 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
1283 ctf_integer(sector_t
, sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
1284 ctf_integer(unsigned int, nr_sector
,
1285 bio
? bio_sectors(bio
) : 0)
1286 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1287 bio
? lttng_bio_op(bio
) : 0,
1288 bio
? lttng_bio_rw(bio
) : 0,
1289 bio
? bio
->bi_iter
.bi_size
: 0)
1290 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */
1291 ctf_integer(sector_t
, sector
, bio
? bio
->bi_sector
: 0)
1292 ctf_integer(unsigned int, nr_sector
,
1293 bio
? bio
->bi_size
>> 9 : 0)
1294 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1295 bio
? lttng_bio_op(bio
) : 0,
1296 bio
? lttng_bio_rw(bio
) : 0,
1297 bio
? bio
->bi_size
: 0)
1298 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */
1299 ctf_integer(pid_t
, tid
, current
->pid
)
1300 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1305 * block_getrq - get a free request entry in queue for block IO operations
1306 * @q: queue for operations
1307 * @bio: pending block IO operation (can be %NULL)
1308 * @rw: low bit indicates a read (%0) or a write (%1)
1310 * A request struct for queue @q has been allocated to handle the
1311 * block IO operation @bio.
1313 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_getrq
,
1315 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1321 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
1322 * @q: queue for operation
1323 * @bio: pending block IO operation (can be %NULL)
1324 * @rw: low bit indicates a read (%0) or a write (%1)
1326 * In the case where a request struct cannot be provided for queue @q
1327 * the process needs to wait for an request struct to become
1328 * available. This tracepoint event is generated each time the
1329 * process goes to sleep waiting for request struct become available.
1331 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_sleeprq
,
1333 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1340 * block_plug - keep operations requests in request queue
1341 * @q: request queue to plug
1343 * Plug the request queue @q. Do not allow block operation requests
1344 * to be sent to the device driver. Instead, accumulate requests in
1345 * the queue to improve throughput performance of the block device.
1347 LTTNG_TRACEPOINT_EVENT(block_plug
,
1349 TP_PROTO(struct request_queue
*q
),
1354 ctf_integer(pid_t
, tid
, current
->pid
)
1355 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1359 LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug
,
1361 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
1363 TP_ARGS(q
, depth
, explicit),
1366 ctf_integer(int, nr_rq
, depth
)
1367 ctf_integer(pid_t
, tid
, current
->pid
)
1368 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1373 * block_unplug - release of operations requests in request queue
1374 * @q: request queue to unplug
1375 * @depth: number of requests just added to the queue
1376 * @explicit: whether this was an explicit unplug, or one from schedule()
1378 * Unplug request queue @q because device driver is scheduled to work
1379 * on elements in the request queue.
1381 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug
,
1383 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
1385 TP_ARGS(q
, depth
, explicit)
1388 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1390 * block_split - split a single bio struct into two bio structs
1391 * @bio: block operation being split
1392 * @new_sector: The starting sector for the new bio
1394 * The bio request @bio needs to be split into two bio requests. The newly
1395 * created @bio request starts at @new_sector. This split may be required due to
1396 * hardware limitations such as operation crossing device boundaries in a RAID
1399 LTTNG_TRACEPOINT_EVENT(block_split
,
1401 TP_PROTO(struct bio
*bio
, unsigned int new_sector
),
1403 TP_ARGS(bio
, new_sector
),
1406 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1407 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1408 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1409 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1410 bio
->bi_iter
.bi_size
)
1411 ctf_integer(sector_t
, new_sector
, new_sector
)
1412 ctf_integer(pid_t
, tid
, current
->pid
)
1413 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1417 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1419 * block_split - split a single bio struct into two bio structs
1420 * @q: queue containing the bio
1421 * @bio: block operation being split
1422 * @new_sector: The starting sector for the new bio
1424 * The bio request @bio in request queue @q needs to be split into two
1425 * bio requests. The newly created @bio request starts at
1426 * @new_sector. This split may be required due to hardware limitation
1427 * such as operation crossing device boundaries in a RAID system.
1429 LTTNG_TRACEPOINT_EVENT(block_split
,
1431 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1432 unsigned int new_sector
),
1434 TP_ARGS(q
, bio
, new_sector
),
1437 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1438 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1439 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1440 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1441 bio
->bi_iter
.bi_size
)
1442 ctf_integer(sector_t
, new_sector
, new_sector
)
1443 ctf_integer(pid_t
, tid
, current
->pid
)
1444 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1447 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
1448 LTTNG_TRACEPOINT_EVENT(block_split
,
1450 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1451 unsigned int new_sector
),
1453 TP_ARGS(q
, bio
, new_sector
),
1456 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1457 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
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(sector_t
, new_sector
, new_sector
)
1462 ctf_integer(pid_t
, tid
, current
->pid
)
1463 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1467 LTTNG_TRACEPOINT_EVENT(block_split
,
1469 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1470 unsigned int new_sector
),
1472 TP_ARGS(q
, bio
, new_sector
),
1475 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1476 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1477 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1478 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1479 ctf_integer(sector_t
, new_sector
, new_sector
)
1480 ctf_integer(pid_t
, tid
, current
->pid
)
1481 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1486 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1488 * block_bio_remap - map request for a logical device to the raw device
1489 * @bio: revised operation
1490 * @dev: original device for the operation
1491 * @from: original sector for the operation
1493 * An operation for a logical device has been mapped to the
1496 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1498 TP_PROTO(struct bio
*bio
, dev_t dev
, sector_t from
),
1500 TP_ARGS(bio
, dev
, from
),
1503 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1504 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1505 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1506 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1507 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1508 bio
->bi_iter
.bi_size
)
1509 ctf_integer(dev_t
, old_dev
, dev
)
1510 ctf_integer(sector_t
, old_sector
, from
)
1513 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1515 * block_bio_remap - map request for a logical device to the raw device
1516 * @q: queue holding the operation
1517 * @bio: revised operation
1518 * @dev: device for the operation
1519 * @from: original sector for the operation
1521 * An operation for a logical device has been mapped to the
1524 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1526 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1529 TP_ARGS(q
, bio
, dev
, from
),
1532 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1533 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1534 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1535 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1536 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1537 bio
->bi_iter
.bi_size
)
1538 ctf_integer(dev_t
, old_dev
, dev
)
1539 ctf_integer(sector_t
, old_sector
, from
)
1542 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
1543 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1545 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1548 TP_ARGS(q
, bio
, dev
, from
),
1551 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1552 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1553 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1554 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1555 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1556 bio
->bi_iter
.bi_size
)
1557 ctf_integer(dev_t
, old_dev
, dev
)
1558 ctf_integer(sector_t
, old_sector
, from
)
1562 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1564 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1567 TP_ARGS(q
, bio
, dev
, from
),
1570 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1571 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1572 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1573 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1574 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1575 ctf_integer(dev_t
, old_dev
, dev
)
1576 ctf_integer(sector_t
, old_sector
, from
)
1581 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
1583 * block_rq_remap - map request for a block operation request
1584 * @rq: block IO operation request
1585 * @dev: device for the operation
1586 * @from: original sector for the operation
1588 * The block operation request @rq in @q has been remapped. The block
1589 * operation request @rq holds the current information and @from hold
1590 * the original sector.
1592 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1594 TP_PROTO(struct request
*rq
, dev_t dev
, sector_t from
),
1596 TP_ARGS(rq
, dev
, from
),
1599 ctf_integer(dev_t
, dev
, disk_devt(rq
->q
->disk
))
1600 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1601 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1602 ctf_integer(dev_t
, old_dev
, dev
)
1603 ctf_integer(sector_t
, old_sector
, from
)
1604 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1605 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1608 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
1609 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0))
1611 * block_rq_remap - map request for a block operation request
1612 * @rq: block IO operation request
1613 * @dev: device for the operation
1614 * @from: original sector for the operation
1616 * The block operation request @rq in @q has been remapped. The block
1617 * operation request @rq holds the current information and @from hold
1618 * the original sector.
1620 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1622 TP_PROTO(struct request
*rq
, dev_t dev
, sector_t from
),
1624 TP_ARGS(rq
, dev
, from
),
1627 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1628 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1629 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1630 ctf_integer(dev_t
, old_dev
, dev
)
1631 ctf_integer(sector_t
, old_sector
, from
)
1632 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1633 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1638 * block_rq_remap - map request for a block operation request
1639 * @q: queue holding the operation
1640 * @rq: block IO operation request
1641 * @dev: device for the operation
1642 * @from: original sector for the operation
1644 * The block operation request @rq in @q has been remapped. The block
1645 * operation request @rq holds the current information and @from hold
1646 * the original sector.
1648 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1650 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
1653 TP_ARGS(q
, rq
, dev
, from
),
1656 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1657 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1658 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1659 ctf_integer(dev_t
, old_dev
, dev
)
1660 ctf_integer(sector_t
, old_sector
, from
)
1661 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1662 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1667 #undef __print_rwbs_flags
1668 #undef blk_fill_rwbs
1670 #endif /* LTTNG_TRACE_BLOCK_H */
1672 /* This part must be outside protection */
1673 #include <probes/define_trace.h>
This page took 0.099799 seconds and 4 git commands to generate.