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_TRACEPOINT_EVENT(block_rq_complete
,
431 TP_PROTO(struct request
*rq
, blk_status_t error
, unsigned int nr_bytes
),
433 TP_ARGS(rq
, error
, nr_bytes
),
436 ctf_integer(dev_t
, dev
,
437 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
438 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
439 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
440 ctf_integer(int, error
, blk_status_to_errno(error
))
441 blk_rwbs_ctf_integer(unsigned int, rwbs
,
442 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
445 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
446 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
448 TP_PROTO(struct request
*rq
, int error
, unsigned int nr_bytes
),
450 TP_ARGS(rq
, error
, nr_bytes
),
453 ctf_integer(dev_t
, dev
,
454 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
455 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
456 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
457 ctf_integer(int, error
, error
)
458 blk_rwbs_ctf_integer(unsigned int, rwbs
,
459 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
462 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0))
463 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
465 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
466 unsigned int nr_bytes
),
468 TP_ARGS(q
, rq
, nr_bytes
),
476 if (blk_rq_is_scsi(rq
)) {
477 struct scsi_request
*scsi_rq
= scsi_req(rq
);
478 tp_locvar
->cmd
= scsi_rq
->cmd
;
479 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
481 tp_locvar
->cmd
= NULL
;
482 tp_locvar
->cmd_len
= 0;
487 ctf_integer(dev_t
, dev
,
488 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
489 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
490 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
491 ctf_integer(int, errors
, rq
->errors
)
492 blk_rwbs_ctf_integer(unsigned int, rwbs
,
493 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
494 ctf_sequence_hex(unsigned char, cmd
,
495 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
501 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
503 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
504 unsigned int nr_bytes
),
506 TP_ARGS(q
, rq
, nr_bytes
),
514 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
515 tp_locvar
->cmd
= rq
->cmd
;
516 tp_locvar
->cmd_len
= rq
->cmd_len
;
518 tp_locvar
->cmd
= NULL
;
519 tp_locvar
->cmd_len
= 0;
524 ctf_integer(dev_t
, dev
,
525 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
526 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
527 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
528 ctf_integer(int, errors
, rq
->errors
)
529 blk_rwbs_ctf_integer(unsigned int, rwbs
,
530 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
531 ctf_sequence_hex(unsigned char, cmd
,
532 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
539 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
540 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
542 TP_PROTO(struct request
*rq
),
547 ctf_integer(dev_t
, dev
,
548 rq
->q
->disk
? disk_devt(rq
->q
->disk
) : 0)
549 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
550 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
551 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
552 ctf_integer(pid_t
, tid
, current
->pid
)
553 blk_rwbs_ctf_integer(unsigned int, rwbs
,
554 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
555 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
558 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
559 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
560 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
561 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
563 TP_PROTO(struct request
*rq
),
568 ctf_integer(dev_t
, dev
,
569 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
570 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
571 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
572 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
573 ctf_integer(pid_t
, tid
, current
->pid
)
574 blk_rwbs_ctf_integer(unsigned int, rwbs
,
575 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
576 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
579 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
580 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
582 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
587 ctf_integer(dev_t
, dev
,
588 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
589 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
590 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
591 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
592 ctf_integer(pid_t
, tid
, current
->pid
)
593 blk_rwbs_ctf_integer(unsigned int, rwbs
,
594 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
595 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
598 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0))
599 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
601 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
607 unsigned int nr_sector
;
614 if (blk_rq_is_scsi(rq
)) {
615 struct scsi_request
*scsi_rq
= scsi_req(rq
);
616 tp_locvar
->sector
= 0;
617 tp_locvar
->nr_sector
= 0;
618 tp_locvar
->bytes
= scsi_rq
->resid_len
;
619 tp_locvar
->cmd
= scsi_rq
->cmd
;
620 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
622 tp_locvar
->sector
= blk_rq_pos(rq
);
623 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
624 tp_locvar
->bytes
= 0;
625 tp_locvar
->cmd
= NULL
;
626 tp_locvar
->cmd_len
= 0;
631 ctf_integer(dev_t
, dev
,
632 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
633 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
634 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
635 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
636 ctf_integer(pid_t
, tid
, current
->pid
)
637 blk_rwbs_ctf_integer(unsigned int, rwbs
,
638 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
639 ctf_sequence_hex(unsigned char, cmd
,
640 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
641 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
646 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
647 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
649 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
655 unsigned int nr_sector
;
662 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
663 tp_locvar
->sector
= 0;
664 tp_locvar
->nr_sector
= 0;
665 tp_locvar
->bytes
= blk_rq_bytes(rq
);
666 tp_locvar
->cmd
= rq
->cmd
;
667 tp_locvar
->cmd_len
= rq
->cmd_len
;
669 tp_locvar
->sector
= blk_rq_pos(rq
);
670 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
671 tp_locvar
->bytes
= 0;
672 tp_locvar
->cmd
= NULL
;
673 tp_locvar
->cmd_len
= 0;
678 ctf_integer(dev_t
, dev
,
679 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
680 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
681 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
682 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
683 ctf_integer(pid_t
, tid
, current
->pid
)
684 blk_rwbs_ctf_integer(unsigned int, rwbs
,
685 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
686 ctf_sequence_hex(unsigned char, cmd
,
687 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
688 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
693 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
695 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
696 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
697 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
699 * block_rq_insert - insert block operation request into queue
700 * @rq: block IO operation request
702 * Called immediately before block operation request @rq is inserted
703 * into queue @q. The fields in the operation request @rq struct can
704 * be examined to determine which device and sectors the pending
705 * operation would access.
707 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
709 TP_PROTO(struct request
*rq
),
715 * block_rq_insert - insert block operation request into queue
717 * @rq: block IO operation request
719 * Called immediately before block operation request @rq is inserted
720 * into queue @q. The fields in the operation request @rq struct can
721 * be examined to determine which device and sectors the pending
722 * operation would access.
724 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
726 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
732 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
733 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
734 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
736 * block_rq_issue - issue pending block IO request operation to device driver
737 * @rq: block IO operation operation request
739 * Called when block operation request @rq from queue @q is sent to a
740 * device driver for processing.
742 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
744 TP_PROTO(struct request
*rq
),
750 * block_rq_issue - issue pending block IO request operation to device driver
751 * @q: queue holding operation
752 * @rq: block IO operation operation request
754 * Called when block operation request @rq from queue @q is sent to a
755 * device driver for processing.
757 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
759 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
765 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
766 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0))
768 * block_rq_merge - merge request with another one in the elevator
769 * @rq: block IO operation operation request
771 * Called when block operation request @rq from queue @q is merged to another
772 * request queued in the elevator.
774 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_merge
,
776 TP_PROTO(struct request
*rq
),
780 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,9,0))
782 * block_rq_merge - merge request with another one in the elevator
783 * @q: queue holding operation
784 * @rq: block IO operation operation request
786 * Called when block operation request @rq from queue @q is merged to another
787 * request queued in the elevator.
789 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_merge
,
791 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
797 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,8,0) || \
798 LTTNG_RHEL_KERNEL_RANGE(4,18,0,305,0,0, 4,19,0,0,0,0))
801 * block_bio_complete - completed all work on the block operation
802 * @q: queue holding the block operation
803 * @bio: block operation completed
804 * @error: io error value
806 * This tracepoint indicates there is no further work to do on this
807 * block IO operation @bio.
809 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
811 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
816 ctf_integer(dev_t
, dev
, bio_dev(bio
))
817 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
818 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
819 ctf_integer(int, error
, blk_status_to_errno(bio
->bi_status
))
820 blk_rwbs_ctf_integer(unsigned int, rwbs
,
821 lttng_bio_op(bio
), lttng_bio_rw(bio
),
822 bio
->bi_iter
.bi_size
)
825 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
827 * block_bio_complete - completed all work on the block operation
828 * @q: queue holding the block operation
829 * @bio: block operation completed
830 * @error: io error value
832 * This tracepoint indicates there is no further work to do on this
833 * block IO operation @bio.
835 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
837 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
839 TP_ARGS(q
, bio
, error
),
842 ctf_integer(dev_t
, dev
, bio_dev(bio
))
843 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
844 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
845 ctf_integer(int, error
, error
)
846 blk_rwbs_ctf_integer(unsigned int, rwbs
,
847 lttng_bio_op(bio
), lttng_bio_rw(bio
),
848 bio
->bi_iter
.bi_size
)
853 * block_bio_complete - completed all work on the block operation
854 * @q: queue holding the block operation
855 * @bio: block operation completed
856 * @error: io error value
858 * This tracepoint indicates there is no further work to do on this
859 * block IO operation @bio.
861 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
863 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
865 TP_ARGS(q
, bio
, error
),
868 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
869 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
870 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
871 ctf_integer(int, error
, error
)
872 blk_rwbs_ctf_integer(unsigned int, rwbs
,
873 lttng_bio_op(bio
), lttng_bio_rw(bio
),
874 bio
->bi_iter
.bi_size
)
879 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
880 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
882 TP_PROTO(struct bio
*bio
),
887 ctf_integer(dev_t
, dev
, bio_dev(bio
))
888 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
889 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
890 blk_rwbs_ctf_integer(unsigned int, rwbs
,
891 lttng_bio_op(bio
), lttng_bio_rw(bio
),
892 bio
->bi_iter
.bi_size
)
893 ctf_integer(pid_t
, tid
, current
->pid
)
894 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
897 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
898 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
900 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
905 ctf_integer(dev_t
, dev
, bio_dev(bio
))
906 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
907 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
908 blk_rwbs_ctf_integer(unsigned int, rwbs
,
909 lttng_bio_op(bio
), lttng_bio_rw(bio
),
910 bio
->bi_iter
.bi_size
)
911 ctf_integer(pid_t
, tid
, current
->pid
)
912 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
916 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
918 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
923 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
924 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
925 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
926 blk_rwbs_ctf_integer(unsigned int, rwbs
,
927 lttng_bio_op(bio
), lttng_bio_rw(bio
),
928 bio
->bi_iter
.bi_size
)
929 ctf_integer(pid_t
, tid
, current
->pid
)
930 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
937 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
939 * block_bio_bounce - used bounce buffer when processing block operation
940 * @bio: block operation
942 * A bounce buffer was used to handle the block operation @bio in @q.
943 * This occurs when hardware limitations prevent a direct transfer of
944 * data between the @bio data memory area and the IO device. Use of a
945 * bounce buffer requires extra copying of data and decreases
948 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_bounce
,
950 TP_PROTO(struct bio
*bio
),
954 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
956 * block_bio_bounce - used bounce buffer when processing block operation
957 * @q: queue holding the block operation
958 * @bio: block operation
960 * A bounce buffer was used to handle the block operation @bio in @q.
961 * This occurs when hardware limitations prevent a direct transfer of
962 * data between the @bio data memory area and the IO device. Use of a
963 * bounce buffer requires extra copying of data and decreases
966 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
968 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
973 ctf_integer(dev_t
, dev
, bio_dev(bio
))
974 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
975 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
976 blk_rwbs_ctf_integer(unsigned int, rwbs
,
977 lttng_bio_op(bio
), lttng_bio_rw(bio
),
978 bio
->bi_iter
.bi_size
)
979 ctf_integer(pid_t
, tid
, current
->pid
)
980 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
984 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
986 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
991 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
992 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
993 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
994 blk_rwbs_ctf_integer(unsigned int, rwbs
,
995 lttng_bio_op(bio
), lttng_bio_rw(bio
),
996 bio
->bi_iter
.bi_size
)
997 ctf_integer(pid_t
, tid
, current
->pid
)
998 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1004 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1006 * block_bio_backmerge - merging block operation to the end of an existing operation
1007 * @bio: new block operation to merge
1009 * Merging block request @bio to the end of an existing block request.
1011 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
1013 TP_PROTO(struct bio
*bio
),
1019 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
1020 * @bio: new block operation to merge
1022 * Merging block IO operation @bio to the beginning of an existing block request.
1024 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
1026 TP_PROTO(struct bio
*bio
),
1032 * block_bio_queue - putting new block IO operation in queue
1033 * @bio: new block operation
1035 * About to place the block IO operation @bio into queue @q.
1037 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
1039 TP_PROTO(struct bio
*bio
),
1045 * block_bio_backmerge - merging block operation to the end of an existing operation
1046 * @q: queue holding operation
1047 * @rq: request bio is being merged into
1048 * @bio: new block operation to merge
1050 * Merging block request @bio to the end of an existing block request
1053 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_backmerge
,
1055 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
1061 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
1062 * @q: queue holding operation
1063 * @rq: request bio is being merged into
1064 * @bio: new block operation to merge
1066 * Merging block IO operation @bio to the beginning of an existing block
1067 * operation in queue @q.
1069 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_frontmerge
,
1071 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
1077 * block_bio_queue - putting new block IO operation in queue
1078 * @q: queue holding operation
1079 * @bio: new block operation
1081 * About to place the block IO operation @bio into queue @q.
1083 LTTNG_TRACEPOINT_EVENT(block_bio_queue
,
1085 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1090 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1091 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1093 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1095 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1096 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1097 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1098 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1099 bio
->bi_iter
.bi_size
)
1100 ctf_integer(pid_t
, tid
, current
->pid
)
1101 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1104 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) */
1106 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1108 * block_getrq - get a free request entry in queue for block IO operations
1109 * @bio: pending block IO operation (can be %NULL)
1111 * A request struct has been allocated to handle the block IO operation @bio.
1113 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_getrq
,
1115 TP_PROTO(struct bio
*bio
),
1120 LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq
,
1122 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1124 TP_ARGS(q
, bio
, rw
),
1127 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1128 ctf_integer(dev_t
, dev
, bio
? bio_dev(bio
) : 0)
1130 ctf_integer(dev_t
, dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
1132 ctf_integer(sector_t
, sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
1133 ctf_integer(unsigned int, nr_sector
,
1134 bio
? bio_sectors(bio
) : 0)
1135 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1136 bio
? lttng_bio_op(bio
) : 0,
1137 bio
? lttng_bio_rw(bio
) : 0,
1138 bio
? bio
->bi_iter
.bi_size
: 0)
1139 ctf_integer(pid_t
, tid
, current
->pid
)
1140 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1145 * block_getrq - get a free request entry in queue for block IO operations
1146 * @q: queue for operations
1147 * @bio: pending block IO operation (can be %NULL)
1148 * @rw: low bit indicates a read (%0) or a write (%1)
1150 * A request struct for queue @q has been allocated to handle the
1151 * block IO operation @bio.
1153 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_getrq
,
1155 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1161 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
1162 * @q: queue for operation
1163 * @bio: pending block IO operation (can be %NULL)
1164 * @rw: low bit indicates a read (%0) or a write (%1)
1166 * In the case where a request struct cannot be provided for queue @q
1167 * the process needs to wait for an request struct to become
1168 * available. This tracepoint event is generated each time the
1169 * process goes to sleep waiting for request struct become available.
1171 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_sleeprq
,
1173 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1180 * block_plug - keep operations requests in request queue
1181 * @q: request queue to plug
1183 * Plug the request queue @q. Do not allow block operation requests
1184 * to be sent to the device driver. Instead, accumulate requests in
1185 * the queue to improve throughput performance of the block device.
1187 LTTNG_TRACEPOINT_EVENT(block_plug
,
1189 TP_PROTO(struct request_queue
*q
),
1194 ctf_integer(pid_t
, tid
, current
->pid
)
1195 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1199 LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug
,
1201 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
1203 TP_ARGS(q
, depth
, explicit),
1206 ctf_integer(int, nr_rq
, depth
)
1207 ctf_integer(pid_t
, tid
, current
->pid
)
1208 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1213 * block_unplug - release of operations requests in request queue
1214 * @q: request queue to unplug
1215 * @depth: number of requests just added to the queue
1216 * @explicit: whether this was an explicit unplug, or one from schedule()
1218 * Unplug request queue @q because device driver is scheduled to work
1219 * on elements in the request queue.
1221 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug
,
1223 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
1225 TP_ARGS(q
, depth
, explicit)
1228 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1230 * block_split - split a single bio struct into two bio structs
1231 * @bio: block operation being split
1232 * @new_sector: The starting sector for the new bio
1234 * The bio request @bio needs to be split into two bio requests. The newly
1235 * created @bio request starts at @new_sector. This split may be required due to
1236 * hardware limitations such as operation crossing device boundaries in a RAID
1239 LTTNG_TRACEPOINT_EVENT(block_split
,
1241 TP_PROTO(struct bio
*bio
, unsigned int new_sector
),
1243 TP_ARGS(bio
, new_sector
),
1246 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1247 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1248 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1249 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1250 bio
->bi_iter
.bi_size
)
1251 ctf_integer(sector_t
, new_sector
, new_sector
)
1252 ctf_integer(pid_t
, tid
, current
->pid
)
1253 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1257 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1259 * block_split - split a single bio struct into two bio structs
1260 * @q: queue containing the bio
1261 * @bio: block operation being split
1262 * @new_sector: The starting sector for the new bio
1264 * The bio request @bio in request queue @q needs to be split into two
1265 * bio requests. The newly created @bio request starts at
1266 * @new_sector. This split may be required due to hardware limitation
1267 * such as operation crossing device boundaries in a RAID system.
1269 LTTNG_TRACEPOINT_EVENT(block_split
,
1271 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1272 unsigned int new_sector
),
1274 TP_ARGS(q
, bio
, new_sector
),
1277 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1278 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1279 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1280 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1281 bio
->bi_iter
.bi_size
)
1282 ctf_integer(sector_t
, new_sector
, new_sector
)
1283 ctf_integer(pid_t
, tid
, current
->pid
)
1284 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1288 LTTNG_TRACEPOINT_EVENT(block_split
,
1290 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1291 unsigned int new_sector
),
1293 TP_ARGS(q
, bio
, new_sector
),
1296 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1297 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1298 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1299 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1300 bio
->bi_iter
.bi_size
)
1301 ctf_integer(sector_t
, new_sector
, new_sector
)
1302 ctf_integer(pid_t
, tid
, current
->pid
)
1303 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1308 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1310 * block_bio_remap - map request for a logical device to the raw device
1311 * @bio: revised operation
1312 * @dev: original device for the operation
1313 * @from: original sector for the operation
1315 * An operation for a logical device has been mapped to the
1318 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1320 TP_PROTO(struct bio
*bio
, dev_t dev
, sector_t from
),
1322 TP_ARGS(bio
, dev
, from
),
1325 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1326 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1327 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1328 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1329 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1330 bio
->bi_iter
.bi_size
)
1331 ctf_integer(dev_t
, old_dev
, dev
)
1332 ctf_integer(sector_t
, old_sector
, from
)
1335 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1337 * block_bio_remap - map request for a logical device to the raw device
1338 * @q: queue holding the operation
1339 * @bio: revised operation
1340 * @dev: device for the operation
1341 * @from: original sector for the operation
1343 * An operation for a logical device has been mapped to the
1346 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1348 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1351 TP_ARGS(q
, bio
, dev
, from
),
1354 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1355 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1356 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1357 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1358 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1359 bio
->bi_iter
.bi_size
)
1360 ctf_integer(dev_t
, old_dev
, dev
)
1361 ctf_integer(sector_t
, old_sector
, from
)
1365 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1367 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1370 TP_ARGS(q
, bio
, dev
, from
),
1373 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1374 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1375 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1376 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1377 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1378 bio
->bi_iter
.bi_size
)
1379 ctf_integer(dev_t
, old_dev
, dev
)
1380 ctf_integer(sector_t
, old_sector
, from
)
1385 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
1387 * block_rq_remap - map request for a block operation request
1388 * @rq: block IO operation request
1389 * @dev: device for the operation
1390 * @from: original sector for the operation
1392 * The block operation request @rq in @q has been remapped. The block
1393 * operation request @rq holds the current information and @from hold
1394 * the original sector.
1396 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1398 TP_PROTO(struct request
*rq
, dev_t dev
, sector_t from
),
1400 TP_ARGS(rq
, dev
, from
),
1403 ctf_integer(dev_t
, dev
, disk_devt(rq
->q
->disk
))
1404 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1405 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1406 ctf_integer(dev_t
, old_dev
, dev
)
1407 ctf_integer(sector_t
, old_sector
, from
)
1408 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1409 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1412 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
1413 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
1414 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
1416 * block_rq_remap - map request for a block operation request
1417 * @rq: block IO operation request
1418 * @dev: device for the operation
1419 * @from: original sector for the operation
1421 * The block operation request @rq in @q has been remapped. The block
1422 * operation request @rq holds the current information and @from hold
1423 * the original sector.
1425 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1427 TP_PROTO(struct request
*rq
, dev_t dev
, sector_t from
),
1429 TP_ARGS(rq
, dev
, from
),
1432 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1433 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1434 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1435 ctf_integer(dev_t
, old_dev
, dev
)
1436 ctf_integer(sector_t
, old_sector
, from
)
1437 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1438 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1443 * block_rq_remap - map request for a block operation request
1444 * @q: queue holding the operation
1445 * @rq: block IO operation request
1446 * @dev: device for the operation
1447 * @from: original sector for the operation
1449 * The block operation request @rq in @q has been remapped. The block
1450 * operation request @rq holds the current information and @from hold
1451 * the original sector.
1453 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1455 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
1458 TP_ARGS(q
, rq
, dev
, from
),
1461 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1462 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1463 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1464 ctf_integer(dev_t
, old_dev
, dev
)
1465 ctf_integer(sector_t
, old_sector
, from
)
1466 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1467 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1472 #undef __print_rwbs_flags
1473 #undef blk_fill_rwbs
1475 #endif /* LTTNG_TRACE_BLOCK_H */
1477 /* This part must be outside protection */
1478 #include <lttng/define_trace.h>
This page took 0.060335 seconds and 4 git commands to generate.