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) \
339 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
341 * block_rq_requeue - place block IO request back on a queue
342 * @rq: block IO operation request
344 * The block operation request @rq is being placed back into queue
345 * @q. For some reason the request was not completed and needs to be
346 * put back in the queue.
348 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
350 TP_PROTO(struct request
*rq
),
355 ctf_integer(dev_t
, dev
,
356 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
357 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
358 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
359 blk_rwbs_ctf_integer(unsigned int, rwbs
,
360 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
363 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
365 * block_rq_requeue - place block IO request back on a queue
366 * @q: queue holding operation
367 * @rq: block IO operation request
369 * The block operation request @rq is being placed back into queue
370 * @q. For some reason the request was not completed and needs to be
371 * put back in the queue.
373 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
375 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
380 ctf_integer(dev_t
, dev
,
381 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
382 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
383 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
384 blk_rwbs_ctf_integer(unsigned int, rwbs
,
385 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
389 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_requeue
,
391 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
398 * block_rq_complete - block IO operation completed by device driver
399 * @q: queue containing the block operation request
400 * @rq: block operations request
401 * @nr_bytes: number of completed bytes
403 * The block_rq_complete tracepoint event indicates that some portion
404 * of operation request has been completed by the device driver. If
405 * the @rq->bio is %NULL, then there is absolutely no additional work to
406 * do for the request. If @rq->bio is non-NULL then there is
407 * additional work required to complete the request.
409 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
410 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
412 TP_PROTO(struct request
*rq
, blk_status_t error
, unsigned int nr_bytes
),
414 TP_ARGS(rq
, error
, nr_bytes
),
417 ctf_integer(dev_t
, dev
,
418 rq
->q
->disk
? disk_devt(rq
->q
->disk
) : 0)
419 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
420 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
421 ctf_integer(int, error
, blk_status_to_errno(error
))
422 blk_rwbs_ctf_integer(unsigned int, rwbs
,
423 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
426 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,16,0) \
427 || LTTNG_RHEL_KERNEL_RANGE(5,14,0,70,0,0, 5,15,0,0,0,0))
428 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
430 TP_PROTO(struct request
*rq
, blk_status_t error
, unsigned int nr_bytes
),
432 TP_ARGS(rq
, error
, nr_bytes
),
435 ctf_integer(dev_t
, dev
,
436 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
437 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
438 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
439 ctf_integer(int, error
, blk_status_to_errno(error
))
440 blk_rwbs_ctf_integer(unsigned int, rwbs
,
441 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
444 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
445 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
447 TP_PROTO(struct request
*rq
, int error
, unsigned int nr_bytes
),
449 TP_ARGS(rq
, error
, nr_bytes
),
452 ctf_integer(dev_t
, dev
,
453 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
454 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
455 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
456 ctf_integer(int, error
, error
)
457 blk_rwbs_ctf_integer(unsigned int, rwbs
,
458 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
461 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0))
462 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
464 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
465 unsigned int nr_bytes
),
467 TP_ARGS(q
, rq
, nr_bytes
),
475 if (blk_rq_is_scsi(rq
)) {
476 struct scsi_request
*scsi_rq
= scsi_req(rq
);
477 tp_locvar
->cmd
= scsi_rq
->cmd
;
478 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
480 tp_locvar
->cmd
= NULL
;
481 tp_locvar
->cmd_len
= 0;
486 ctf_integer(dev_t
, dev
,
487 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
488 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
489 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
490 ctf_integer(int, errors
, rq
->errors
)
491 blk_rwbs_ctf_integer(unsigned int, rwbs
,
492 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
493 ctf_sequence_hex(unsigned char, cmd
,
494 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
499 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,5) \
500 || LTTNG_KERNEL_RANGE(3,12,21, 3,13,0) \
501 || LTTNG_KERNEL_RANGE(3,10,41, 3,11,0) \
502 || LTTNG_KERNEL_RANGE(3,4,91, 3,5,0) \
503 || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0) \
504 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,28, 3,14,0,0) \
505 || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0))
507 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
509 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
510 unsigned int nr_bytes
),
512 TP_ARGS(q
, rq
, nr_bytes
),
520 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
521 tp_locvar
->cmd
= rq
->cmd
;
522 tp_locvar
->cmd_len
= rq
->cmd_len
;
524 tp_locvar
->cmd
= NULL
;
525 tp_locvar
->cmd_len
= 0;
530 ctf_integer(dev_t
, dev
,
531 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
532 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
533 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
534 ctf_integer(int, errors
, rq
->errors
)
535 blk_rwbs_ctf_integer(unsigned int, rwbs
,
536 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
537 ctf_sequence_hex(unsigned char, cmd
,
538 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
544 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,15,0)) */
547 * block_rq_complete - block IO operation completed by device driver
548 * @q: queue containing the block operation request
549 * @rq: block operations request
551 * The block_rq_complete tracepoint event indicates that some portion
552 * of operation request has been completed by the device driver. If
553 * the @rq->bio is %NULL, then there is absolutely no additional work to
554 * do for the request. If @rq->bio is non-NULL then there is
555 * additional work required to complete the request.
557 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_complete
,
559 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
564 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,15,0)) */
566 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
567 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
569 TP_PROTO(struct request
*rq
),
574 ctf_integer(dev_t
, dev
,
575 rq
->q
->disk
? disk_devt(rq
->q
->disk
) : 0)
576 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
577 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
578 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
579 ctf_integer(pid_t
, tid
, current
->pid
)
580 blk_rwbs_ctf_integer(unsigned int, rwbs
,
581 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
582 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
585 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
586 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
587 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
588 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
590 TP_PROTO(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,12,0))
607 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
609 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
614 ctf_integer(dev_t
, dev
,
615 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
616 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
617 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
618 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
619 ctf_integer(pid_t
, tid
, current
->pid
)
620 blk_rwbs_ctf_integer(unsigned int, rwbs
,
621 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
622 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
625 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0))
626 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
628 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
634 unsigned int nr_sector
;
641 if (blk_rq_is_scsi(rq
)) {
642 struct scsi_request
*scsi_rq
= scsi_req(rq
);
643 tp_locvar
->sector
= 0;
644 tp_locvar
->nr_sector
= 0;
645 tp_locvar
->bytes
= scsi_rq
->resid_len
;
646 tp_locvar
->cmd
= scsi_rq
->cmd
;
647 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
649 tp_locvar
->sector
= blk_rq_pos(rq
);
650 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
651 tp_locvar
->bytes
= 0;
652 tp_locvar
->cmd
= NULL
;
653 tp_locvar
->cmd_len
= 0;
658 ctf_integer(dev_t
, dev
,
659 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
660 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
661 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
662 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
663 ctf_integer(pid_t
, tid
, current
->pid
)
664 blk_rwbs_ctf_integer(unsigned int, rwbs
,
665 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
666 ctf_sequence_hex(unsigned char, cmd
,
667 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
668 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
673 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
674 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
676 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
682 unsigned int nr_sector
;
689 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
690 tp_locvar
->sector
= 0;
691 tp_locvar
->nr_sector
= 0;
692 tp_locvar
->bytes
= blk_rq_bytes(rq
);
693 tp_locvar
->cmd
= rq
->cmd
;
694 tp_locvar
->cmd_len
= rq
->cmd_len
;
696 tp_locvar
->sector
= blk_rq_pos(rq
);
697 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
698 tp_locvar
->bytes
= 0;
699 tp_locvar
->cmd
= NULL
;
700 tp_locvar
->cmd_len
= 0;
705 ctf_integer(dev_t
, dev
,
706 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
707 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
708 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
709 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
710 ctf_integer(pid_t
, tid
, current
->pid
)
711 blk_rwbs_ctf_integer(unsigned int, rwbs
,
712 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
713 ctf_sequence_hex(unsigned char, cmd
,
714 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
715 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
720 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
722 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
723 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
724 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
726 * block_rq_insert - insert block operation request into queue
727 * @rq: block IO operation request
729 * Called immediately before block operation request @rq is inserted
730 * into queue @q. The fields in the operation request @rq struct can
731 * be examined to determine which device and sectors the pending
732 * operation would access.
734 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
736 TP_PROTO(struct request
*rq
),
742 * block_rq_insert - insert block operation request into queue
744 * @rq: block IO operation request
746 * Called immediately before block operation request @rq is inserted
747 * into queue @q. The fields in the operation request @rq struct can
748 * be examined to determine which device and sectors the pending
749 * operation would access.
751 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
753 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
759 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
760 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
761 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
763 * block_rq_issue - issue pending block IO request operation to device driver
764 * @rq: block IO operation operation request
766 * Called when block operation request @rq from queue @q is sent to a
767 * device driver for processing.
769 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
771 TP_PROTO(struct request
*rq
),
777 * block_rq_issue - issue pending block IO request operation to device driver
778 * @q: queue holding operation
779 * @rq: block IO operation operation request
781 * Called when block operation request @rq from queue @q is sent to a
782 * device driver for processing.
784 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
786 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
792 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
793 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0))
795 * block_rq_merge - merge request with another one in the elevator
796 * @rq: block IO operation operation request
798 * Called when block operation request @rq from queue @q is merged to another
799 * request queued in the elevator.
801 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_merge
,
803 TP_PROTO(struct request
*rq
),
807 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,9,0))
809 * block_rq_merge - merge request with another one in the elevator
810 * @q: queue holding operation
811 * @rq: block IO operation operation request
813 * Called when block operation request @rq from queue @q is merged to another
814 * request queued in the elevator.
816 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_merge
,
818 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
824 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,8,0) || \
825 LTTNG_RHEL_KERNEL_RANGE(4,18,0,305,0,0, 4,19,0,0,0,0))
828 * block_bio_complete - completed all work on the block operation
829 * @q: queue holding the block operation
830 * @bio: block operation completed
831 * @error: io error value
833 * This tracepoint indicates there is no further work to do on this
834 * block IO operation @bio.
836 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
838 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
843 ctf_integer(dev_t
, dev
, bio_dev(bio
))
844 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
845 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
846 ctf_integer(int, error
, blk_status_to_errno(bio
->bi_status
))
847 blk_rwbs_ctf_integer(unsigned int, rwbs
,
848 lttng_bio_op(bio
), lttng_bio_rw(bio
),
849 bio
->bi_iter
.bi_size
)
852 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
854 * block_bio_complete - completed all work on the block operation
855 * @q: queue holding the block operation
856 * @bio: block operation completed
857 * @error: io error value
859 * This tracepoint indicates there is no further work to do on this
860 * block IO operation @bio.
862 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
864 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
866 TP_ARGS(q
, bio
, error
),
869 ctf_integer(dev_t
, dev
, bio_dev(bio
))
870 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
871 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
872 ctf_integer(int, error
, error
)
873 blk_rwbs_ctf_integer(unsigned int, rwbs
,
874 lttng_bio_op(bio
), lttng_bio_rw(bio
),
875 bio
->bi_iter
.bi_size
)
878 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
880 * block_bio_complete - completed all work on the block operation
881 * @q: queue holding the block operation
882 * @bio: block operation completed
883 * @error: io error value
885 * This tracepoint indicates there is no further work to do on this
886 * block IO operation @bio.
888 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
890 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
892 TP_ARGS(q
, bio
, error
),
895 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
896 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
897 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
898 ctf_integer(int, error
, error
)
899 blk_rwbs_ctf_integer(unsigned int, rwbs
,
900 lttng_bio_op(bio
), lttng_bio_rw(bio
),
901 bio
->bi_iter
.bi_size
)
906 * block_bio_complete - completed all work on the block operation
907 * @q: queue holding the block operation
908 * @bio: block operation completed
909 * @error: io error value
911 * This tracepoint indicates there is no further work to do on this
912 * block IO operation @bio.
914 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
916 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
918 TP_ARGS(q
, bio
, error
),
921 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
922 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
923 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
924 ctf_integer(int, error
, error
)
925 blk_rwbs_ctf_integer(unsigned int, rwbs
,
926 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
931 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
932 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
934 TP_PROTO(struct bio
*bio
),
939 ctf_integer(dev_t
, dev
, bio_dev(bio
))
940 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
941 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
942 blk_rwbs_ctf_integer(unsigned int, rwbs
,
943 lttng_bio_op(bio
), lttng_bio_rw(bio
),
944 bio
->bi_iter
.bi_size
)
945 ctf_integer(pid_t
, tid
, current
->pid
)
946 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
949 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
950 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
952 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
957 ctf_integer(dev_t
, dev
, bio_dev(bio
))
958 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
959 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
960 blk_rwbs_ctf_integer(unsigned int, rwbs
,
961 lttng_bio_op(bio
), lttng_bio_rw(bio
),
962 bio
->bi_iter
.bi_size
)
963 ctf_integer(pid_t
, tid
, current
->pid
)
964 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
967 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
968 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
970 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
975 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
976 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
977 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
978 blk_rwbs_ctf_integer(unsigned int, rwbs
,
979 lttng_bio_op(bio
), lttng_bio_rw(bio
),
980 bio
->bi_iter
.bi_size
)
981 ctf_integer(pid_t
, tid
, current
->pid
)
982 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
985 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0))
986 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
988 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
993 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
994 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
995 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
996 blk_rwbs_ctf_integer(unsigned int, rwbs
,
997 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
998 ctf_integer(pid_t
, tid
, current
->pid
)
999 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1006 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1008 * block_bio_bounce - used bounce buffer when processing block operation
1009 * @bio: block operation
1011 * A bounce buffer was used to handle the block operation @bio in @q.
1012 * This occurs when hardware limitations prevent a direct transfer of
1013 * data between the @bio data memory area and the IO device. Use of a
1014 * bounce buffer requires extra copying of data and decreases
1017 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_bounce
,
1019 TP_PROTO(struct bio
*bio
),
1023 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1025 * block_bio_bounce - used bounce buffer when processing block operation
1026 * @q: queue holding the block operation
1027 * @bio: block operation
1029 * A bounce buffer was used to handle the block operation @bio in @q.
1030 * This occurs when hardware limitations prevent a direct transfer of
1031 * data between the @bio data memory area and the IO device. Use of a
1032 * bounce buffer requires extra copying of data and decreases
1035 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
1037 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1042 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1043 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1044 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1045 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1046 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1047 bio
->bi_iter
.bi_size
)
1048 ctf_integer(pid_t
, tid
, current
->pid
)
1049 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1052 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
1053 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
1055 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1060 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
1061 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1062 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1063 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1064 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1065 bio
->bi_iter
.bi_size
)
1066 ctf_integer(pid_t
, tid
, current
->pid
)
1067 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1071 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
1073 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1078 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
1079 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1080 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1081 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1082 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1084 ctf_integer(pid_t
, tid
, current
->pid
)
1085 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1091 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1093 * block_bio_backmerge - merging block operation to the end of an existing operation
1094 * @bio: new block operation to merge
1096 * Merging block request @bio to the end of an existing block request.
1098 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
1100 TP_PROTO(struct bio
*bio
),
1106 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
1107 * @bio: new block operation to merge
1109 * Merging block IO operation @bio to the beginning of an existing block request.
1111 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
1113 TP_PROTO(struct bio
*bio
),
1119 * block_bio_queue - putting new block IO operation in queue
1120 * @bio: new block operation
1122 * About to place the block IO operation @bio into queue @q.
1124 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
1126 TP_PROTO(struct bio
*bio
),
1130 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0))
1132 * block_bio_backmerge - merging block operation to the end of an existing operation
1133 * @q: queue holding operation
1134 * @rq: request bio is being merged into
1135 * @bio: new block operation to merge
1137 * Merging block request @bio to the end of an existing block request
1140 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_backmerge
,
1142 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
1148 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
1149 * @q: queue holding operation
1150 * @rq: request bio is being merged into
1151 * @bio: new block operation to merge
1153 * Merging block IO operation @bio to the beginning of an existing block
1154 * operation in queue @q.
1156 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_frontmerge
,
1158 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
1164 * block_bio_queue - putting new block IO operation in queue
1165 * @q: queue holding operation
1166 * @bio: new block operation
1168 * About to place the block IO operation @bio into queue @q.
1170 LTTNG_TRACEPOINT_EVENT(block_bio_queue
,
1172 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1177 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1178 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1180 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1182 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
1183 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1184 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1185 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1186 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1187 bio
->bi_iter
.bi_size
)
1188 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */
1189 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1190 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1191 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1192 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1193 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */
1194 ctf_integer(pid_t
, tid
, current
->pid
)
1195 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1198 #else /* if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) */
1199 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
1201 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1206 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
1207 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1208 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1209 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1210 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1211 ctf_integer(pid_t
, tid
, current
->pid
)
1212 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1217 * block_bio_backmerge - merging block operation to the end of an existing operation
1218 * @q: queue holding operation
1219 * @bio: new block operation to merge
1221 * Merging block request @bio to the end of an existing block request
1224 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
1226 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1232 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
1233 * @q: queue holding operation
1234 * @bio: new block operation to merge
1236 * Merging block IO operation @bio to the beginning of an existing block
1237 * operation in queue @q.
1239 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
1241 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1247 * block_bio_queue - putting new block IO operation in queue
1248 * @q: queue holding operation
1249 * @bio: new block operation
1251 * About to place the block IO operation @bio into queue @q.
1253 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
1255 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1259 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) */
1261 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1263 * block_getrq - get a free request entry in queue for block IO operations
1264 * @bio: pending block IO operation (can be %NULL)
1266 * A request struct has been allocated to handle the block IO operation @bio.
1268 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_getrq
,
1270 TP_PROTO(struct bio
*bio
),
1275 LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq
,
1277 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1279 TP_ARGS(q
, bio
, rw
),
1282 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1283 ctf_integer(dev_t
, dev
, bio
? bio_dev(bio
) : 0)
1285 ctf_integer(dev_t
, dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
1287 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
1288 ctf_integer(sector_t
, sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
1289 ctf_integer(unsigned int, nr_sector
,
1290 bio
? bio_sectors(bio
) : 0)
1291 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1292 bio
? lttng_bio_op(bio
) : 0,
1293 bio
? lttng_bio_rw(bio
) : 0,
1294 bio
? bio
->bi_iter
.bi_size
: 0)
1295 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */
1296 ctf_integer(sector_t
, sector
, bio
? bio
->bi_sector
: 0)
1297 ctf_integer(unsigned int, nr_sector
,
1298 bio
? bio
->bi_size
>> 9 : 0)
1299 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1300 bio
? lttng_bio_op(bio
) : 0,
1301 bio
? lttng_bio_rw(bio
) : 0,
1302 bio
? bio
->bi_size
: 0)
1303 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */
1304 ctf_integer(pid_t
, tid
, current
->pid
)
1305 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1310 * block_getrq - get a free request entry in queue for block IO operations
1311 * @q: queue for operations
1312 * @bio: pending block IO operation (can be %NULL)
1313 * @rw: low bit indicates a read (%0) or a write (%1)
1315 * A request struct for queue @q has been allocated to handle the
1316 * block IO operation @bio.
1318 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_getrq
,
1320 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1326 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
1327 * @q: queue for operation
1328 * @bio: pending block IO operation (can be %NULL)
1329 * @rw: low bit indicates a read (%0) or a write (%1)
1331 * In the case where a request struct cannot be provided for queue @q
1332 * the process needs to wait for an request struct to become
1333 * available. This tracepoint event is generated each time the
1334 * process goes to sleep waiting for request struct become available.
1336 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_sleeprq
,
1338 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1345 * block_plug - keep operations requests in request queue
1346 * @q: request queue to plug
1348 * Plug the request queue @q. Do not allow block operation requests
1349 * to be sent to the device driver. Instead, accumulate requests in
1350 * the queue to improve throughput performance of the block device.
1352 LTTNG_TRACEPOINT_EVENT(block_plug
,
1354 TP_PROTO(struct request_queue
*q
),
1359 ctf_integer(pid_t
, tid
, current
->pid
)
1360 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1364 LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug
,
1366 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
1368 TP_ARGS(q
, depth
, explicit),
1371 ctf_integer(int, nr_rq
, depth
)
1372 ctf_integer(pid_t
, tid
, current
->pid
)
1373 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1378 * block_unplug - release of operations requests in request queue
1379 * @q: request queue to unplug
1380 * @depth: number of requests just added to the queue
1381 * @explicit: whether this was an explicit unplug, or one from schedule()
1383 * Unplug request queue @q because device driver is scheduled to work
1384 * on elements in the request queue.
1386 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug
,
1388 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
1390 TP_ARGS(q
, depth
, explicit)
1393 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1395 * block_split - split a single bio struct into two bio structs
1396 * @bio: block operation being split
1397 * @new_sector: The starting sector for the new bio
1399 * The bio request @bio needs to be split into two bio requests. The newly
1400 * created @bio request starts at @new_sector. This split may be required due to
1401 * hardware limitations such as operation crossing device boundaries in a RAID
1404 LTTNG_TRACEPOINT_EVENT(block_split
,
1406 TP_PROTO(struct bio
*bio
, unsigned int new_sector
),
1408 TP_ARGS(bio
, new_sector
),
1411 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1412 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1413 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1414 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1415 bio
->bi_iter
.bi_size
)
1416 ctf_integer(sector_t
, new_sector
, new_sector
)
1417 ctf_integer(pid_t
, tid
, current
->pid
)
1418 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1422 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1424 * block_split - split a single bio struct into two bio structs
1425 * @q: queue containing the bio
1426 * @bio: block operation being split
1427 * @new_sector: The starting sector for the new bio
1429 * The bio request @bio in request queue @q needs to be split into two
1430 * bio requests. The newly created @bio request starts at
1431 * @new_sector. This split may be required due to hardware limitation
1432 * such as operation crossing device boundaries in a RAID system.
1434 LTTNG_TRACEPOINT_EVENT(block_split
,
1436 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1437 unsigned int new_sector
),
1439 TP_ARGS(q
, bio
, new_sector
),
1442 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1443 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1444 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1445 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1446 bio
->bi_iter
.bi_size
)
1447 ctf_integer(sector_t
, new_sector
, new_sector
)
1448 ctf_integer(pid_t
, tid
, current
->pid
)
1449 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1452 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
1453 LTTNG_TRACEPOINT_EVENT(block_split
,
1455 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1456 unsigned int new_sector
),
1458 TP_ARGS(q
, bio
, new_sector
),
1461 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1462 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1463 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1464 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1465 bio
->bi_iter
.bi_size
)
1466 ctf_integer(sector_t
, new_sector
, new_sector
)
1467 ctf_integer(pid_t
, tid
, current
->pid
)
1468 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1472 LTTNG_TRACEPOINT_EVENT(block_split
,
1474 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1475 unsigned int new_sector
),
1477 TP_ARGS(q
, bio
, new_sector
),
1480 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1481 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1482 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1483 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1484 ctf_integer(sector_t
, new_sector
, new_sector
)
1485 ctf_integer(pid_t
, tid
, current
->pid
)
1486 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1491 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1493 * block_bio_remap - map request for a logical device to the raw device
1494 * @bio: revised operation
1495 * @dev: original device for the operation
1496 * @from: original sector for the operation
1498 * An operation for a logical device has been mapped to the
1501 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1503 TP_PROTO(struct bio
*bio
, dev_t dev
, sector_t from
),
1505 TP_ARGS(bio
, dev
, from
),
1508 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1509 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1510 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1511 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1512 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1513 bio
->bi_iter
.bi_size
)
1514 ctf_integer(dev_t
, old_dev
, dev
)
1515 ctf_integer(sector_t
, old_sector
, from
)
1518 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1520 * block_bio_remap - map request for a logical device to the raw device
1521 * @q: queue holding the operation
1522 * @bio: revised operation
1523 * @dev: device for the operation
1524 * @from: original sector for the operation
1526 * An operation for a logical device has been mapped to the
1529 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1531 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1534 TP_ARGS(q
, bio
, dev
, from
),
1537 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1538 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1539 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1540 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1541 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1542 bio
->bi_iter
.bi_size
)
1543 ctf_integer(dev_t
, old_dev
, dev
)
1544 ctf_integer(sector_t
, old_sector
, from
)
1547 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
1548 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1550 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1553 TP_ARGS(q
, bio
, dev
, from
),
1556 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1557 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1558 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1559 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1560 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1561 bio
->bi_iter
.bi_size
)
1562 ctf_integer(dev_t
, old_dev
, dev
)
1563 ctf_integer(sector_t
, old_sector
, from
)
1567 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1569 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1572 TP_ARGS(q
, bio
, dev
, from
),
1575 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1576 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1577 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1578 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1579 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1580 ctf_integer(dev_t
, old_dev
, dev
)
1581 ctf_integer(sector_t
, old_sector
, from
)
1586 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
1588 * block_rq_remap - map request for a block operation request
1589 * @rq: block IO operation request
1590 * @dev: device for the operation
1591 * @from: original sector for the operation
1593 * The block operation request @rq in @q has been remapped. The block
1594 * operation request @rq holds the current information and @from hold
1595 * the original sector.
1597 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1599 TP_PROTO(struct request
*rq
, dev_t dev
, sector_t from
),
1601 TP_ARGS(rq
, dev
, from
),
1604 ctf_integer(dev_t
, dev
, disk_devt(rq
->q
->disk
))
1605 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1606 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1607 ctf_integer(dev_t
, old_dev
, dev
)
1608 ctf_integer(sector_t
, old_sector
, from
)
1609 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1610 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1613 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
1614 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
1615 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
1617 * block_rq_remap - map request for a block operation request
1618 * @rq: block IO operation request
1619 * @dev: device for the operation
1620 * @from: original sector for the operation
1622 * The block operation request @rq in @q has been remapped. The block
1623 * operation request @rq holds the current information and @from hold
1624 * the original sector.
1626 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1628 TP_PROTO(struct request
*rq
, dev_t dev
, sector_t from
),
1630 TP_ARGS(rq
, dev
, from
),
1633 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1634 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1635 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1636 ctf_integer(dev_t
, old_dev
, dev
)
1637 ctf_integer(sector_t
, old_sector
, from
)
1638 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1639 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1644 * block_rq_remap - map request for a block operation request
1645 * @q: queue holding the operation
1646 * @rq: block IO operation request
1647 * @dev: device for the operation
1648 * @from: original sector for the operation
1650 * The block operation request @rq in @q has been remapped. The block
1651 * operation request @rq holds the current information and @from hold
1652 * the original sector.
1654 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1656 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
1659 TP_ARGS(q
, rq
, dev
, from
),
1662 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1663 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1664 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1665 ctf_integer(dev_t
, old_dev
, dev
)
1666 ctf_integer(sector_t
, old_sector
, from
)
1667 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1668 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1673 #undef __print_rwbs_flags
1674 #undef blk_fill_rwbs
1676 #endif /* LTTNG_TRACE_BLOCK_H */
1678 /* This part must be outside protection */
1679 #include <probes/define_trace.h>
This page took 0.064299 seconds and 5 git commands to generate.