1 /* SPDX-License-Identifier: GPL-2.0-only */
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 <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_KERNEL_RANGE(4,11,0, 5,18,0)
15 #include <scsi/scsi_request.h>
16 #endif /* LTTNG_KERNEL_RANGE(4,11,0, 5,18,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 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0))
70 #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
71 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
72 ctf_enum(block_rq_type, type, rwbs, \
73 ( (op) == REQ_OP_WRITE ? RWBS_FLAG_WRITE : \
74 ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
75 ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
76 ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
77 ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
79 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
80 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
81 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
82 | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
83 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
85 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
86 ctf_integer(type, rwbs, \
87 ( (op) == REQ_OP_WRITE ? RWBS_FLAG_WRITE : \
88 ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
89 ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
90 ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
91 ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
93 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
94 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
95 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
96 | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
97 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
98 #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */
100 #else /* (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0)) */
102 #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
103 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
104 ctf_enum(block_rq_type, type, rwbs, \
105 (((op) == REQ_OP_WRITE || (op) == REQ_OP_WRITE_SAME) ? RWBS_FLAG_WRITE : \
106 ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
107 ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
108 ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
109 ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
111 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
112 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
113 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
114 | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
115 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
117 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
118 ctf_integer(type, rwbs, \
119 (((op) == REQ_OP_WRITE || (op) == REQ_OP_WRITE_SAME) ? RWBS_FLAG_WRITE : \
120 ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
121 ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
122 ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
123 ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
125 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
126 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
127 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
128 | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
129 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
130 #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */
131 #endif /* (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0)) */
135 #define lttng_req_op(rq)
136 #define lttng_req_rw(rq) ((rq)->cmd_flags)
137 #define lttng_bio_op(bio)
138 #define lttng_bio_rw(bio) ((bio)->bi_rw)
140 #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
141 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
142 ctf_enum(block_rq_type, type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
143 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
144 ( (bytes) ? RWBS_FLAG_READ : \
146 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
147 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
148 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
149 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \
150 | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \
151 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
153 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
154 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
155 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
156 ( (bytes) ? RWBS_FLAG_READ : \
158 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
159 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
160 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
161 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \
162 | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \
163 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
164 #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */
167 LTTNG_TRACEPOINT_EVENT_CLASS(block_buffer
,
169 TP_PROTO(struct buffer_head
*bh
),
174 ctf_integer(dev_t
, dev
, bh
->b_bdev
->bd_dev
)
175 ctf_integer(sector_t
, sector
, bh
->b_blocknr
)
176 ctf_integer(size_t, size
, bh
->b_size
)
181 * block_touch_buffer - mark a buffer accessed
182 * @bh: buffer_head being touched
184 * Called from touch_buffer().
186 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_touch_buffer
,
188 TP_PROTO(struct buffer_head
*bh
),
194 * block_dirty_buffer - mark a buffer dirty
195 * @bh: buffer_head being dirtied
197 * Called from mark_buffer_dirty().
199 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_dirty_buffer
,
201 TP_PROTO(struct buffer_head
*bh
),
206 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
207 /* block_rq_with_error event class removed in kernel 4.12 */
208 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0))
209 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
211 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
217 unsigned int nr_sector
;
223 if (blk_rq_is_scsi(rq
)) {
224 struct scsi_request
*scsi_rq
= scsi_req(rq
);
225 tp_locvar
->sector
= 0;
226 tp_locvar
->nr_sector
= 0;
227 tp_locvar
->cmd
= scsi_rq
->cmd
;
228 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
230 tp_locvar
->sector
= blk_rq_pos(rq
);
231 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
232 tp_locvar
->cmd
= NULL
;
233 tp_locvar
->cmd_len
= 0;
238 ctf_integer(dev_t
, dev
,
239 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
240 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
241 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
242 ctf_integer(int, errors
, rq
->errors
)
243 blk_rwbs_ctf_integer(unsigned int, rwbs
,
244 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
245 ctf_sequence_hex(unsigned char, cmd
,
246 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
251 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
252 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
254 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
260 unsigned int nr_sector
;
267 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
268 tp_locvar
->sector
= 0;
269 tp_locvar
->nr_sector
= 0;
270 tp_locvar
->cmd
= rq
->cmd
;
271 tp_locvar
->cmd_len
= rq
->cmd_len
;
273 tp_locvar
->sector
= blk_rq_pos(rq
);
274 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
275 tp_locvar
->cmd
= NULL
;
276 tp_locvar
->cmd_len
= 0;
281 ctf_integer(dev_t
, dev
,
282 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
283 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
284 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
285 ctf_integer(int, errors
, rq
->errors
)
286 blk_rwbs_ctf_integer(unsigned int, rwbs
,
287 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
288 ctf_sequence_hex(unsigned char, cmd
,
289 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
294 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
296 #if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(4,12,0))
298 * block_rq_abort - abort block operation request
299 * @q: queue containing the block operation request
300 * @rq: block IO operation request
302 * Called immediately after pending block IO operation request @rq in
303 * queue @q is aborted. The fields in the operation request @rq
304 * can be examined to determine which device and sectors the pending
305 * operation would access.
307 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_abort
,
309 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
315 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
317 * block_rq_requeue - place block IO request back on a queue
318 * @rq: block IO operation request
320 * The block operation request @rq is being placed back into queue
321 * @q. For some reason the request was not completed and needs to be
322 * put back in the queue.
324 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
326 TP_PROTO(struct request
*rq
),
331 ctf_integer(dev_t
, dev
,
332 rq
->q
->disk
? disk_devt(rq
->q
->disk
) : 0)
333 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
334 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
335 blk_rwbs_ctf_integer(unsigned int, rwbs
,
336 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
339 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
340 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
341 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
343 * block_rq_requeue - place block IO request back on a queue
344 * @rq: block IO operation request
346 * The block operation request @rq is being placed back into queue
347 * @q. For some reason the request was not completed and needs to be
348 * put back in the queue.
350 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
352 TP_PROTO(struct request
*rq
),
357 ctf_integer(dev_t
, dev
,
358 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
359 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
360 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
361 blk_rwbs_ctf_integer(unsigned int, rwbs
,
362 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
365 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
367 * block_rq_requeue - place block IO request back on a queue
368 * @q: queue holding operation
369 * @rq: block IO operation request
371 * The block operation request @rq is being placed back into queue
372 * @q. For some reason the request was not completed and needs to be
373 * put back in the queue.
375 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
377 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
382 ctf_integer(dev_t
, dev
,
383 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
384 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
385 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
386 blk_rwbs_ctf_integer(unsigned int, rwbs
,
387 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
391 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_requeue
,
393 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
400 * block_rq_complete - block IO operation completed by device driver
401 * @q: queue containing the block operation request
402 * @rq: block operations request
403 * @nr_bytes: number of completed bytes
405 * The block_rq_complete tracepoint event indicates that some portion
406 * of operation request has been completed by the device driver. If
407 * the @rq->bio is %NULL, then there is absolutely no additional work to
408 * do for the request. If @rq->bio is non-NULL then there is
409 * additional work required to complete the request.
411 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
412 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
414 TP_PROTO(struct request
*rq
, blk_status_t error
, unsigned int nr_bytes
),
416 TP_ARGS(rq
, error
, nr_bytes
),
419 ctf_integer(dev_t
, dev
,
420 rq
->q
->disk
? disk_devt(rq
->q
->disk
) : 0)
421 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
422 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
423 ctf_integer(int, error
, blk_status_to_errno(error
))
424 blk_rwbs_ctf_integer(unsigned int, rwbs
,
425 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
428 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,16,0) \
429 || LTTNG_RHEL_KERNEL_RANGE(5,14,0,70,0,0, 5,15,0,0,0,0))
430 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
432 TP_PROTO(struct request
*rq
, blk_status_t error
, unsigned int nr_bytes
),
434 TP_ARGS(rq
, error
, nr_bytes
),
437 ctf_integer(dev_t
, dev
,
438 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
439 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
440 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
441 ctf_integer(int, error
, blk_status_to_errno(error
))
442 blk_rwbs_ctf_integer(unsigned int, rwbs
,
443 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
446 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
447 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
449 TP_PROTO(struct request
*rq
, int error
, unsigned int nr_bytes
),
451 TP_ARGS(rq
, error
, nr_bytes
),
454 ctf_integer(dev_t
, dev
,
455 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
456 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
457 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
458 ctf_integer(int, error
, error
)
459 blk_rwbs_ctf_integer(unsigned int, rwbs
,
460 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
463 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0))
464 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
466 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
467 unsigned int nr_bytes
),
469 TP_ARGS(q
, rq
, nr_bytes
),
477 if (blk_rq_is_scsi(rq
)) {
478 struct scsi_request
*scsi_rq
= scsi_req(rq
);
479 tp_locvar
->cmd
= scsi_rq
->cmd
;
480 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
482 tp_locvar
->cmd
= NULL
;
483 tp_locvar
->cmd_len
= 0;
488 ctf_integer(dev_t
, dev
,
489 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
490 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
491 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
492 ctf_integer(int, errors
, rq
->errors
)
493 blk_rwbs_ctf_integer(unsigned int, rwbs
,
494 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
495 ctf_sequence_hex(unsigned char, cmd
,
496 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
502 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
504 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
505 unsigned int nr_bytes
),
507 TP_ARGS(q
, rq
, nr_bytes
),
515 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
516 tp_locvar
->cmd
= rq
->cmd
;
517 tp_locvar
->cmd_len
= rq
->cmd_len
;
519 tp_locvar
->cmd
= NULL
;
520 tp_locvar
->cmd_len
= 0;
525 ctf_integer(dev_t
, dev
,
526 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
527 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
528 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
529 ctf_integer(int, errors
, rq
->errors
)
530 blk_rwbs_ctf_integer(unsigned int, rwbs
,
531 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
532 ctf_sequence_hex(unsigned char, cmd
,
533 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
540 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
541 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
543 TP_PROTO(struct request
*rq
),
548 ctf_integer(dev_t
, dev
,
549 rq
->q
->disk
? disk_devt(rq
->q
->disk
) : 0)
550 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
551 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
552 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
553 ctf_integer(pid_t
, tid
, current
->pid
)
554 blk_rwbs_ctf_integer(unsigned int, rwbs
,
555 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
556 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
559 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
560 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
561 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
562 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
564 TP_PROTO(struct request
*rq
),
569 ctf_integer(dev_t
, dev
,
570 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
571 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
572 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
573 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
574 ctf_integer(pid_t
, tid
, current
->pid
)
575 blk_rwbs_ctf_integer(unsigned int, rwbs
,
576 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
577 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
580 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
581 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
583 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
588 ctf_integer(dev_t
, dev
,
589 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
590 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
591 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
592 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
593 ctf_integer(pid_t
, tid
, current
->pid
)
594 blk_rwbs_ctf_integer(unsigned int, rwbs
,
595 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
596 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
599 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0))
600 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
602 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
608 unsigned int nr_sector
;
615 if (blk_rq_is_scsi(rq
)) {
616 struct scsi_request
*scsi_rq
= scsi_req(rq
);
617 tp_locvar
->sector
= 0;
618 tp_locvar
->nr_sector
= 0;
619 tp_locvar
->bytes
= scsi_rq
->resid_len
;
620 tp_locvar
->cmd
= scsi_rq
->cmd
;
621 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
623 tp_locvar
->sector
= blk_rq_pos(rq
);
624 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
625 tp_locvar
->bytes
= 0;
626 tp_locvar
->cmd
= NULL
;
627 tp_locvar
->cmd_len
= 0;
632 ctf_integer(dev_t
, dev
,
633 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
634 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
635 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
636 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
637 ctf_integer(pid_t
, tid
, current
->pid
)
638 blk_rwbs_ctf_integer(unsigned int, rwbs
,
639 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
640 ctf_sequence_hex(unsigned char, cmd
,
641 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
642 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
647 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
648 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
650 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
656 unsigned int nr_sector
;
663 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
664 tp_locvar
->sector
= 0;
665 tp_locvar
->nr_sector
= 0;
666 tp_locvar
->bytes
= blk_rq_bytes(rq
);
667 tp_locvar
->cmd
= rq
->cmd
;
668 tp_locvar
->cmd_len
= rq
->cmd_len
;
670 tp_locvar
->sector
= blk_rq_pos(rq
);
671 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
672 tp_locvar
->bytes
= 0;
673 tp_locvar
->cmd
= NULL
;
674 tp_locvar
->cmd_len
= 0;
679 ctf_integer(dev_t
, dev
,
680 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
681 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
682 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
683 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
684 ctf_integer(pid_t
, tid
, current
->pid
)
685 blk_rwbs_ctf_integer(unsigned int, rwbs
,
686 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
687 ctf_sequence_hex(unsigned char, cmd
,
688 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
689 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
694 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
696 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
697 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
698 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
700 * block_rq_insert - insert block operation request into queue
701 * @rq: block IO operation request
703 * Called immediately before block operation request @rq is inserted
704 * into queue @q. The fields in the operation request @rq struct can
705 * be examined to determine which device and sectors the pending
706 * operation would access.
708 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
710 TP_PROTO(struct request
*rq
),
716 * block_rq_insert - insert block operation request into queue
718 * @rq: block IO operation request
720 * Called immediately before block operation request @rq is inserted
721 * into queue @q. The fields in the operation request @rq struct can
722 * be examined to determine which device and sectors the pending
723 * operation would access.
725 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
727 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
733 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
734 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
735 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
737 * block_rq_issue - issue pending block IO request operation to device driver
738 * @rq: block IO operation operation request
740 * Called when block operation request @rq from queue @q is sent to a
741 * device driver for processing.
743 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
745 TP_PROTO(struct request
*rq
),
751 * block_rq_issue - issue pending block IO request operation to device driver
752 * @q: queue holding operation
753 * @rq: block IO operation operation request
755 * Called when block operation request @rq from queue @q is sent to a
756 * device driver for processing.
758 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
760 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
766 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
767 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0))
769 * block_rq_merge - merge request with another one in the elevator
770 * @rq: block IO operation operation request
772 * Called when block operation request @rq from queue @q is merged to another
773 * request queued in the elevator.
775 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_merge
,
777 TP_PROTO(struct request
*rq
),
781 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,9,0))
783 * block_rq_merge - merge request with another one in the elevator
784 * @q: queue holding operation
785 * @rq: block IO operation operation request
787 * Called when block operation request @rq from queue @q is merged to another
788 * request queued in the elevator.
790 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_merge
,
792 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
798 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,8,0) || \
799 LTTNG_RHEL_KERNEL_RANGE(4,18,0,305,0,0, 4,19,0,0,0,0))
802 * block_bio_complete - completed all work on the block operation
803 * @q: queue holding the block operation
804 * @bio: block operation completed
805 * @error: io error value
807 * This tracepoint indicates there is no further work to do on this
808 * block IO operation @bio.
810 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
812 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
817 ctf_integer(dev_t
, dev
, bio_dev(bio
))
818 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
819 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
820 ctf_integer(int, error
, blk_status_to_errno(bio
->bi_status
))
821 blk_rwbs_ctf_integer(unsigned int, rwbs
,
822 lttng_bio_op(bio
), lttng_bio_rw(bio
),
823 bio
->bi_iter
.bi_size
)
826 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
828 * block_bio_complete - completed all work on the block operation
829 * @q: queue holding the block operation
830 * @bio: block operation completed
831 * @error: io error value
833 * This tracepoint indicates there is no further work to do on this
834 * block IO operation @bio.
836 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
838 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
840 TP_ARGS(q
, bio
, error
),
843 ctf_integer(dev_t
, dev
, bio_dev(bio
))
844 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
845 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
846 ctf_integer(int, error
, error
)
847 blk_rwbs_ctf_integer(unsigned int, rwbs
,
848 lttng_bio_op(bio
), lttng_bio_rw(bio
),
849 bio
->bi_iter
.bi_size
)
854 * block_bio_complete - completed all work on the block operation
855 * @q: queue holding the block operation
856 * @bio: block operation completed
857 * @error: io error value
859 * This tracepoint indicates there is no further work to do on this
860 * block IO operation @bio.
862 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
864 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
866 TP_ARGS(q
, bio
, error
),
869 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
870 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
871 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
872 ctf_integer(int, error
, error
)
873 blk_rwbs_ctf_integer(unsigned int, rwbs
,
874 lttng_bio_op(bio
), lttng_bio_rw(bio
),
875 bio
->bi_iter
.bi_size
)
880 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
881 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
883 TP_PROTO(struct bio
*bio
),
888 ctf_integer(dev_t
, dev
, bio_dev(bio
))
889 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
890 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
891 blk_rwbs_ctf_integer(unsigned int, rwbs
,
892 lttng_bio_op(bio
), lttng_bio_rw(bio
),
893 bio
->bi_iter
.bi_size
)
894 ctf_integer(pid_t
, tid
, current
->pid
)
895 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
898 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
899 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
901 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
906 ctf_integer(dev_t
, dev
, bio_dev(bio
))
907 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
908 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
909 blk_rwbs_ctf_integer(unsigned int, rwbs
,
910 lttng_bio_op(bio
), lttng_bio_rw(bio
),
911 bio
->bi_iter
.bi_size
)
912 ctf_integer(pid_t
, tid
, current
->pid
)
913 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
917 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
919 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
924 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
925 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
926 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
927 blk_rwbs_ctf_integer(unsigned int, rwbs
,
928 lttng_bio_op(bio
), lttng_bio_rw(bio
),
929 bio
->bi_iter
.bi_size
)
930 ctf_integer(pid_t
, tid
, current
->pid
)
931 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
938 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
940 * block_bio_bounce - used bounce buffer when processing block operation
941 * @bio: block operation
943 * A bounce buffer was used to handle the block operation @bio in @q.
944 * This occurs when hardware limitations prevent a direct transfer of
945 * data between the @bio data memory area and the IO device. Use of a
946 * bounce buffer requires extra copying of data and decreases
949 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_bounce
,
951 TP_PROTO(struct bio
*bio
),
955 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
957 * block_bio_bounce - used bounce buffer when processing block operation
958 * @q: queue holding the block operation
959 * @bio: block operation
961 * A bounce buffer was used to handle the block operation @bio in @q.
962 * This occurs when hardware limitations prevent a direct transfer of
963 * data between the @bio data memory area and the IO device. Use of a
964 * bounce buffer requires extra copying of data and decreases
967 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
969 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
974 ctf_integer(dev_t
, dev
, bio_dev(bio
))
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
)
985 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
987 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
992 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
993 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
994 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
995 blk_rwbs_ctf_integer(unsigned int, rwbs
,
996 lttng_bio_op(bio
), lttng_bio_rw(bio
),
997 bio
->bi_iter
.bi_size
)
998 ctf_integer(pid_t
, tid
, current
->pid
)
999 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_backmerge - merging block operation to the end of an existing operation
1008 * @bio: new block operation to merge
1010 * Merging block request @bio to the end of an existing block request.
1012 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
1014 TP_PROTO(struct bio
*bio
),
1020 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
1021 * @bio: new block operation to merge
1023 * Merging block IO operation @bio to the beginning of an existing block request.
1025 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
1027 TP_PROTO(struct bio
*bio
),
1033 * block_bio_queue - putting new block IO operation in queue
1034 * @bio: new block operation
1036 * About to place the block IO operation @bio into queue @q.
1038 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
1040 TP_PROTO(struct bio
*bio
),
1046 * block_bio_backmerge - merging block operation to the end of an existing operation
1047 * @q: queue holding operation
1048 * @rq: request bio is being merged into
1049 * @bio: new block operation to merge
1051 * Merging block request @bio to the end of an existing block request
1054 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_backmerge
,
1056 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
1062 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
1063 * @q: queue holding operation
1064 * @rq: request bio is being merged into
1065 * @bio: new block operation to merge
1067 * Merging block IO operation @bio to the beginning of an existing block
1068 * operation in queue @q.
1070 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_frontmerge
,
1072 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
1078 * block_bio_queue - putting new block IO operation in queue
1079 * @q: queue holding operation
1080 * @bio: new block operation
1082 * About to place the block IO operation @bio into queue @q.
1084 LTTNG_TRACEPOINT_EVENT(block_bio_queue
,
1086 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1091 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1092 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1094 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1096 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1097 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1098 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1099 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1100 bio
->bi_iter
.bi_size
)
1101 ctf_integer(pid_t
, tid
, current
->pid
)
1102 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1105 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) */
1107 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1109 * block_getrq - get a free request entry in queue for block IO operations
1110 * @bio: pending block IO operation (can be %NULL)
1112 * A request struct has been allocated to handle the block IO operation @bio.
1114 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_getrq
,
1116 TP_PROTO(struct bio
*bio
),
1121 LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq
,
1123 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1125 TP_ARGS(q
, bio
, rw
),
1128 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1129 ctf_integer(dev_t
, dev
, bio
? bio_dev(bio
) : 0)
1131 ctf_integer(dev_t
, dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
1133 ctf_integer(sector_t
, sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
1134 ctf_integer(unsigned int, nr_sector
,
1135 bio
? bio_sectors(bio
) : 0)
1136 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1137 bio
? lttng_bio_op(bio
) : 0,
1138 bio
? lttng_bio_rw(bio
) : 0,
1139 bio
? bio
->bi_iter
.bi_size
: 0)
1140 ctf_integer(pid_t
, tid
, current
->pid
)
1141 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1146 * block_getrq - get a free request entry in queue for block IO operations
1147 * @q: queue for operations
1148 * @bio: pending block IO operation (can be %NULL)
1149 * @rw: low bit indicates a read (%0) or a write (%1)
1151 * A request struct for queue @q has been allocated to handle the
1152 * block IO operation @bio.
1154 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_getrq
,
1156 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1162 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
1163 * @q: queue for operation
1164 * @bio: pending block IO operation (can be %NULL)
1165 * @rw: low bit indicates a read (%0) or a write (%1)
1167 * In the case where a request struct cannot be provided for queue @q
1168 * the process needs to wait for an request struct to become
1169 * available. This tracepoint event is generated each time the
1170 * process goes to sleep waiting for request struct become available.
1172 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_sleeprq
,
1174 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1181 * block_plug - keep operations requests in request queue
1182 * @q: request queue to plug
1184 * Plug the request queue @q. Do not allow block operation requests
1185 * to be sent to the device driver. Instead, accumulate requests in
1186 * the queue to improve throughput performance of the block device.
1188 LTTNG_TRACEPOINT_EVENT(block_plug
,
1190 TP_PROTO(struct request_queue
*q
),
1195 ctf_integer(pid_t
, tid
, current
->pid
)
1196 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1200 LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug
,
1202 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
1204 TP_ARGS(q
, depth
, explicit),
1207 ctf_integer(int, nr_rq
, depth
)
1208 ctf_integer(pid_t
, tid
, current
->pid
)
1209 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1214 * block_unplug - release of operations requests in request queue
1215 * @q: request queue to unplug
1216 * @depth: number of requests just added to the queue
1217 * @explicit: whether this was an explicit unplug, or one from schedule()
1219 * Unplug request queue @q because device driver is scheduled to work
1220 * on elements in the request queue.
1222 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug
,
1224 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
1226 TP_ARGS(q
, depth
, explicit)
1229 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1231 * block_split - split a single bio struct into two bio structs
1232 * @bio: block operation being split
1233 * @new_sector: The starting sector for the new bio
1235 * The bio request @bio needs to be split into two bio requests. The newly
1236 * created @bio request starts at @new_sector. This split may be required due to
1237 * hardware limitations such as operation crossing device boundaries in a RAID
1240 LTTNG_TRACEPOINT_EVENT(block_split
,
1242 TP_PROTO(struct bio
*bio
, unsigned int new_sector
),
1244 TP_ARGS(bio
, new_sector
),
1247 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1248 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1249 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1250 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1251 bio
->bi_iter
.bi_size
)
1252 ctf_integer(sector_t
, new_sector
, new_sector
)
1253 ctf_integer(pid_t
, tid
, current
->pid
)
1254 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1258 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1260 * block_split - split a single bio struct into two bio structs
1261 * @q: queue containing the bio
1262 * @bio: block operation being split
1263 * @new_sector: The starting sector for the new bio
1265 * The bio request @bio in request queue @q needs to be split into two
1266 * bio requests. The newly created @bio request starts at
1267 * @new_sector. This split may be required due to hardware limitation
1268 * such as operation crossing device boundaries in a RAID system.
1270 LTTNG_TRACEPOINT_EVENT(block_split
,
1272 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1273 unsigned int new_sector
),
1275 TP_ARGS(q
, bio
, new_sector
),
1278 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1279 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1280 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1281 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1282 bio
->bi_iter
.bi_size
)
1283 ctf_integer(sector_t
, new_sector
, new_sector
)
1284 ctf_integer(pid_t
, tid
, current
->pid
)
1285 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1289 LTTNG_TRACEPOINT_EVENT(block_split
,
1291 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1292 unsigned int new_sector
),
1294 TP_ARGS(q
, bio
, new_sector
),
1297 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1298 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1299 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1300 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1301 bio
->bi_iter
.bi_size
)
1302 ctf_integer(sector_t
, new_sector
, new_sector
)
1303 ctf_integer(pid_t
, tid
, current
->pid
)
1304 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1309 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1311 * block_bio_remap - map request for a logical device to the raw device
1312 * @bio: revised operation
1313 * @dev: original device for the operation
1314 * @from: original sector for the operation
1316 * An operation for a logical device has been mapped to the
1319 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1321 TP_PROTO(struct bio
*bio
, dev_t dev
, sector_t from
),
1323 TP_ARGS(bio
, dev
, from
),
1326 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1327 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1328 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1329 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1330 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1331 bio
->bi_iter
.bi_size
)
1332 ctf_integer(dev_t
, old_dev
, dev
)
1333 ctf_integer(sector_t
, old_sector
, from
)
1336 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1338 * block_bio_remap - map request for a logical device to the raw device
1339 * @q: queue holding the operation
1340 * @bio: revised operation
1341 * @dev: device for the operation
1342 * @from: original sector for the operation
1344 * An operation for a logical device has been mapped to the
1347 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1349 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1352 TP_ARGS(q
, bio
, dev
, from
),
1355 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1356 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1357 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1358 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1359 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1360 bio
->bi_iter
.bi_size
)
1361 ctf_integer(dev_t
, old_dev
, dev
)
1362 ctf_integer(sector_t
, old_sector
, from
)
1366 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1368 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1371 TP_ARGS(q
, bio
, dev
, from
),
1374 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1375 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1376 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1377 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1378 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1379 bio
->bi_iter
.bi_size
)
1380 ctf_integer(dev_t
, old_dev
, dev
)
1381 ctf_integer(sector_t
, old_sector
, from
)
1386 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
1388 * block_rq_remap - map request for a block operation request
1389 * @rq: block IO operation request
1390 * @dev: device for the operation
1391 * @from: original sector for the operation
1393 * The block operation request @rq in @q has been remapped. The block
1394 * operation request @rq holds the current information and @from hold
1395 * the original sector.
1397 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1399 TP_PROTO(struct request
*rq
, dev_t dev
, sector_t from
),
1401 TP_ARGS(rq
, dev
, from
),
1404 ctf_integer(dev_t
, dev
, disk_devt(rq
->q
->disk
))
1405 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1406 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1407 ctf_integer(dev_t
, old_dev
, dev
)
1408 ctf_integer(sector_t
, old_sector
, from
)
1409 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1410 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1413 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
1414 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
1415 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
1417 * block_rq_remap - map request for a block operation request
1418 * @rq: block IO operation request
1419 * @dev: device for the operation
1420 * @from: original sector for the operation
1422 * The block operation request @rq in @q has been remapped. The block
1423 * operation request @rq holds the current information and @from hold
1424 * the original sector.
1426 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1428 TP_PROTO(struct request
*rq
, dev_t dev
, sector_t from
),
1430 TP_ARGS(rq
, dev
, from
),
1433 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1434 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1435 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1436 ctf_integer(dev_t
, old_dev
, dev
)
1437 ctf_integer(sector_t
, old_sector
, from
)
1438 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1439 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1444 * block_rq_remap - map request for a block operation request
1445 * @q: queue holding the operation
1446 * @rq: block IO operation request
1447 * @dev: device for the operation
1448 * @from: original sector for the operation
1450 * The block operation request @rq in @q has been remapped. The block
1451 * operation request @rq holds the current information and @from hold
1452 * the original sector.
1454 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1456 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
1459 TP_ARGS(q
, rq
, dev
, from
),
1462 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1463 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1464 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1465 ctf_integer(dev_t
, old_dev
, dev
)
1466 ctf_integer(sector_t
, old_sector
, from
)
1467 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1468 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1473 #undef __print_rwbs_flags
1474 #undef blk_fill_rwbs
1476 #endif /* LTTNG_TRACE_BLOCK_H */
1478 /* This part must be outside protection */
1479 #include <lttng/define_trace.h>
This page took 0.060913 seconds and 5 git commands to generate.