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 || LTTNG_RHEL_KERNEL_RANGE(5,14,0,162,0,0, 5,15,0,0,0,0))
71 #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
72 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
73 ctf_enum(block_rq_type, type, rwbs, \
74 ( (op) == REQ_OP_WRITE ? RWBS_FLAG_WRITE : \
75 ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
76 ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
77 ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
78 ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
80 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
81 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
82 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
83 | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
84 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
86 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
87 ctf_integer(type, rwbs, \
88 ( (op) == REQ_OP_WRITE ? RWBS_FLAG_WRITE : \
89 ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
90 ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
91 ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
92 ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
94 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
95 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
96 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
97 | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
98 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
99 #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */
101 #else /* (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0)) */
103 #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
104 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
105 ctf_enum(block_rq_type, type, rwbs, \
106 (((op) == REQ_OP_WRITE || (op) == REQ_OP_WRITE_SAME) ? RWBS_FLAG_WRITE : \
107 ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
108 ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
109 ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
110 ( (op) == REQ_OP_READ ? 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_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
116 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
118 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
119 ctf_integer(type, rwbs, \
120 (((op) == REQ_OP_WRITE || (op) == REQ_OP_WRITE_SAME) ? RWBS_FLAG_WRITE : \
121 ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
122 ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
123 ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
124 ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
126 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
127 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
128 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
129 | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
130 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
131 #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */
132 #endif /* (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0)) */
136 #define lttng_req_op(rq)
137 #define lttng_req_rw(rq) ((rq)->cmd_flags)
138 #define lttng_bio_op(bio)
139 #define lttng_bio_rw(bio) ((bio)->bi_rw)
141 #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
142 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
143 ctf_enum(block_rq_type, type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
144 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
145 ( (bytes) ? RWBS_FLAG_READ : \
147 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
148 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
149 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
150 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \
151 | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \
152 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
154 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
155 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
156 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
157 ( (bytes) ? RWBS_FLAG_READ : \
159 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
160 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
161 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
162 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \
163 | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \
164 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
165 #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */
168 LTTNG_TRACEPOINT_EVENT_CLASS(block_buffer
,
170 TP_PROTO(struct buffer_head
*bh
),
175 ctf_integer(dev_t
, dev
, bh
->b_bdev
->bd_dev
)
176 ctf_integer(sector_t
, sector
, bh
->b_blocknr
)
177 ctf_integer(size_t, size
, bh
->b_size
)
182 * block_touch_buffer - mark a buffer accessed
183 * @bh: buffer_head being touched
185 * Called from touch_buffer().
187 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_touch_buffer
,
189 TP_PROTO(struct buffer_head
*bh
),
195 * block_dirty_buffer - mark a buffer dirty
196 * @bh: buffer_head being dirtied
198 * Called from mark_buffer_dirty().
200 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_dirty_buffer
,
202 TP_PROTO(struct buffer_head
*bh
),
207 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
208 /* block_rq_with_error event class removed in kernel 4.12 */
209 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0))
210 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
212 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
218 unsigned int nr_sector
;
224 if (blk_rq_is_scsi(rq
)) {
225 struct scsi_request
*scsi_rq
= scsi_req(rq
);
226 tp_locvar
->sector
= 0;
227 tp_locvar
->nr_sector
= 0;
228 tp_locvar
->cmd
= scsi_rq
->cmd
;
229 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
231 tp_locvar
->sector
= blk_rq_pos(rq
);
232 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
233 tp_locvar
->cmd
= NULL
;
234 tp_locvar
->cmd_len
= 0;
239 ctf_integer(dev_t
, dev
,
240 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
241 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
242 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
243 ctf_integer(int, errors
, rq
->errors
)
244 blk_rwbs_ctf_integer(unsigned int, rwbs
,
245 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
246 ctf_sequence_hex(unsigned char, cmd
,
247 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
252 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
253 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
255 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
261 unsigned int nr_sector
;
268 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
269 tp_locvar
->sector
= 0;
270 tp_locvar
->nr_sector
= 0;
271 tp_locvar
->cmd
= rq
->cmd
;
272 tp_locvar
->cmd_len
= rq
->cmd_len
;
274 tp_locvar
->sector
= blk_rq_pos(rq
);
275 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
276 tp_locvar
->cmd
= NULL
;
277 tp_locvar
->cmd_len
= 0;
282 ctf_integer(dev_t
, dev
,
283 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
284 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
285 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
286 ctf_integer(int, errors
, rq
->errors
)
287 blk_rwbs_ctf_integer(unsigned int, rwbs
,
288 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
289 ctf_sequence_hex(unsigned char, cmd
,
290 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
295 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
297 #if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(4,12,0))
299 * block_rq_abort - abort block operation request
300 * @q: queue containing the block operation request
301 * @rq: block IO operation request
303 * Called immediately after pending block IO operation request @rq in
304 * queue @q is aborted. The fields in the operation request @rq
305 * can be examined to determine which device and sectors the pending
306 * operation would access.
308 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_abort
,
310 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
316 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0) \
317 || LTTNG_RHEL_KERNEL_RANGE(5,14,0,162,0,0, 5,15,0,0,0,0))
319 * block_rq_requeue - place block IO request back on a queue
320 * @rq: block IO operation request
322 * The block operation request @rq is being placed back into queue
323 * @q. For some reason the request was not completed and needs to be
324 * put back in the queue.
326 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
328 TP_PROTO(struct request
*rq
),
333 ctf_integer(dev_t
, dev
,
334 rq
->q
->disk
? disk_devt(rq
->q
->disk
) : 0)
335 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
336 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
337 blk_rwbs_ctf_integer(unsigned int, rwbs
,
338 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
341 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
342 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
343 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
345 * block_rq_requeue - place block IO request back on a queue
346 * @rq: block IO operation request
348 * The block operation request @rq is being placed back into queue
349 * @q. For some reason the request was not completed and needs to be
350 * put back in the queue.
352 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
354 TP_PROTO(struct request
*rq
),
359 ctf_integer(dev_t
, dev
,
360 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
361 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
362 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
363 blk_rwbs_ctf_integer(unsigned int, rwbs
,
364 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
367 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
369 * block_rq_requeue - place block IO request back on a queue
370 * @q: queue holding operation
371 * @rq: block IO operation request
373 * The block operation request @rq is being placed back into queue
374 * @q. For some reason the request was not completed and needs to be
375 * put back in the queue.
377 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
379 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
384 ctf_integer(dev_t
, dev
,
385 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
386 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
387 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
388 blk_rwbs_ctf_integer(unsigned int, rwbs
,
389 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
393 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_requeue
,
395 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
402 * block_rq_complete - block IO operation completed by device driver
403 * @q: queue containing the block operation request
404 * @rq: block operations request
405 * @nr_bytes: number of completed bytes
407 * The block_rq_complete tracepoint event indicates that some portion
408 * of operation request has been completed by the device driver. If
409 * the @rq->bio is %NULL, then there is absolutely no additional work to
410 * do for the request. If @rq->bio is non-NULL then there is
411 * additional work required to complete the request.
413 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0) \
414 || LTTNG_RHEL_KERNEL_RANGE(5,14,0,162,0,0, 5,15,0,0,0,0))
415 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
417 TP_PROTO(struct request
*rq
, blk_status_t error
, unsigned int nr_bytes
),
419 TP_ARGS(rq
, error
, nr_bytes
),
422 ctf_integer(dev_t
, dev
,
423 rq
->q
->disk
? disk_devt(rq
->q
->disk
) : 0)
424 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
425 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
426 ctf_integer(int, error
, blk_status_to_errno(error
))
427 blk_rwbs_ctf_integer(unsigned int, rwbs
,
428 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
431 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,16,0) \
432 || LTTNG_RHEL_KERNEL_RANGE(5,14,0,70,0,0, 5,15,0,0,0,0))
433 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
435 TP_PROTO(struct request
*rq
, blk_status_t error
, unsigned int nr_bytes
),
437 TP_ARGS(rq
, error
, nr_bytes
),
440 ctf_integer(dev_t
, dev
,
441 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
442 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
443 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
444 ctf_integer(int, error
, blk_status_to_errno(error
))
445 blk_rwbs_ctf_integer(unsigned int, rwbs
,
446 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
449 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
450 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
452 TP_PROTO(struct request
*rq
, int error
, unsigned int nr_bytes
),
454 TP_ARGS(rq
, error
, nr_bytes
),
457 ctf_integer(dev_t
, dev
,
458 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
459 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
460 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
461 ctf_integer(int, error
, error
)
462 blk_rwbs_ctf_integer(unsigned int, rwbs
,
463 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
466 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0))
467 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
469 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
470 unsigned int nr_bytes
),
472 TP_ARGS(q
, rq
, nr_bytes
),
480 if (blk_rq_is_scsi(rq
)) {
481 struct scsi_request
*scsi_rq
= scsi_req(rq
);
482 tp_locvar
->cmd
= scsi_rq
->cmd
;
483 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
485 tp_locvar
->cmd
= NULL
;
486 tp_locvar
->cmd_len
= 0;
491 ctf_integer(dev_t
, dev
,
492 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
493 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
494 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
495 ctf_integer(int, errors
, rq
->errors
)
496 blk_rwbs_ctf_integer(unsigned int, rwbs
,
497 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
498 ctf_sequence_hex(unsigned char, cmd
,
499 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
505 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
507 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
508 unsigned int nr_bytes
),
510 TP_ARGS(q
, rq
, nr_bytes
),
518 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
519 tp_locvar
->cmd
= rq
->cmd
;
520 tp_locvar
->cmd_len
= rq
->cmd_len
;
522 tp_locvar
->cmd
= NULL
;
523 tp_locvar
->cmd_len
= 0;
528 ctf_integer(dev_t
, dev
,
529 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
530 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
531 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
532 ctf_integer(int, errors
, rq
->errors
)
533 blk_rwbs_ctf_integer(unsigned int, rwbs
,
534 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
535 ctf_sequence_hex(unsigned char, cmd
,
536 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
543 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0) \
544 || LTTNG_RHEL_KERNEL_RANGE(5,14,0,162,0,0, 5,15,0,0,0,0))
545 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
547 TP_PROTO(struct request
*rq
),
552 ctf_integer(dev_t
, dev
,
553 rq
->q
->disk
? disk_devt(rq
->q
->disk
) : 0)
554 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
555 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
556 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
557 ctf_integer(pid_t
, tid
, current
->pid
)
558 blk_rwbs_ctf_integer(unsigned int, rwbs
,
559 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
560 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
563 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
564 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
565 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
566 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
568 TP_PROTO(struct request
*rq
),
573 ctf_integer(dev_t
, dev
,
574 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
575 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
576 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
577 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
578 ctf_integer(pid_t
, tid
, current
->pid
)
579 blk_rwbs_ctf_integer(unsigned int, rwbs
,
580 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
581 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
584 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
585 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
587 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
592 ctf_integer(dev_t
, dev
,
593 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
594 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
595 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
596 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
597 ctf_integer(pid_t
, tid
, current
->pid
)
598 blk_rwbs_ctf_integer(unsigned int, rwbs
,
599 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
600 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
603 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0))
604 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
606 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
612 unsigned int nr_sector
;
619 if (blk_rq_is_scsi(rq
)) {
620 struct scsi_request
*scsi_rq
= scsi_req(rq
);
621 tp_locvar
->sector
= 0;
622 tp_locvar
->nr_sector
= 0;
623 tp_locvar
->bytes
= scsi_rq
->resid_len
;
624 tp_locvar
->cmd
= scsi_rq
->cmd
;
625 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
627 tp_locvar
->sector
= blk_rq_pos(rq
);
628 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
629 tp_locvar
->bytes
= 0;
630 tp_locvar
->cmd
= NULL
;
631 tp_locvar
->cmd_len
= 0;
636 ctf_integer(dev_t
, dev
,
637 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
638 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
639 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
640 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
641 ctf_integer(pid_t
, tid
, current
->pid
)
642 blk_rwbs_ctf_integer(unsigned int, rwbs
,
643 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
644 ctf_sequence_hex(unsigned char, cmd
,
645 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
646 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
651 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
652 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
654 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
660 unsigned int nr_sector
;
667 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
668 tp_locvar
->sector
= 0;
669 tp_locvar
->nr_sector
= 0;
670 tp_locvar
->bytes
= blk_rq_bytes(rq
);
671 tp_locvar
->cmd
= rq
->cmd
;
672 tp_locvar
->cmd_len
= rq
->cmd_len
;
674 tp_locvar
->sector
= blk_rq_pos(rq
);
675 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
676 tp_locvar
->bytes
= 0;
677 tp_locvar
->cmd
= NULL
;
678 tp_locvar
->cmd_len
= 0;
683 ctf_integer(dev_t
, dev
,
684 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
685 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
686 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
687 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
688 ctf_integer(pid_t
, tid
, current
->pid
)
689 blk_rwbs_ctf_integer(unsigned int, rwbs
,
690 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
691 ctf_sequence_hex(unsigned char, cmd
,
692 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
693 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
698 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
700 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
701 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
702 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
704 * block_rq_insert - insert block operation request into queue
705 * @rq: block IO operation request
707 * Called immediately before block operation request @rq is inserted
708 * into queue @q. The fields in the operation request @rq struct can
709 * be examined to determine which device and sectors the pending
710 * operation would access.
712 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
714 TP_PROTO(struct request
*rq
),
720 * block_rq_insert - insert block operation request into queue
722 * @rq: block IO operation request
724 * Called immediately before block operation request @rq is inserted
725 * into queue @q. The fields in the operation request @rq struct can
726 * be examined to determine which device and sectors the pending
727 * operation would access.
729 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
731 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
737 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
738 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
739 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
741 * block_rq_issue - issue pending block IO request operation to device driver
742 * @rq: block IO operation operation request
744 * Called when block operation request @rq from queue @q is sent to a
745 * device driver for processing.
747 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
749 TP_PROTO(struct request
*rq
),
755 * block_rq_issue - issue pending block IO request operation to device driver
756 * @q: queue holding operation
757 * @rq: block IO operation operation request
759 * Called when block operation request @rq from queue @q is sent to a
760 * device driver for processing.
762 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
764 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
770 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
771 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0))
773 * block_rq_merge - merge request with another one in the elevator
774 * @rq: block IO operation operation request
776 * Called when block operation request @rq from queue @q is merged to another
777 * request queued in the elevator.
779 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_merge
,
781 TP_PROTO(struct request
*rq
),
785 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,9,0))
787 * block_rq_merge - merge request with another one in the elevator
788 * @q: queue holding operation
789 * @rq: block IO operation operation request
791 * Called when block operation request @rq from queue @q is merged to another
792 * request queued in the elevator.
794 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_merge
,
796 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
802 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,8,0) || \
803 LTTNG_RHEL_KERNEL_RANGE(4,18,0,305,0,0, 4,19,0,0,0,0))
806 * block_bio_complete - completed all work on the block operation
807 * @q: queue holding the block operation
808 * @bio: block operation completed
809 * @error: io error value
811 * This tracepoint indicates there is no further work to do on this
812 * block IO operation @bio.
814 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
816 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
821 ctf_integer(dev_t
, dev
, bio_dev(bio
))
822 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
823 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
824 ctf_integer(int, error
, blk_status_to_errno(bio
->bi_status
))
825 blk_rwbs_ctf_integer(unsigned int, rwbs
,
826 lttng_bio_op(bio
), lttng_bio_rw(bio
),
827 bio
->bi_iter
.bi_size
)
830 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
832 * block_bio_complete - completed all work on the block operation
833 * @q: queue holding the block operation
834 * @bio: block operation completed
835 * @error: io error value
837 * This tracepoint indicates there is no further work to do on this
838 * block IO operation @bio.
840 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
842 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
844 TP_ARGS(q
, bio
, error
),
847 ctf_integer(dev_t
, dev
, bio_dev(bio
))
848 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
849 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
850 ctf_integer(int, error
, error
)
851 blk_rwbs_ctf_integer(unsigned int, rwbs
,
852 lttng_bio_op(bio
), lttng_bio_rw(bio
),
853 bio
->bi_iter
.bi_size
)
858 * block_bio_complete - completed all work on the block operation
859 * @q: queue holding the block operation
860 * @bio: block operation completed
861 * @error: io error value
863 * This tracepoint indicates there is no further work to do on this
864 * block IO operation @bio.
866 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
868 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
870 TP_ARGS(q
, bio
, error
),
873 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
874 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
875 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
876 ctf_integer(int, error
, error
)
877 blk_rwbs_ctf_integer(unsigned int, rwbs
,
878 lttng_bio_op(bio
), lttng_bio_rw(bio
),
879 bio
->bi_iter
.bi_size
)
884 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
885 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
887 TP_PROTO(struct bio
*bio
),
892 ctf_integer(dev_t
, dev
, bio_dev(bio
))
893 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
894 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
895 blk_rwbs_ctf_integer(unsigned int, rwbs
,
896 lttng_bio_op(bio
), lttng_bio_rw(bio
),
897 bio
->bi_iter
.bi_size
)
898 ctf_integer(pid_t
, tid
, current
->pid
)
899 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
902 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
903 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
905 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
910 ctf_integer(dev_t
, dev
, bio_dev(bio
))
911 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
912 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
913 blk_rwbs_ctf_integer(unsigned int, rwbs
,
914 lttng_bio_op(bio
), lttng_bio_rw(bio
),
915 bio
->bi_iter
.bi_size
)
916 ctf_integer(pid_t
, tid
, current
->pid
)
917 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
921 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
923 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
928 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
929 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
930 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
931 blk_rwbs_ctf_integer(unsigned int, rwbs
,
932 lttng_bio_op(bio
), lttng_bio_rw(bio
),
933 bio
->bi_iter
.bi_size
)
934 ctf_integer(pid_t
, tid
, current
->pid
)
935 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
942 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
944 * block_bio_bounce - used bounce buffer when processing block operation
945 * @bio: block operation
947 * A bounce buffer was used to handle the block operation @bio in @q.
948 * This occurs when hardware limitations prevent a direct transfer of
949 * data between the @bio data memory area and the IO device. Use of a
950 * bounce buffer requires extra copying of data and decreases
953 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_bounce
,
955 TP_PROTO(struct bio
*bio
),
959 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
961 * block_bio_bounce - used bounce buffer when processing block operation
962 * @q: queue holding the block operation
963 * @bio: block operation
965 * A bounce buffer was used to handle the block operation @bio in @q.
966 * This occurs when hardware limitations prevent a direct transfer of
967 * data between the @bio data memory area and the IO device. Use of a
968 * bounce buffer requires extra copying of data and decreases
971 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
973 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
978 ctf_integer(dev_t
, dev
, bio_dev(bio
))
979 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
980 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
981 blk_rwbs_ctf_integer(unsigned int, rwbs
,
982 lttng_bio_op(bio
), lttng_bio_rw(bio
),
983 bio
->bi_iter
.bi_size
)
984 ctf_integer(pid_t
, tid
, current
->pid
)
985 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
989 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
991 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
996 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
997 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
998 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
999 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1000 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1001 bio
->bi_iter
.bi_size
)
1002 ctf_integer(pid_t
, tid
, current
->pid
)
1003 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1009 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1011 * block_bio_backmerge - merging block operation to the end of an existing operation
1012 * @bio: new block operation to merge
1014 * Merging block request @bio to the end of an existing block request.
1016 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
1018 TP_PROTO(struct bio
*bio
),
1024 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
1025 * @bio: new block operation to merge
1027 * Merging block IO operation @bio to the beginning of an existing block request.
1029 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
1031 TP_PROTO(struct bio
*bio
),
1037 * block_bio_queue - putting new block IO operation in queue
1038 * @bio: new block operation
1040 * About to place the block IO operation @bio into queue @q.
1042 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
1044 TP_PROTO(struct bio
*bio
),
1050 * block_bio_backmerge - merging block operation to the end of an existing operation
1051 * @q: queue holding operation
1052 * @rq: request bio is being merged into
1053 * @bio: new block operation to merge
1055 * Merging block request @bio to the end of an existing block request
1058 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_backmerge
,
1060 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
1066 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
1067 * @q: queue holding operation
1068 * @rq: request bio is being merged into
1069 * @bio: new block operation to merge
1071 * Merging block IO operation @bio to the beginning of an existing block
1072 * operation in queue @q.
1074 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_frontmerge
,
1076 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
1082 * block_bio_queue - putting new block IO operation in queue
1083 * @q: queue holding operation
1084 * @bio: new block operation
1086 * About to place the block IO operation @bio into queue @q.
1088 LTTNG_TRACEPOINT_EVENT(block_bio_queue
,
1090 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
1095 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1096 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1098 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1100 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1101 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1102 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1103 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1104 bio
->bi_iter
.bi_size
)
1105 ctf_integer(pid_t
, tid
, current
->pid
)
1106 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1109 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) */
1111 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1113 * block_getrq - get a free request entry in queue for block IO operations
1114 * @bio: pending block IO operation (can be %NULL)
1116 * A request struct has been allocated to handle the block IO operation @bio.
1118 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_getrq
,
1120 TP_PROTO(struct bio
*bio
),
1125 LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq
,
1127 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1129 TP_ARGS(q
, bio
, rw
),
1132 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1133 ctf_integer(dev_t
, dev
, bio
? bio_dev(bio
) : 0)
1135 ctf_integer(dev_t
, dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
1137 ctf_integer(sector_t
, sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
1138 ctf_integer(unsigned int, nr_sector
,
1139 bio
? bio_sectors(bio
) : 0)
1140 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1141 bio
? lttng_bio_op(bio
) : 0,
1142 bio
? lttng_bio_rw(bio
) : 0,
1143 bio
? bio
->bi_iter
.bi_size
: 0)
1144 ctf_integer(pid_t
, tid
, current
->pid
)
1145 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1150 * block_getrq - get a free request entry in queue for block IO operations
1151 * @q: queue for operations
1152 * @bio: pending block IO operation (can be %NULL)
1153 * @rw: low bit indicates a read (%0) or a write (%1)
1155 * A request struct for queue @q has been allocated to handle the
1156 * block IO operation @bio.
1158 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_getrq
,
1160 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1166 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
1167 * @q: queue for operation
1168 * @bio: pending block IO operation (can be %NULL)
1169 * @rw: low bit indicates a read (%0) or a write (%1)
1171 * In the case where a request struct cannot be provided for queue @q
1172 * the process needs to wait for an request struct to become
1173 * available. This tracepoint event is generated each time the
1174 * process goes to sleep waiting for request struct become available.
1176 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_sleeprq
,
1178 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
1185 * block_plug - keep operations requests in request queue
1186 * @q: request queue to plug
1188 * Plug the request queue @q. Do not allow block operation requests
1189 * to be sent to the device driver. Instead, accumulate requests in
1190 * the queue to improve throughput performance of the block device.
1192 LTTNG_TRACEPOINT_EVENT(block_plug
,
1194 TP_PROTO(struct request_queue
*q
),
1199 ctf_integer(pid_t
, tid
, current
->pid
)
1200 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1204 LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug
,
1206 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
1208 TP_ARGS(q
, depth
, explicit),
1211 ctf_integer(int, nr_rq
, depth
)
1212 ctf_integer(pid_t
, tid
, current
->pid
)
1213 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1218 * block_unplug - release of operations requests in request queue
1219 * @q: request queue to unplug
1220 * @depth: number of requests just added to the queue
1221 * @explicit: whether this was an explicit unplug, or one from schedule()
1223 * Unplug request queue @q because device driver is scheduled to work
1224 * on elements in the request queue.
1226 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug
,
1228 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
1230 TP_ARGS(q
, depth
, explicit)
1233 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1235 * block_split - split a single bio struct into two bio structs
1236 * @bio: block operation being split
1237 * @new_sector: The starting sector for the new bio
1239 * The bio request @bio needs to be split into two bio requests. The newly
1240 * created @bio request starts at @new_sector. This split may be required due to
1241 * hardware limitations such as operation crossing device boundaries in a RAID
1244 LTTNG_TRACEPOINT_EVENT(block_split
,
1246 TP_PROTO(struct bio
*bio
, unsigned int new_sector
),
1248 TP_ARGS(bio
, new_sector
),
1251 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1252 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1253 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1254 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1255 bio
->bi_iter
.bi_size
)
1256 ctf_integer(sector_t
, new_sector
, new_sector
)
1257 ctf_integer(pid_t
, tid
, current
->pid
)
1258 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1262 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1264 * block_split - split a single bio struct into two bio structs
1265 * @q: queue containing the bio
1266 * @bio: block operation being split
1267 * @new_sector: The starting sector for the new bio
1269 * The bio request @bio in request queue @q needs to be split into two
1270 * bio requests. The newly created @bio request starts at
1271 * @new_sector. This split may be required due to hardware limitation
1272 * such as operation crossing device boundaries in a RAID system.
1274 LTTNG_TRACEPOINT_EVENT(block_split
,
1276 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1277 unsigned int new_sector
),
1279 TP_ARGS(q
, bio
, new_sector
),
1282 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1283 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1284 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1285 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1286 bio
->bi_iter
.bi_size
)
1287 ctf_integer(sector_t
, new_sector
, new_sector
)
1288 ctf_integer(pid_t
, tid
, current
->pid
)
1289 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1293 LTTNG_TRACEPOINT_EVENT(block_split
,
1295 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1296 unsigned int new_sector
),
1298 TP_ARGS(q
, bio
, new_sector
),
1301 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1302 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1303 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1304 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1305 bio
->bi_iter
.bi_size
)
1306 ctf_integer(sector_t
, new_sector
, new_sector
)
1307 ctf_integer(pid_t
, tid
, current
->pid
)
1308 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1313 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
1315 * block_bio_remap - map request for a logical device to the raw device
1316 * @bio: revised operation
1317 * @dev: original device for the operation
1318 * @from: original sector for the operation
1320 * An operation for a logical device has been mapped to the
1323 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1325 TP_PROTO(struct bio
*bio
, dev_t dev
, sector_t from
),
1327 TP_ARGS(bio
, dev
, from
),
1330 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1331 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1332 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1333 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1334 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1335 bio
->bi_iter
.bi_size
)
1336 ctf_integer(dev_t
, old_dev
, dev
)
1337 ctf_integer(sector_t
, old_sector
, from
)
1340 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0))
1342 * block_bio_remap - map request for a logical device to the raw device
1343 * @q: queue holding the operation
1344 * @bio: revised operation
1345 * @dev: device for the operation
1346 * @from: original sector for the operation
1348 * An operation for a logical device has been mapped to the
1351 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1353 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1356 TP_ARGS(q
, bio
, dev
, from
),
1359 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1360 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1361 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1362 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1363 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1364 bio
->bi_iter
.bi_size
)
1365 ctf_integer(dev_t
, old_dev
, dev
)
1366 ctf_integer(sector_t
, old_sector
, from
)
1370 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1372 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1375 TP_ARGS(q
, bio
, dev
, from
),
1378 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1379 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1380 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1381 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1382 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1383 bio
->bi_iter
.bi_size
)
1384 ctf_integer(dev_t
, old_dev
, dev
)
1385 ctf_integer(sector_t
, old_sector
, from
)
1390 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0) \
1391 || LTTNG_RHEL_KERNEL_RANGE(5,14,0,162,0,0, 5,15,0,0,0,0))
1393 * block_rq_remap - map request for a block operation request
1394 * @rq: block IO operation request
1395 * @dev: device for the operation
1396 * @from: original sector for the operation
1398 * The block operation request @rq in @q has been remapped. The block
1399 * operation request @rq holds the current information and @from hold
1400 * the original sector.
1402 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1404 TP_PROTO(struct request
*rq
, dev_t dev
, sector_t from
),
1406 TP_ARGS(rq
, dev
, from
),
1409 ctf_integer(dev_t
, dev
, disk_devt(rq
->q
->disk
))
1410 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1411 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1412 ctf_integer(dev_t
, old_dev
, dev
)
1413 ctf_integer(sector_t
, old_sector
, from
)
1414 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1415 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1418 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
1419 || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \
1420 || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0))
1422 * block_rq_remap - map request for a block operation request
1423 * @rq: block IO operation request
1424 * @dev: device for the operation
1425 * @from: original sector for the operation
1427 * The block operation request @rq in @q has been remapped. The block
1428 * operation request @rq holds the current information and @from hold
1429 * the original sector.
1431 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1433 TP_PROTO(struct request
*rq
, dev_t dev
, sector_t from
),
1435 TP_ARGS(rq
, dev
, from
),
1438 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1439 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1440 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1441 ctf_integer(dev_t
, old_dev
, dev
)
1442 ctf_integer(sector_t
, old_sector
, from
)
1443 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1444 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1449 * block_rq_remap - map request for a block operation request
1450 * @q: queue holding the operation
1451 * @rq: block IO operation request
1452 * @dev: device for the operation
1453 * @from: original sector for the operation
1455 * The block operation request @rq in @q has been remapped. The block
1456 * operation request @rq holds the current information and @from hold
1457 * the original sector.
1459 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1461 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
1464 TP_ARGS(q
, rq
, dev
, from
),
1467 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1468 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1469 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1470 ctf_integer(dev_t
, old_dev
, dev
)
1471 ctf_integer(sector_t
, old_sector
, from
)
1472 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1473 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1478 #undef __print_rwbs_flags
1479 #undef blk_fill_rwbs
1481 #endif /* LTTNG_TRACE_BLOCK_H */
1483 /* This part must be outside protection */
1484 #include <lttng/define_trace.h>
This page took 0.070566 seconds and 4 git commands to generate.