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))
339 * block_rq_requeue - place block IO request back on a queue
340 * @rq: block IO operation request
342 * The block operation request @rq is being placed back into queue
343 * @q. For some reason the request was not completed and needs to be
344 * put back in the queue.
346 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
348 TP_PROTO(struct request
*rq
),
353 ctf_integer(dev_t
, dev
,
354 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
355 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
356 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
357 blk_rwbs_ctf_integer(unsigned int, rwbs
,
358 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
361 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
363 * block_rq_requeue - place block IO request back on a queue
364 * @q: queue holding operation
365 * @rq: block IO operation request
367 * The block operation request @rq is being placed back into queue
368 * @q. For some reason the request was not completed and needs to be
369 * put back in the queue.
371 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
373 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
378 ctf_integer(dev_t
, dev
,
379 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
380 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
381 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
382 blk_rwbs_ctf_integer(unsigned int, rwbs
,
383 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
387 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_requeue
,
389 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
396 * block_rq_complete - block IO operation completed by device driver
397 * @q: queue containing the block operation request
398 * @rq: block operations request
399 * @nr_bytes: number of completed bytes
401 * The block_rq_complete tracepoint event indicates that some portion
402 * of operation request has been completed by the device driver. If
403 * the @rq->bio is %NULL, then there is absolutely no additional work to
404 * do for the request. If @rq->bio is non-NULL then there is
405 * additional work required to complete the request.
407 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
408 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
410 TP_PROTO(struct request
*rq
, blk_status_t error
, unsigned int nr_bytes
),
412 TP_ARGS(rq
, error
, nr_bytes
),
415 ctf_integer(dev_t
, dev
,
416 rq
->q
->disk
? disk_devt(rq
->q
->disk
) : 0)
417 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
418 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
419 ctf_integer(int, error
, blk_status_to_errno(error
))
420 blk_rwbs_ctf_integer(unsigned int, rwbs
,
421 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
424 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,16,0))
425 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
427 TP_PROTO(struct request
*rq
, blk_status_t error
, unsigned int nr_bytes
),
429 TP_ARGS(rq
, error
, nr_bytes
),
432 ctf_integer(dev_t
, dev
,
433 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
434 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
435 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
436 ctf_integer(int, error
, blk_status_to_errno(error
))
437 blk_rwbs_ctf_integer(unsigned int, rwbs
,
438 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
441 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
442 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
444 TP_PROTO(struct request
*rq
, int error
, unsigned int nr_bytes
),
446 TP_ARGS(rq
, error
, nr_bytes
),
449 ctf_integer(dev_t
, dev
,
450 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
451 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
452 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
453 ctf_integer(int, error
, error
)
454 blk_rwbs_ctf_integer(unsigned int, rwbs
,
455 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
458 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0))
459 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
461 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
462 unsigned int nr_bytes
),
464 TP_ARGS(q
, rq
, nr_bytes
),
472 if (blk_rq_is_scsi(rq
)) {
473 struct scsi_request
*scsi_rq
= scsi_req(rq
);
474 tp_locvar
->cmd
= scsi_rq
->cmd
;
475 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
477 tp_locvar
->cmd
= NULL
;
478 tp_locvar
->cmd_len
= 0;
483 ctf_integer(dev_t
, dev
,
484 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
485 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
486 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
487 ctf_integer(int, errors
, rq
->errors
)
488 blk_rwbs_ctf_integer(unsigned int, rwbs
,
489 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
490 ctf_sequence_hex(unsigned char, cmd
,
491 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
496 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,5) \
497 || LTTNG_KERNEL_RANGE(3,12,21, 3,13,0) \
498 || LTTNG_KERNEL_RANGE(3,10,41, 3,11,0) \
499 || LTTNG_KERNEL_RANGE(3,4,91, 3,5,0) \
500 || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0) \
501 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,28, 3,14,0,0) \
502 || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0))
504 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
506 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
507 unsigned int nr_bytes
),
509 TP_ARGS(q
, rq
, nr_bytes
),
517 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
518 tp_locvar
->cmd
= rq
->cmd
;
519 tp_locvar
->cmd_len
= rq
->cmd_len
;
521 tp_locvar
->cmd
= NULL
;
522 tp_locvar
->cmd_len
= 0;
527 ctf_integer(dev_t
, dev
,
528 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
529 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
530 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
531 ctf_integer(int, errors
, rq
->errors
)
532 blk_rwbs_ctf_integer(unsigned int, rwbs
,
533 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
534 ctf_sequence_hex(unsigned char, cmd
,
535 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
541 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,15,0)) */
544 * block_rq_complete - block IO operation completed by device driver
545 * @q: queue containing the block operation request
546 * @rq: block operations request
548 * The block_rq_complete tracepoint event indicates that some portion
549 * of operation request has been completed by the device driver. If
550 * the @rq->bio is %NULL, then there is absolutely no additional work to
551 * do for the request. If @rq->bio is non-NULL then there is
552 * additional work required to complete the request.
554 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_complete
,
556 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
561 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,15,0)) */
563 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
564 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
566 TP_PROTO(struct request
*rq
),
571 ctf_integer(dev_t
, dev
,
572 rq
->q
->disk
? disk_devt(rq
->q
->disk
) : 0)
573 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
574 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
575 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
576 ctf_integer(pid_t
, tid
, current
->pid
)
577 blk_rwbs_ctf_integer(unsigned int, rwbs
,
578 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
579 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
582 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
583 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
585 TP_PROTO(struct request
*rq
),
590 ctf_integer(dev_t
, dev
,
591 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
592 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
593 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
594 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
595 ctf_integer(pid_t
, tid
, current
->pid
)
596 blk_rwbs_ctf_integer(unsigned int, rwbs
,
597 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
598 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
601 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
602 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
604 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
609 ctf_integer(dev_t
, dev
,
610 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
611 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
612 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
613 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
614 ctf_integer(pid_t
, tid
, current
->pid
)
615 blk_rwbs_ctf_integer(unsigned int, rwbs
,
616 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
617 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
620 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0))
621 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
623 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
629 unsigned int nr_sector
;
636 if (blk_rq_is_scsi(rq
)) {
637 struct scsi_request
*scsi_rq
= scsi_req(rq
);
638 tp_locvar
->sector
= 0;
639 tp_locvar
->nr_sector
= 0;
640 tp_locvar
->bytes
= scsi_rq
->resid_len
;
641 tp_locvar
->cmd
= scsi_rq
->cmd
;
642 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
644 tp_locvar
->sector
= blk_rq_pos(rq
);
645 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
646 tp_locvar
->bytes
= 0;
647 tp_locvar
->cmd
= NULL
;
648 tp_locvar
->cmd_len
= 0;
653 ctf_integer(dev_t
, dev
,
654 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
655 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
656 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
657 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
658 ctf_integer(pid_t
, tid
, current
->pid
)
659 blk_rwbs_ctf_integer(unsigned int, rwbs
,
660 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
661 ctf_sequence_hex(unsigned char, cmd
,
662 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
663 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
668 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
669 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
671 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
677 unsigned int nr_sector
;
684 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
685 tp_locvar
->sector
= 0;
686 tp_locvar
->nr_sector
= 0;
687 tp_locvar
->bytes
= blk_rq_bytes(rq
);
688 tp_locvar
->cmd
= rq
->cmd
;
689 tp_locvar
->cmd_len
= rq
->cmd_len
;
691 tp_locvar
->sector
= blk_rq_pos(rq
);
692 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
693 tp_locvar
->bytes
= 0;
694 tp_locvar
->cmd
= NULL
;
695 tp_locvar
->cmd_len
= 0;
700 ctf_integer(dev_t
, dev
,
701 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
702 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
703 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
704 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
705 ctf_integer(pid_t
, tid
, current
->pid
)
706 blk_rwbs_ctf_integer(unsigned int, rwbs
,
707 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
708 ctf_sequence_hex(unsigned char, cmd
,
709 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
710 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
715 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
717 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
719 * block_rq_insert - insert block operation request into queue
720 * @rq: block IO operation request
722 * Called immediately before block operation request @rq is inserted
723 * into queue @q. The fields in the operation request @rq struct can
724 * be examined to determine which device and sectors the pending
725 * operation would access.
727 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
729 TP_PROTO(struct request
*rq
),
735 * block_rq_insert - insert block operation request into queue
737 * @rq: block IO operation request
739 * Called immediately before block operation request @rq is inserted
740 * into queue @q. The fields in the operation request @rq struct can
741 * be examined to determine which device and sectors the pending
742 * operation would access.
744 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
746 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
752 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
754 * block_rq_issue - issue pending block IO request operation to device driver
755 * @rq: block IO operation operation request
757 * Called when block operation request @rq from queue @q is sent to a
758 * device driver for processing.
760 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
762 TP_PROTO(struct request
*rq
),
768 * block_rq_issue - issue pending block IO request operation to device driver
769 * @q: queue holding operation
770 * @rq: block IO operation operation request
772 * Called when block operation request @rq from queue @q is sent to a
773 * device driver for processing.
775 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
777 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
783 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
785 * block_rq_merge - merge request with another one in the elevator
786 * @rq: block IO operation operation request
788 * Called when block operation request @rq from queue @q is merged to another
789 * request queued in the elevator.
791 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_merge
,
793 TP_PROTO(struct request
*rq
),
797 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,9,0))
799 * block_rq_merge - merge request with another one in the elevator
800 * @q: queue holding operation
801 * @rq: block IO operation operation request
803 * Called when block operation request @rq from queue @q is merged to another
804 * request queued in the elevator.
806 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_merge
,
808 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
814 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,8,0) || \
815 LTTNG_RHEL_KERNEL_RANGE(4,18,0,305,0,0, 4,19,0,0,0,0))
818 * block_bio_complete - completed all work on the block operation
819 * @q: queue holding the block operation
820 * @bio: block operation completed
821 * @error: io error value
823 * This tracepoint indicates there is no further work to do on this
824 * block IO operation @bio.
826 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
828 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
833 ctf_integer(dev_t
, dev
, bio_dev(bio
))
834 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
835 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
836 ctf_integer(int, error
, blk_status_to_errno(bio
->bi_status
))
837 blk_rwbs_ctf_integer(unsigned int, rwbs
,
838 lttng_bio_op(bio
), lttng_bio_rw(bio
),
839 bio
->bi_iter
.bi_size
)
842 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
844 * block_bio_complete - completed all work on the block operation
845 * @q: queue holding the block operation
846 * @bio: block operation completed
847 * @error: io error value
849 * This tracepoint indicates there is no further work to do on this
850 * block IO operation @bio.
852 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
854 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
856 TP_ARGS(q
, bio
, error
),
859 ctf_integer(dev_t
, dev
, bio_dev(bio
))
860 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
861 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
862 ctf_integer(int, error
, error
)
863 blk_rwbs_ctf_integer(unsigned int, rwbs
,
864 lttng_bio_op(bio
), lttng_bio_rw(bio
),
865 bio
->bi_iter
.bi_size
)
868 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
870 * block_bio_complete - completed all work on the block operation
871 * @q: queue holding the block operation
872 * @bio: block operation completed
873 * @error: io error value
875 * This tracepoint indicates there is no further work to do on this
876 * block IO operation @bio.
878 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
880 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
882 TP_ARGS(q
, bio
, error
),
885 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
886 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
887 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
888 ctf_integer(int, error
, error
)
889 blk_rwbs_ctf_integer(unsigned int, rwbs
,
890 lttng_bio_op(bio
), lttng_bio_rw(bio
),
891 bio
->bi_iter
.bi_size
)
896 * block_bio_complete - completed all work on the block operation
897 * @q: queue holding the block operation
898 * @bio: block operation completed
899 * @error: io error value
901 * This tracepoint indicates there is no further work to do on this
902 * block IO operation @bio.
904 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
906 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
908 TP_ARGS(q
, bio
, error
),
911 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
912 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
913 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
914 ctf_integer(int, error
, error
)
915 blk_rwbs_ctf_integer(unsigned int, rwbs
,
916 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
921 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
922 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
924 TP_PROTO(struct bio
*bio
),
929 ctf_integer(dev_t
, dev
, bio_dev(bio
))
930 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
931 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
932 blk_rwbs_ctf_integer(unsigned int, rwbs
,
933 lttng_bio_op(bio
), lttng_bio_rw(bio
),
934 bio
->bi_iter
.bi_size
)
935 ctf_integer(pid_t
, tid
, current
->pid
)
936 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
939 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
940 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
942 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
947 ctf_integer(dev_t
, dev
, bio_dev(bio
))
948 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
949 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
950 blk_rwbs_ctf_integer(unsigned int, rwbs
,
951 lttng_bio_op(bio
), lttng_bio_rw(bio
),
952 bio
->bi_iter
.bi_size
)
953 ctf_integer(pid_t
, tid
, current
->pid
)
954 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
957 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
958 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
960 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
965 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
966 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
967 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
968 blk_rwbs_ctf_integer(unsigned int, rwbs
,
969 lttng_bio_op(bio
), lttng_bio_rw(bio
),
970 bio
->bi_iter
.bi_size
)
971 ctf_integer(pid_t
, tid
, current
->pid
)
972 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
975 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0))
976 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
978 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
983 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
984 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
985 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
986 blk_rwbs_ctf_integer(unsigned int, rwbs
,
987 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
988 ctf_integer(pid_t
, tid
, current
->pid
)
989 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
996 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
998 * block_bio_bounce - used bounce buffer when processing block operation
999 * @bio: block operation
1001 * A bounce buffer was used to handle the block operation @bio in @q.
1002 * This occurs when hardware limitations prevent a direct transfer of
1003 * data between the @bio data memory area and the IO device. Use of a
1004 * bounce buffer requires extra copying of data and decreases
1007 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_bounce
,
1009 TP_PROTO(struct bio
*bio
),
1013 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1015 * block_bio_bounce - used bounce buffer when processing block operation
1016 * @q: queue holding the block operation
1017 * @bio: block operation
1019 * A bounce buffer was used to handle the block operation @bio in @q.
1020 * This occurs when hardware limitations prevent a direct transfer of
1021 * data between the @bio data memory area and the IO device. Use of a
1022 * bounce buffer requires extra copying of data and decreases
1025 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
1027 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1032 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1033 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1034 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1035 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1036 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1037 bio
->bi_iter
.bi_size
)
1038 ctf_integer(pid_t
, tid
, current
->pid
)
1039 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1042 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
1043 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
1045 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1050 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
1051 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1052 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1053 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1054 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1055 bio
->bi_iter
.bi_size
)
1056 ctf_integer(pid_t
, tid
, current
->pid
)
1057 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1061 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
1063 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1068 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
1069 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1070 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1071 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1072 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1074 ctf_integer(pid_t
, tid
, current
->pid
)
1075 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1081 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1083 * block_bio_backmerge - merging block operation to the end of an existing operation
1084 * @bio: new block operation to merge
1086 * Merging block request @bio to the end of an existing block request.
1088 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
1090 TP_PROTO(struct bio
*bio
),
1096 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
1097 * @bio: new block operation to merge
1099 * Merging block IO operation @bio to the beginning of an existing block request.
1101 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
1103 TP_PROTO(struct bio
*bio
),
1109 * block_bio_queue - putting new block IO operation in queue
1110 * @bio: new block operation
1112 * About to place the block IO operation @bio into queue @q.
1114 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
1116 TP_PROTO(struct bio
*bio
),
1120 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0))
1122 * block_bio_backmerge - merging block operation to the end of an existing operation
1123 * @q: queue holding operation
1124 * @rq: request bio is being merged into
1125 * @bio: new block operation to merge
1127 * Merging block request @bio to the end of an existing block request
1130 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_backmerge
,
1132 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
1138 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
1139 * @q: queue holding operation
1140 * @rq: request bio is being merged into
1141 * @bio: new block operation to merge
1143 * Merging block IO operation @bio to the beginning of an existing block
1144 * operation in queue @q.
1146 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_frontmerge
,
1148 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
1154 * block_bio_queue - putting new block IO operation in queue
1155 * @q: queue holding operation
1156 * @bio: new block operation
1158 * About to place the block IO operation @bio into queue @q.
1160 LTTNG_TRACEPOINT_EVENT(block_bio_queue
,
1162 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1167 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1168 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1170 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1172 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
1173 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1174 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1175 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1176 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1177 bio
->bi_iter
.bi_size
)
1178 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */
1179 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1180 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1181 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1182 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1183 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */
1184 ctf_integer(pid_t
, tid
, current
->pid
)
1185 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1188 #else /* if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) */
1189 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
1191 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1196 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
1197 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1198 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1199 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1200 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1201 ctf_integer(pid_t
, tid
, current
->pid
)
1202 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1207 * block_bio_backmerge - merging block operation to the end of an existing operation
1208 * @q: queue holding operation
1209 * @bio: new block operation to merge
1211 * Merging block request @bio to the end of an existing block request
1214 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
1216 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1222 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
1223 * @q: queue holding operation
1224 * @bio: new block operation to merge
1226 * Merging block IO operation @bio to the beginning of an existing block
1227 * operation in queue @q.
1229 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
1231 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1237 * block_bio_queue - putting new block IO operation in queue
1238 * @q: queue holding operation
1239 * @bio: new block operation
1241 * About to place the block IO operation @bio into queue @q.
1243 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
1245 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1249 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) */
1251 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1253 * block_getrq - get a free request entry in queue for block IO operations
1254 * @bio: pending block IO operation (can be %NULL)
1256 * A request struct has been allocated to handle the block IO operation @bio.
1258 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_getrq
,
1260 TP_PROTO(struct bio
*bio
),
1265 LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq
,
1267 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1269 TP_ARGS(q
, bio
, rw
),
1272 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1273 ctf_integer(dev_t
, dev
, bio
? bio_dev(bio
) : 0)
1275 ctf_integer(dev_t
, dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
1277 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
1278 ctf_integer(sector_t
, sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
1279 ctf_integer(unsigned int, nr_sector
,
1280 bio
? bio_sectors(bio
) : 0)
1281 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1282 bio
? lttng_bio_op(bio
) : 0,
1283 bio
? lttng_bio_rw(bio
) : 0,
1284 bio
? bio
->bi_iter
.bi_size
: 0)
1285 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */
1286 ctf_integer(sector_t
, sector
, bio
? bio
->bi_sector
: 0)
1287 ctf_integer(unsigned int, nr_sector
,
1288 bio
? bio
->bi_size
>> 9 : 0)
1289 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1290 bio
? lttng_bio_op(bio
) : 0,
1291 bio
? lttng_bio_rw(bio
) : 0,
1292 bio
? bio
->bi_size
: 0)
1293 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */
1294 ctf_integer(pid_t
, tid
, current
->pid
)
1295 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1300 * block_getrq - get a free request entry in queue for block IO operations
1301 * @q: queue for operations
1302 * @bio: pending block IO operation (can be %NULL)
1303 * @rw: low bit indicates a read (%0) or a write (%1)
1305 * A request struct for queue @q has been allocated to handle the
1306 * block IO operation @bio.
1308 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_getrq
,
1310 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1316 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
1317 * @q: queue for operation
1318 * @bio: pending block IO operation (can be %NULL)
1319 * @rw: low bit indicates a read (%0) or a write (%1)
1321 * In the case where a request struct cannot be provided for queue @q
1322 * the process needs to wait for an request struct to become
1323 * available. This tracepoint event is generated each time the
1324 * process goes to sleep waiting for request struct become available.
1326 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_sleeprq
,
1328 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1335 * block_plug - keep operations requests in request queue
1336 * @q: request queue to plug
1338 * Plug the request queue @q. Do not allow block operation requests
1339 * to be sent to the device driver. Instead, accumulate requests in
1340 * the queue to improve throughput performance of the block device.
1342 LTTNG_TRACEPOINT_EVENT(block_plug
,
1344 TP_PROTO(struct request_queue
*q
),
1349 ctf_integer(pid_t
, tid
, current
->pid
)
1350 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1354 LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug
,
1356 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
1358 TP_ARGS(q
, depth
, explicit),
1361 ctf_integer(int, nr_rq
, depth
)
1362 ctf_integer(pid_t
, tid
, current
->pid
)
1363 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1368 * block_unplug - release of operations requests in request queue
1369 * @q: request queue to unplug
1370 * @depth: number of requests just added to the queue
1371 * @explicit: whether this was an explicit unplug, or one from schedule()
1373 * Unplug request queue @q because device driver is scheduled to work
1374 * on elements in the request queue.
1376 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug
,
1378 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
1380 TP_ARGS(q
, depth
, explicit)
1383 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1385 * block_split - split a single bio struct into two bio structs
1386 * @bio: block operation being split
1387 * @new_sector: The starting sector for the new bio
1389 * The bio request @bio needs to be split into two bio requests. The newly
1390 * created @bio request starts at @new_sector. This split may be required due to
1391 * hardware limitations such as operation crossing device boundaries in a RAID
1394 LTTNG_TRACEPOINT_EVENT(block_split
,
1396 TP_PROTO(struct bio
*bio
, unsigned int new_sector
),
1398 TP_ARGS(bio
, new_sector
),
1401 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1402 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1403 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1404 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1405 bio
->bi_iter
.bi_size
)
1406 ctf_integer(sector_t
, new_sector
, new_sector
)
1407 ctf_integer(pid_t
, tid
, current
->pid
)
1408 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1412 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1414 * block_split - split a single bio struct into two bio structs
1415 * @q: queue containing the bio
1416 * @bio: block operation being split
1417 * @new_sector: The starting sector for the new bio
1419 * The bio request @bio in request queue @q needs to be split into two
1420 * bio requests. The newly created @bio request starts at
1421 * @new_sector. This split may be required due to hardware limitation
1422 * such as operation crossing device boundaries in a RAID system.
1424 LTTNG_TRACEPOINT_EVENT(block_split
,
1426 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1427 unsigned int new_sector
),
1429 TP_ARGS(q
, bio
, new_sector
),
1432 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1433 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1434 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1435 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1436 bio
->bi_iter
.bi_size
)
1437 ctf_integer(sector_t
, new_sector
, new_sector
)
1438 ctf_integer(pid_t
, tid
, current
->pid
)
1439 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1442 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
1443 LTTNG_TRACEPOINT_EVENT(block_split
,
1445 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1446 unsigned int new_sector
),
1448 TP_ARGS(q
, bio
, new_sector
),
1451 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1452 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1453 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1454 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1455 bio
->bi_iter
.bi_size
)
1456 ctf_integer(sector_t
, new_sector
, new_sector
)
1457 ctf_integer(pid_t
, tid
, current
->pid
)
1458 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1462 LTTNG_TRACEPOINT_EVENT(block_split
,
1464 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1465 unsigned int new_sector
),
1467 TP_ARGS(q
, bio
, new_sector
),
1470 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1471 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1472 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1473 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1474 ctf_integer(sector_t
, new_sector
, new_sector
)
1475 ctf_integer(pid_t
, tid
, current
->pid
)
1476 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1481 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1483 * block_bio_remap - map request for a logical device to the raw device
1484 * @bio: revised operation
1485 * @dev: original device for the operation
1486 * @from: original sector for the operation
1488 * An operation for a logical device has been mapped to the
1491 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1493 TP_PROTO(struct bio
*bio
, dev_t dev
, sector_t from
),
1495 TP_ARGS(bio
, dev
, from
),
1498 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1499 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1500 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1501 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1502 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1503 bio
->bi_iter
.bi_size
)
1504 ctf_integer(dev_t
, old_dev
, dev
)
1505 ctf_integer(sector_t
, old_sector
, from
)
1508 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1510 * block_bio_remap - map request for a logical device to the raw device
1511 * @q: queue holding the operation
1512 * @bio: revised operation
1513 * @dev: device for the operation
1514 * @from: original sector for the operation
1516 * An operation for a logical device has been mapped to the
1519 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1521 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1524 TP_ARGS(q
, bio
, dev
, from
),
1527 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1528 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1529 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1530 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1531 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1532 bio
->bi_iter
.bi_size
)
1533 ctf_integer(dev_t
, old_dev
, dev
)
1534 ctf_integer(sector_t
, old_sector
, from
)
1537 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0))
1538 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1540 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1543 TP_ARGS(q
, bio
, dev
, from
),
1546 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1547 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1548 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1549 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1550 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1551 bio
->bi_iter
.bi_size
)
1552 ctf_integer(dev_t
, old_dev
, dev
)
1553 ctf_integer(sector_t
, old_sector
, from
)
1557 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1559 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1562 TP_ARGS(q
, bio
, dev
, from
),
1565 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1566 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1567 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1568 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1569 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1570 ctf_integer(dev_t
, old_dev
, dev
)
1571 ctf_integer(sector_t
, old_sector
, from
)
1576 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
1578 * block_rq_remap - map request for a block operation request
1579 * @rq: block IO operation request
1580 * @dev: device for the operation
1581 * @from: original sector for the operation
1583 * The block operation request @rq in @q has been remapped. The block
1584 * operation request @rq holds the current information and @from hold
1585 * the original sector.
1587 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1589 TP_PROTO(struct request
*rq
, dev_t dev
, sector_t from
),
1591 TP_ARGS(rq
, dev
, from
),
1594 ctf_integer(dev_t
, dev
, disk_devt(rq
->q
->disk
))
1595 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1596 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1597 ctf_integer(dev_t
, old_dev
, dev
)
1598 ctf_integer(sector_t
, old_sector
, from
)
1599 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1600 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1603 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1605 * block_rq_remap - map request for a block operation request
1606 * @rq: block IO operation request
1607 * @dev: device for the operation
1608 * @from: original sector for the operation
1610 * The block operation request @rq in @q has been remapped. The block
1611 * operation request @rq holds the current information and @from hold
1612 * the original sector.
1614 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1616 TP_PROTO(struct request
*rq
, dev_t dev
, sector_t from
),
1618 TP_ARGS(rq
, dev
, from
),
1621 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1622 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1623 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1624 ctf_integer(dev_t
, old_dev
, dev
)
1625 ctf_integer(sector_t
, old_sector
, from
)
1626 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1627 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1632 * block_rq_remap - map request for a block operation request
1633 * @q: queue holding the operation
1634 * @rq: block IO operation request
1635 * @dev: device for the operation
1636 * @from: original sector for the operation
1638 * The block operation request @rq in @q has been remapped. The block
1639 * operation request @rq holds the current information and @from hold
1640 * the original sector.
1642 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1644 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
1647 TP_ARGS(q
, rq
, dev
, from
),
1650 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1651 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1652 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1653 ctf_integer(dev_t
, old_dev
, dev
)
1654 ctf_integer(sector_t
, old_sector
, from
)
1655 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1656 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1661 #undef __print_rwbs_flags
1662 #undef blk_fill_rwbs
1664 #endif /* LTTNG_TRACE_BLOCK_H */
1666 /* This part must be outside protection */
1667 #include <probes/define_trace.h>
This page took 0.06612 seconds and 4 git commands to generate.