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_TRACEPOINT_EVENT(block_rq_complete
,
429 TP_PROTO(struct request
*rq
, blk_status_t error
, unsigned int nr_bytes
),
431 TP_ARGS(rq
, error
, nr_bytes
),
434 ctf_integer(dev_t
, dev
,
435 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
436 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
437 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
438 ctf_integer(int, error
, blk_status_to_errno(error
))
439 blk_rwbs_ctf_integer(unsigned int, rwbs
,
440 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
443 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
444 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
446 TP_PROTO(struct request
*rq
, int error
, unsigned int nr_bytes
),
448 TP_ARGS(rq
, error
, nr_bytes
),
451 ctf_integer(dev_t
, dev
,
452 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
453 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
454 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
455 ctf_integer(int, error
, error
)
456 blk_rwbs_ctf_integer(unsigned int, rwbs
,
457 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
460 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0))
461 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
463 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
464 unsigned int nr_bytes
),
466 TP_ARGS(q
, rq
, nr_bytes
),
474 if (blk_rq_is_scsi(rq
)) {
475 struct scsi_request
*scsi_rq
= scsi_req(rq
);
476 tp_locvar
->cmd
= scsi_rq
->cmd
;
477 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
479 tp_locvar
->cmd
= NULL
;
480 tp_locvar
->cmd_len
= 0;
485 ctf_integer(dev_t
, dev
,
486 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
487 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
488 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
489 ctf_integer(int, errors
, rq
->errors
)
490 blk_rwbs_ctf_integer(unsigned int, rwbs
,
491 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
492 ctf_sequence_hex(unsigned char, cmd
,
493 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
498 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,5) \
499 || LTTNG_KERNEL_RANGE(3,12,21, 3,13,0) \
500 || LTTNG_KERNEL_RANGE(3,10,41, 3,11,0) \
501 || LTTNG_KERNEL_RANGE(3,4,91, 3,5,0) \
502 || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0) \
503 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,28, 3,14,0,0) \
504 || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0))
506 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
508 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
509 unsigned int nr_bytes
),
511 TP_ARGS(q
, rq
, nr_bytes
),
519 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
520 tp_locvar
->cmd
= rq
->cmd
;
521 tp_locvar
->cmd_len
= rq
->cmd_len
;
523 tp_locvar
->cmd
= NULL
;
524 tp_locvar
->cmd_len
= 0;
529 ctf_integer(dev_t
, dev
,
530 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
531 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
532 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
533 ctf_integer(int, errors
, rq
->errors
)
534 blk_rwbs_ctf_integer(unsigned int, rwbs
,
535 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
536 ctf_sequence_hex(unsigned char, cmd
,
537 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
543 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,15,0)) */
546 * block_rq_complete - block IO operation completed by device driver
547 * @q: queue containing the block operation request
548 * @rq: block operations request
550 * The block_rq_complete tracepoint event indicates that some portion
551 * of operation request has been completed by the device driver. If
552 * the @rq->bio is %NULL, then there is absolutely no additional work to
553 * do for the request. If @rq->bio is non-NULL then there is
554 * additional work required to complete the request.
556 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_complete
,
558 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
563 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,15,0)) */
565 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
566 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
568 TP_PROTO(struct request
*rq
),
573 ctf_integer(dev_t
, dev
,
574 rq
->q
->disk
? disk_devt(rq
->q
->disk
) : 0)
575 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
576 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
577 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
578 ctf_integer(pid_t
, tid
, current
->pid
)
579 blk_rwbs_ctf_integer(unsigned int, rwbs
,
580 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
581 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
584 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
585 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
586 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
587 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
589 TP_PROTO(struct request
*rq
),
594 ctf_integer(dev_t
, dev
,
595 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
596 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
597 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
598 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
599 ctf_integer(pid_t
, tid
, current
->pid
)
600 blk_rwbs_ctf_integer(unsigned int, rwbs
,
601 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
602 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
605 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
606 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
608 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
613 ctf_integer(dev_t
, dev
,
614 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
615 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
616 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
617 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
618 ctf_integer(pid_t
, tid
, current
->pid
)
619 blk_rwbs_ctf_integer(unsigned int, rwbs
,
620 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
621 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
624 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0))
625 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
627 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
633 unsigned int nr_sector
;
640 if (blk_rq_is_scsi(rq
)) {
641 struct scsi_request
*scsi_rq
= scsi_req(rq
);
642 tp_locvar
->sector
= 0;
643 tp_locvar
->nr_sector
= 0;
644 tp_locvar
->bytes
= scsi_rq
->resid_len
;
645 tp_locvar
->cmd
= scsi_rq
->cmd
;
646 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
648 tp_locvar
->sector
= blk_rq_pos(rq
);
649 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
650 tp_locvar
->bytes
= 0;
651 tp_locvar
->cmd
= NULL
;
652 tp_locvar
->cmd_len
= 0;
657 ctf_integer(dev_t
, dev
,
658 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
659 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
660 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
661 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
662 ctf_integer(pid_t
, tid
, current
->pid
)
663 blk_rwbs_ctf_integer(unsigned int, rwbs
,
664 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
665 ctf_sequence_hex(unsigned char, cmd
,
666 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
667 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
672 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
673 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
675 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
681 unsigned int nr_sector
;
688 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
689 tp_locvar
->sector
= 0;
690 tp_locvar
->nr_sector
= 0;
691 tp_locvar
->bytes
= blk_rq_bytes(rq
);
692 tp_locvar
->cmd
= rq
->cmd
;
693 tp_locvar
->cmd_len
= rq
->cmd_len
;
695 tp_locvar
->sector
= blk_rq_pos(rq
);
696 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
697 tp_locvar
->bytes
= 0;
698 tp_locvar
->cmd
= NULL
;
699 tp_locvar
->cmd_len
= 0;
704 ctf_integer(dev_t
, dev
,
705 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
706 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
707 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
708 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
709 ctf_integer(pid_t
, tid
, current
->pid
)
710 blk_rwbs_ctf_integer(unsigned int, rwbs
,
711 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
712 ctf_sequence_hex(unsigned char, cmd
,
713 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
714 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
719 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
721 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
722 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
723 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
725 * block_rq_insert - insert block operation request into queue
726 * @rq: block IO operation request
728 * Called immediately before block operation request @rq is inserted
729 * into queue @q. The fields in the operation request @rq struct can
730 * be examined to determine which device and sectors the pending
731 * operation would access.
733 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
735 TP_PROTO(struct request
*rq
),
741 * block_rq_insert - insert block operation request into queue
743 * @rq: block IO operation request
745 * Called immediately before block operation request @rq is inserted
746 * into queue @q. The fields in the operation request @rq struct can
747 * be examined to determine which device and sectors the pending
748 * operation would access.
750 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
752 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
758 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
759 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
760 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
762 * block_rq_issue - issue pending block IO request operation to device driver
763 * @rq: block IO operation operation request
765 * Called when block operation request @rq from queue @q is sent to a
766 * device driver for processing.
768 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
770 TP_PROTO(struct request
*rq
),
776 * block_rq_issue - issue pending block IO request operation to device driver
777 * @q: queue holding operation
778 * @rq: block IO operation operation request
780 * Called when block operation request @rq from queue @q is sent to a
781 * device driver for processing.
783 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
785 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
791 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
792 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0))
794 * block_rq_merge - merge request with another one in the elevator
795 * @rq: block IO operation operation request
797 * Called when block operation request @rq from queue @q is merged to another
798 * request queued in the elevator.
800 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_merge
,
802 TP_PROTO(struct request
*rq
),
806 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,9,0))
808 * block_rq_merge - merge request with another one in the elevator
809 * @q: queue holding operation
810 * @rq: block IO operation operation request
812 * Called when block operation request @rq from queue @q is merged to another
813 * request queued in the elevator.
815 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_merge
,
817 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
823 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,8,0) || \
824 LTTNG_RHEL_KERNEL_RANGE(4,18,0,305,0,0, 4,19,0,0,0,0))
827 * block_bio_complete - completed all work on the block operation
828 * @q: queue holding the block operation
829 * @bio: block operation completed
830 * @error: io error value
832 * This tracepoint indicates there is no further work to do on this
833 * block IO operation @bio.
835 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
837 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
842 ctf_integer(dev_t
, dev
, bio_dev(bio
))
843 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
844 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
845 ctf_integer(int, error
, blk_status_to_errno(bio
->bi_status
))
846 blk_rwbs_ctf_integer(unsigned int, rwbs
,
847 lttng_bio_op(bio
), lttng_bio_rw(bio
),
848 bio
->bi_iter
.bi_size
)
851 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
853 * block_bio_complete - completed all work on the block operation
854 * @q: queue holding the block operation
855 * @bio: block operation completed
856 * @error: io error value
858 * This tracepoint indicates there is no further work to do on this
859 * block IO operation @bio.
861 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
863 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
865 TP_ARGS(q
, bio
, error
),
868 ctf_integer(dev_t
, dev
, bio_dev(bio
))
869 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
870 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
871 ctf_integer(int, error
, error
)
872 blk_rwbs_ctf_integer(unsigned int, rwbs
,
873 lttng_bio_op(bio
), lttng_bio_rw(bio
),
874 bio
->bi_iter
.bi_size
)
877 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
879 * block_bio_complete - completed all work on the block operation
880 * @q: queue holding the block operation
881 * @bio: block operation completed
882 * @error: io error value
884 * This tracepoint indicates there is no further work to do on this
885 * block IO operation @bio.
887 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
889 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
891 TP_ARGS(q
, bio
, error
),
894 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
895 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
896 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
897 ctf_integer(int, error
, error
)
898 blk_rwbs_ctf_integer(unsigned int, rwbs
,
899 lttng_bio_op(bio
), lttng_bio_rw(bio
),
900 bio
->bi_iter
.bi_size
)
905 * block_bio_complete - completed all work on the block operation
906 * @q: queue holding the block operation
907 * @bio: block operation completed
908 * @error: io error value
910 * This tracepoint indicates there is no further work to do on this
911 * block IO operation @bio.
913 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
915 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
917 TP_ARGS(q
, bio
, error
),
920 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
921 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
922 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
923 ctf_integer(int, error
, error
)
924 blk_rwbs_ctf_integer(unsigned int, rwbs
,
925 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
930 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
931 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
933 TP_PROTO(struct bio
*bio
),
938 ctf_integer(dev_t
, dev
, bio_dev(bio
))
939 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
940 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
941 blk_rwbs_ctf_integer(unsigned int, rwbs
,
942 lttng_bio_op(bio
), lttng_bio_rw(bio
),
943 bio
->bi_iter
.bi_size
)
944 ctf_integer(pid_t
, tid
, current
->pid
)
945 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
948 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
949 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
951 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
956 ctf_integer(dev_t
, dev
, bio_dev(bio
))
957 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
958 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
959 blk_rwbs_ctf_integer(unsigned int, rwbs
,
960 lttng_bio_op(bio
), lttng_bio_rw(bio
),
961 bio
->bi_iter
.bi_size
)
962 ctf_integer(pid_t
, tid
, current
->pid
)
963 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
966 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
967 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
969 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
974 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
975 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
976 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
977 blk_rwbs_ctf_integer(unsigned int, rwbs
,
978 lttng_bio_op(bio
), lttng_bio_rw(bio
),
979 bio
->bi_iter
.bi_size
)
980 ctf_integer(pid_t
, tid
, current
->pid
)
981 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
984 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0))
985 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
987 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
992 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
993 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
994 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
995 blk_rwbs_ctf_integer(unsigned int, rwbs
,
996 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
997 ctf_integer(pid_t
, tid
, current
->pid
)
998 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1005 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1007 * block_bio_bounce - used bounce buffer when processing block operation
1008 * @bio: block operation
1010 * A bounce buffer was used to handle the block operation @bio in @q.
1011 * This occurs when hardware limitations prevent a direct transfer of
1012 * data between the @bio data memory area and the IO device. Use of a
1013 * bounce buffer requires extra copying of data and decreases
1016 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_bounce
,
1018 TP_PROTO(struct bio
*bio
),
1022 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1024 * block_bio_bounce - used bounce buffer when processing block operation
1025 * @q: queue holding the block operation
1026 * @bio: block operation
1028 * A bounce buffer was used to handle the block operation @bio in @q.
1029 * This occurs when hardware limitations prevent a direct transfer of
1030 * data between the @bio data memory area and the IO device. Use of a
1031 * bounce buffer requires extra copying of data and decreases
1034 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
1036 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1041 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1042 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1043 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1044 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1045 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1046 bio
->bi_iter
.bi_size
)
1047 ctf_integer(pid_t
, tid
, current
->pid
)
1048 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1051 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
1052 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
1054 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1059 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
1060 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1061 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1062 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1063 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1064 bio
->bi_iter
.bi_size
)
1065 ctf_integer(pid_t
, tid
, current
->pid
)
1066 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1070 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
1072 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1077 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
1078 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1079 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1080 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1081 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1083 ctf_integer(pid_t
, tid
, current
->pid
)
1084 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1090 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1092 * block_bio_backmerge - merging block operation to the end of an existing operation
1093 * @bio: new block operation to merge
1095 * Merging block request @bio to the end of an existing block request.
1097 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
1099 TP_PROTO(struct bio
*bio
),
1105 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
1106 * @bio: new block operation to merge
1108 * Merging block IO operation @bio to the beginning of an existing block request.
1110 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
1112 TP_PROTO(struct bio
*bio
),
1118 * block_bio_queue - putting new block IO operation in queue
1119 * @bio: new block operation
1121 * About to place the block IO operation @bio into queue @q.
1123 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
1125 TP_PROTO(struct bio
*bio
),
1129 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0))
1131 * block_bio_backmerge - merging block operation to the end of an existing operation
1132 * @q: queue holding operation
1133 * @rq: request bio is being merged into
1134 * @bio: new block operation to merge
1136 * Merging block request @bio to the end of an existing block request
1139 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_backmerge
,
1141 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
1147 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
1148 * @q: queue holding operation
1149 * @rq: request bio is being merged into
1150 * @bio: new block operation to merge
1152 * Merging block IO operation @bio to the beginning of an existing block
1153 * operation in queue @q.
1155 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_frontmerge
,
1157 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
1163 * block_bio_queue - putting new block IO operation in queue
1164 * @q: queue holding operation
1165 * @bio: new block operation
1167 * About to place the block IO operation @bio into queue @q.
1169 LTTNG_TRACEPOINT_EVENT(block_bio_queue
,
1171 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1176 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1177 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1179 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1181 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
1182 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1183 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1184 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1185 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1186 bio
->bi_iter
.bi_size
)
1187 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */
1188 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1189 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1190 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1191 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1192 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */
1193 ctf_integer(pid_t
, tid
, current
->pid
)
1194 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1197 #else /* if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) */
1198 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
1200 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1205 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
1206 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1207 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1208 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1209 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1210 ctf_integer(pid_t
, tid
, current
->pid
)
1211 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1216 * block_bio_backmerge - merging block operation to the end of an existing operation
1217 * @q: queue holding operation
1218 * @bio: new block operation to merge
1220 * Merging block request @bio to the end of an existing block request
1223 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
1225 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1231 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
1232 * @q: queue holding operation
1233 * @bio: new block operation to merge
1235 * Merging block IO operation @bio to the beginning of an existing block
1236 * operation in queue @q.
1238 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
1240 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1246 * block_bio_queue - putting new block IO operation in queue
1247 * @q: queue holding operation
1248 * @bio: new block operation
1250 * About to place the block IO operation @bio into queue @q.
1252 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
1254 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1258 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) */
1260 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1262 * block_getrq - get a free request entry in queue for block IO operations
1263 * @bio: pending block IO operation (can be %NULL)
1265 * A request struct has been allocated to handle the block IO operation @bio.
1267 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_getrq
,
1269 TP_PROTO(struct bio
*bio
),
1274 LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq
,
1276 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1278 TP_ARGS(q
, bio
, rw
),
1281 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1282 ctf_integer(dev_t
, dev
, bio
? bio_dev(bio
) : 0)
1284 ctf_integer(dev_t
, dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
1286 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
1287 ctf_integer(sector_t
, sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
1288 ctf_integer(unsigned int, nr_sector
,
1289 bio
? bio_sectors(bio
) : 0)
1290 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1291 bio
? lttng_bio_op(bio
) : 0,
1292 bio
? lttng_bio_rw(bio
) : 0,
1293 bio
? bio
->bi_iter
.bi_size
: 0)
1294 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */
1295 ctf_integer(sector_t
, sector
, bio
? bio
->bi_sector
: 0)
1296 ctf_integer(unsigned int, nr_sector
,
1297 bio
? bio
->bi_size
>> 9 : 0)
1298 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1299 bio
? lttng_bio_op(bio
) : 0,
1300 bio
? lttng_bio_rw(bio
) : 0,
1301 bio
? bio
->bi_size
: 0)
1302 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */
1303 ctf_integer(pid_t
, tid
, current
->pid
)
1304 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1309 * block_getrq - get a free request entry in queue for block IO operations
1310 * @q: queue for operations
1311 * @bio: pending block IO operation (can be %NULL)
1312 * @rw: low bit indicates a read (%0) or a write (%1)
1314 * A request struct for queue @q has been allocated to handle the
1315 * block IO operation @bio.
1317 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_getrq
,
1319 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1325 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
1326 * @q: queue for operation
1327 * @bio: pending block IO operation (can be %NULL)
1328 * @rw: low bit indicates a read (%0) or a write (%1)
1330 * In the case where a request struct cannot be provided for queue @q
1331 * the process needs to wait for an request struct to become
1332 * available. This tracepoint event is generated each time the
1333 * process goes to sleep waiting for request struct become available.
1335 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_sleeprq
,
1337 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1344 * block_plug - keep operations requests in request queue
1345 * @q: request queue to plug
1347 * Plug the request queue @q. Do not allow block operation requests
1348 * to be sent to the device driver. Instead, accumulate requests in
1349 * the queue to improve throughput performance of the block device.
1351 LTTNG_TRACEPOINT_EVENT(block_plug
,
1353 TP_PROTO(struct request_queue
*q
),
1358 ctf_integer(pid_t
, tid
, current
->pid
)
1359 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1363 LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug
,
1365 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
1367 TP_ARGS(q
, depth
, explicit),
1370 ctf_integer(int, nr_rq
, depth
)
1371 ctf_integer(pid_t
, tid
, current
->pid
)
1372 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1377 * block_unplug - release of operations requests in request queue
1378 * @q: request queue to unplug
1379 * @depth: number of requests just added to the queue
1380 * @explicit: whether this was an explicit unplug, or one from schedule()
1382 * Unplug request queue @q because device driver is scheduled to work
1383 * on elements in the request queue.
1385 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug
,
1387 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
1389 TP_ARGS(q
, depth
, explicit)
1392 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1394 * block_split - split a single bio struct into two bio structs
1395 * @bio: block operation being split
1396 * @new_sector: The starting sector for the new bio
1398 * The bio request @bio needs to be split into two bio requests. The newly
1399 * created @bio request starts at @new_sector. This split may be required due to
1400 * hardware limitations such as operation crossing device boundaries in a RAID
1403 LTTNG_TRACEPOINT_EVENT(block_split
,
1405 TP_PROTO(struct bio
*bio
, unsigned int new_sector
),
1407 TP_ARGS(bio
, new_sector
),
1410 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1411 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1412 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1413 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1414 bio
->bi_iter
.bi_size
)
1415 ctf_integer(sector_t
, new_sector
, new_sector
)
1416 ctf_integer(pid_t
, tid
, current
->pid
)
1417 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1421 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1423 * block_split - split a single bio struct into two bio structs
1424 * @q: queue containing the bio
1425 * @bio: block operation being split
1426 * @new_sector: The starting sector for the new bio
1428 * The bio request @bio in request queue @q needs to be split into two
1429 * bio requests. The newly created @bio request starts at
1430 * @new_sector. This split may be required due to hardware limitation
1431 * such as operation crossing device boundaries in a RAID system.
1433 LTTNG_TRACEPOINT_EVENT(block_split
,
1435 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1436 unsigned int new_sector
),
1438 TP_ARGS(q
, bio
, new_sector
),
1441 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1442 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1443 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1444 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1445 bio
->bi_iter
.bi_size
)
1446 ctf_integer(sector_t
, new_sector
, new_sector
)
1447 ctf_integer(pid_t
, tid
, current
->pid
)
1448 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1451 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
1452 LTTNG_TRACEPOINT_EVENT(block_split
,
1454 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1455 unsigned int new_sector
),
1457 TP_ARGS(q
, bio
, new_sector
),
1460 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1461 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1462 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1463 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1464 bio
->bi_iter
.bi_size
)
1465 ctf_integer(sector_t
, new_sector
, new_sector
)
1466 ctf_integer(pid_t
, tid
, current
->pid
)
1467 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1471 LTTNG_TRACEPOINT_EVENT(block_split
,
1473 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1474 unsigned int new_sector
),
1476 TP_ARGS(q
, bio
, new_sector
),
1479 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1480 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1481 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1482 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1483 ctf_integer(sector_t
, new_sector
, new_sector
)
1484 ctf_integer(pid_t
, tid
, current
->pid
)
1485 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1490 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1492 * block_bio_remap - map request for a logical device to the raw device
1493 * @bio: revised operation
1494 * @dev: original device for the operation
1495 * @from: original sector for the operation
1497 * An operation for a logical device has been mapped to the
1500 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1502 TP_PROTO(struct bio
*bio
, dev_t dev
, sector_t from
),
1504 TP_ARGS(bio
, dev
, from
),
1507 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1508 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1509 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1510 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1511 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1512 bio
->bi_iter
.bi_size
)
1513 ctf_integer(dev_t
, old_dev
, dev
)
1514 ctf_integer(sector_t
, old_sector
, from
)
1517 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1519 * block_bio_remap - map request for a logical device to the raw device
1520 * @q: queue holding the operation
1521 * @bio: revised operation
1522 * @dev: device for the operation
1523 * @from: original sector for the operation
1525 * An operation for a logical device has been mapped to the
1528 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1530 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1533 TP_ARGS(q
, bio
, dev
, from
),
1536 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1537 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1538 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1539 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1540 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1541 bio
->bi_iter
.bi_size
)
1542 ctf_integer(dev_t
, old_dev
, dev
)
1543 ctf_integer(sector_t
, old_sector
, from
)
1546 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
1547 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1549 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1552 TP_ARGS(q
, bio
, dev
, from
),
1555 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1556 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1557 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1558 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1559 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1560 bio
->bi_iter
.bi_size
)
1561 ctf_integer(dev_t
, old_dev
, dev
)
1562 ctf_integer(sector_t
, old_sector
, from
)
1566 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1568 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1571 TP_ARGS(q
, bio
, dev
, from
),
1574 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1575 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1576 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1577 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1578 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1579 ctf_integer(dev_t
, old_dev
, dev
)
1580 ctf_integer(sector_t
, old_sector
, from
)
1585 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
1587 * block_rq_remap - map request for a block operation request
1588 * @rq: block IO operation request
1589 * @dev: device for the operation
1590 * @from: original sector for the operation
1592 * The block operation request @rq in @q has been remapped. The block
1593 * operation request @rq holds the current information and @from hold
1594 * the original sector.
1596 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1598 TP_PROTO(struct request
*rq
, dev_t dev
, sector_t from
),
1600 TP_ARGS(rq
, dev
, from
),
1603 ctf_integer(dev_t
, dev
, disk_devt(rq
->q
->disk
))
1604 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1605 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1606 ctf_integer(dev_t
, old_dev
, dev
)
1607 ctf_integer(sector_t
, old_sector
, from
)
1608 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1609 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1612 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
1613 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
1614 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
1616 * block_rq_remap - map request for a block operation request
1617 * @rq: block IO operation request
1618 * @dev: device for the operation
1619 * @from: original sector for the operation
1621 * The block operation request @rq in @q has been remapped. The block
1622 * operation request @rq holds the current information and @from hold
1623 * the original sector.
1625 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1627 TP_PROTO(struct request
*rq
, dev_t dev
, sector_t from
),
1629 TP_ARGS(rq
, dev
, from
),
1632 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1633 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1634 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1635 ctf_integer(dev_t
, old_dev
, dev
)
1636 ctf_integer(sector_t
, old_sector
, from
)
1637 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1638 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1643 * block_rq_remap - map request for a block operation request
1644 * @q: queue holding the operation
1645 * @rq: block IO operation request
1646 * @dev: device for the operation
1647 * @from: original sector for the operation
1649 * The block operation request @rq in @q has been remapped. The block
1650 * operation request @rq holds the current information and @from hold
1651 * the original sector.
1653 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1655 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
1658 TP_ARGS(q
, rq
, dev
, from
),
1661 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1662 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1663 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1664 ctf_integer(dev_t
, old_dev
, dev
)
1665 ctf_integer(sector_t
, old_sector
, from
)
1666 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1667 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1672 #undef __print_rwbs_flags
1673 #undef blk_fill_rwbs
1675 #endif /* LTTNG_TRACE_BLOCK_H */
1677 /* This part must be outside protection */
1678 #include <probes/define_trace.h>
This page took 0.080236 seconds and 5 git commands to generate.