1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM block
5 #if !defined(LTTNG_TRACE_BLOCK_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define LTTNG_TRACE_BLOCK_H
8 #include <probes/lttng-tracepoint-event.h>
9 #include <linux/blktrace_api.h>
10 #include <linux/blkdev.h>
11 #include <linux/trace_seq.h>
12 #include <linux/version.h>
14 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
15 #include <scsi/scsi_request.h>
16 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
18 #ifndef _TRACE_BLOCK_DEF_
19 #define _TRACE_BLOCK_DEF_
22 RWBS_FLAG_WRITE
= (1 << 0),
23 RWBS_FLAG_DISCARD
= (1 << 1),
24 RWBS_FLAG_READ
= (1 << 2),
25 RWBS_FLAG_RAHEAD
= (1 << 3),
26 RWBS_FLAG_BARRIER
= (1 << 4),
27 RWBS_FLAG_SYNC
= (1 << 5),
28 RWBS_FLAG_META
= (1 << 6),
29 RWBS_FLAG_SECURE
= (1 << 7),
30 RWBS_FLAG_FLUSH
= (1 << 8),
31 RWBS_FLAG_FUA
= (1 << 9),
32 RWBS_FLAG_PREFLUSH
= (1 << 10),
35 #endif /* _TRACE_BLOCK_DEF_ */
37 LTTNG_TRACEPOINT_ENUM(block_rq_type
,
39 ctf_enum_value("RWBS_FLAG_WRITE", RWBS_FLAG_WRITE
)
40 ctf_enum_value("RWBS_FLAG_DISCARD", RWBS_FLAG_DISCARD
)
41 ctf_enum_value("RWBS_FLAG_READ", RWBS_FLAG_READ
)
42 ctf_enum_value("RWBS_FLAG_RAHEAD", RWBS_FLAG_RAHEAD
)
43 ctf_enum_value("RWBS_FLAG_BARRIER", RWBS_FLAG_BARRIER
)
44 ctf_enum_value("RWBS_FLAG_SYNC", RWBS_FLAG_SYNC
)
45 ctf_enum_value("RWBS_FLAG_META", RWBS_FLAG_META
)
46 ctf_enum_value("RWBS_FLAG_SECURE", RWBS_FLAG_SECURE
)
47 ctf_enum_value("RWBS_FLAG_FLUSH", RWBS_FLAG_FLUSH
)
48 ctf_enum_value("RWBS_FLAG_FUA", RWBS_FLAG_FUA
)
49 ctf_enum_value("RWBS_FLAG_PREFLUSH", RWBS_FLAG_PREFLUSH
)
53 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0) || \
54 LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
55 LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
56 LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
57 LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,4,103,7,0,0) || \
58 LTTNG_SLE_KERNEL_RANGE(4,4,114,94,0,0, 4,4,114,95,0,0) || \
59 LTTNG_SLE_KERNEL_RANGE(4,4,120,94,0,0, 4,4,120,95,0,0) || \
60 LTTNG_SLE_KERNEL_RANGE(4,4,126,94,0,0, 4,5,0,0,0,0))
62 #define lttng_req_op(rq) req_op(rq)
63 #define lttng_req_rw(rq) ((rq)->cmd_flags)
64 #define lttng_bio_op(bio) bio_op(bio)
65 #define lttng_bio_rw(bio) ((bio)->bi_opf)
67 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
68 ctf_enum(block_rq_type, type, rwbs, \
69 (((op) == REQ_OP_WRITE || (op) == REQ_OP_WRITE_SAME) ? RWBS_FLAG_WRITE : \
70 ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
71 ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
72 ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
73 ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
75 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
76 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
77 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
78 | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
79 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
81 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
83 #define lttng_req_op(rq)
84 #define lttng_req_rw(rq) ((rq)->cmd_flags)
85 #define lttng_bio_op(bio)
86 #define lttng_bio_rw(bio) ((bio)->bi_rw)
88 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
89 ctf_enum(block_rq_type, type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
90 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
91 ( (bytes) ? 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_SECURE ? RWBS_FLAG_SECURE : 0) \
97 | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \
98 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
102 #define lttng_req_op(rq)
103 #define lttng_req_rw(rq) ((rq)->cmd_flags)
104 #define lttng_bio_op(bio)
105 #define lttng_bio_rw(bio) ((bio)->bi_rw)
107 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
108 ctf_enum(block_rq_type, type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
109 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
110 ( (bytes) ? RWBS_FLAG_READ : \
112 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
113 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
114 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
115 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
119 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
120 LTTNG_TRACEPOINT_EVENT_CLASS(block_buffer
,
122 TP_PROTO(struct buffer_head
*bh
),
127 ctf_integer(dev_t
, dev
, bh
->b_bdev
->bd_dev
)
128 ctf_integer(sector_t
, sector
, bh
->b_blocknr
)
129 ctf_integer(size_t, size
, bh
->b_size
)
134 * block_touch_buffer - mark a buffer accessed
135 * @bh: buffer_head being touched
137 * Called from touch_buffer().
139 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_touch_buffer
,
141 TP_PROTO(struct buffer_head
*bh
),
147 * block_dirty_buffer - mark a buffer dirty
148 * @bh: buffer_head being dirtied
150 * Called from mark_buffer_dirty().
152 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_dirty_buffer
,
154 TP_PROTO(struct buffer_head
*bh
),
160 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
161 /* block_rq_with_error event class removed in kernel 4.12 */
162 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
163 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
165 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
171 unsigned int nr_sector
;
177 if (blk_rq_is_scsi(rq
)) {
178 struct scsi_request
*scsi_rq
= scsi_req(rq
);
179 tp_locvar
->sector
= 0;
180 tp_locvar
->nr_sector
= 0;
181 tp_locvar
->cmd
= scsi_rq
->cmd
;
182 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
184 tp_locvar
->sector
= blk_rq_pos(rq
);
185 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
186 tp_locvar
->cmd
= NULL
;
187 tp_locvar
->cmd_len
= 0;
192 ctf_integer(dev_t
, dev
,
193 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
194 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
195 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
196 ctf_integer(int, errors
, rq
->errors
)
197 blk_rwbs_ctf_integer(unsigned int, rwbs
,
198 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
199 ctf_sequence_hex(unsigned char, cmd
,
200 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
205 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
206 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
208 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
214 unsigned int nr_sector
;
221 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
222 tp_locvar
->sector
= 0;
223 tp_locvar
->nr_sector
= 0;
224 tp_locvar
->cmd
= rq
->cmd
;
225 tp_locvar
->cmd_len
= rq
->cmd_len
;
227 tp_locvar
->sector
= blk_rq_pos(rq
);
228 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
229 tp_locvar
->cmd
= NULL
;
230 tp_locvar
->cmd_len
= 0;
235 ctf_integer(dev_t
, dev
,
236 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
237 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
238 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
239 ctf_integer(int, errors
, rq
->errors
)
240 blk_rwbs_ctf_integer(unsigned int, rwbs
,
241 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
242 ctf_sequence_hex(unsigned char, cmd
,
243 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
248 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
250 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0))
252 * block_rq_abort - abort block operation request
253 * @q: queue containing the block operation request
254 * @rq: block IO operation request
256 * Called immediately after pending block IO operation request @rq in
257 * queue @q is aborted. The fields in the operation request @rq
258 * can be examined to determine which device and sectors the pending
259 * operation would access.
261 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_abort
,
263 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
270 * block_rq_requeue - place block IO request back on a queue
271 * @q: queue holding operation
272 * @rq: block IO operation request
274 * The block operation request @rq is being placed back into queue
275 * @q. For some reason the request was not completed and needs to be
276 * put back in the queue.
278 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
279 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
281 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
286 ctf_integer(dev_t
, dev
,
287 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
288 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
289 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
290 blk_rwbs_ctf_integer(unsigned int, rwbs
,
291 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
295 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_requeue
,
297 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
304 * block_rq_complete - block IO operation completed by device driver
305 * @q: queue containing the block operation request
306 * @rq: block operations request
307 * @nr_bytes: number of completed bytes
309 * The block_rq_complete tracepoint event indicates that some portion
310 * of operation request has been completed by the device driver. If
311 * the @rq->bio is %NULL, then there is absolutely no additional work to
312 * do for the request. If @rq->bio is non-NULL then there is
313 * additional work required to complete the request.
315 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
316 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
318 TP_PROTO(struct request
*rq
, int error
, unsigned int nr_bytes
),
320 TP_ARGS(rq
, error
, nr_bytes
),
323 ctf_integer(dev_t
, dev
,
324 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
325 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
326 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
327 ctf_integer(int, error
, error
)
328 blk_rwbs_ctf_integer(unsigned int, rwbs
,
329 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
332 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
333 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
335 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
336 unsigned int nr_bytes
),
338 TP_ARGS(q
, rq
, nr_bytes
),
346 if (blk_rq_is_scsi(rq
)) {
347 struct scsi_request
*scsi_rq
= scsi_req(rq
);
348 tp_locvar
->cmd
= scsi_rq
->cmd
;
349 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
351 tp_locvar
->cmd
= NULL
;
352 tp_locvar
->cmd_len
= 0;
357 ctf_integer(dev_t
, dev
,
358 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
359 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
360 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
361 ctf_integer(int, errors
, rq
->errors
)
362 blk_rwbs_ctf_integer(unsigned int, rwbs
,
363 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
364 ctf_sequence_hex(unsigned char, cmd
,
365 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
370 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,5) \
371 || LTTNG_KERNEL_RANGE(3,12,21, 3,13,0) \
372 || LTTNG_KERNEL_RANGE(3,10,41, 3,11,0) \
373 || LTTNG_KERNEL_RANGE(3,4,91, 3,5,0) \
374 || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0) \
375 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,28, 3,14,0,0) \
376 || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0))
378 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
380 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
381 unsigned int nr_bytes
),
383 TP_ARGS(q
, rq
, nr_bytes
),
391 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
392 tp_locvar
->cmd
= rq
->cmd
;
393 tp_locvar
->cmd_len
= rq
->cmd_len
;
395 tp_locvar
->cmd
= NULL
;
396 tp_locvar
->cmd_len
= 0;
401 ctf_integer(dev_t
, dev
,
402 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
403 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
404 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
405 ctf_integer(int, errors
, rq
->errors
)
406 blk_rwbs_ctf_integer(unsigned int, rwbs
,
407 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
408 ctf_sequence_hex(unsigned char, cmd
,
409 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
415 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
418 * block_rq_complete - block IO operation completed by device driver
419 * @q: queue containing the block operation request
420 * @rq: block operations request
422 * The block_rq_complete tracepoint event indicates that some portion
423 * of operation request has been completed by the device driver. If
424 * the @rq->bio is %NULL, then there is absolutely no additional work to
425 * do for the request. If @rq->bio is non-NULL then there is
426 * additional work required to complete the request.
428 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_complete
,
430 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
435 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
437 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
438 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
440 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
445 ctf_integer(dev_t
, dev
,
446 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
447 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
448 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
449 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
450 ctf_integer(pid_t
, tid
, current
->pid
)
451 blk_rwbs_ctf_integer(unsigned int, rwbs
,
452 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
453 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
456 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
457 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
459 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
465 unsigned int nr_sector
;
472 if (blk_rq_is_scsi(rq
)) {
473 struct scsi_request
*scsi_rq
= scsi_req(rq
);
474 tp_locvar
->sector
= 0;
475 tp_locvar
->nr_sector
= 0;
476 tp_locvar
->bytes
= scsi_rq
->resid_len
;
477 tp_locvar
->cmd
= scsi_rq
->cmd
;
478 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
480 tp_locvar
->sector
= blk_rq_pos(rq
);
481 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
482 tp_locvar
->bytes
= 0;
483 tp_locvar
->cmd
= NULL
;
484 tp_locvar
->cmd_len
= 0;
489 ctf_integer(dev_t
, dev
,
490 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
491 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
492 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
493 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
494 ctf_integer(pid_t
, tid
, current
->pid
)
495 blk_rwbs_ctf_integer(unsigned int, rwbs
,
496 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
497 ctf_sequence_hex(unsigned char, cmd
,
498 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
499 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
504 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
505 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
507 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
513 unsigned int nr_sector
;
520 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
521 tp_locvar
->sector
= 0;
522 tp_locvar
->nr_sector
= 0;
523 tp_locvar
->bytes
= blk_rq_bytes(rq
);
524 tp_locvar
->cmd
= rq
->cmd
;
525 tp_locvar
->cmd_len
= rq
->cmd_len
;
527 tp_locvar
->sector
= blk_rq_pos(rq
);
528 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
529 tp_locvar
->bytes
= 0;
530 tp_locvar
->cmd
= NULL
;
531 tp_locvar
->cmd_len
= 0;
536 ctf_integer(dev_t
, dev
,
537 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
538 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
539 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
540 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
541 ctf_integer(pid_t
, tid
, current
->pid
)
542 blk_rwbs_ctf_integer(unsigned int, rwbs
,
543 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
544 ctf_sequence_hex(unsigned char, cmd
,
545 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
546 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
551 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
554 * block_rq_insert - insert block operation request into queue
556 * @rq: block IO operation request
558 * Called immediately before block operation request @rq is inserted
559 * into queue @q. The fields in the operation request @rq struct can
560 * be examined to determine which device and sectors the pending
561 * operation would access.
563 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
565 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
571 * block_rq_issue - issue pending block IO request operation to device driver
572 * @q: queue holding operation
573 * @rq: block IO operation operation request
575 * Called when block operation request @rq from queue @q is sent to a
576 * device driver for processing.
578 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
580 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
586 * block_bio_bounce - used bounce buffer when processing block operation
587 * @q: queue holding the block operation
588 * @bio: block operation
590 * A bounce buffer was used to handle the block operation @bio in @q.
591 * This occurs when hardware limitations prevent a direct transfer of
592 * data between the @bio data memory area and the IO device. Use of a
593 * bounce buffer requires extra copying of data and decreases
596 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
598 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
603 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
604 ctf_integer(dev_t
, dev
, bio_dev(bio
))
606 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
608 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
609 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
610 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
611 blk_rwbs_ctf_integer(unsigned int, rwbs
,
612 lttng_bio_op(bio
), lttng_bio_rw(bio
),
613 bio
->bi_iter
.bi_size
)
614 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
615 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
616 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
617 blk_rwbs_ctf_integer(unsigned int, rwbs
,
618 lttng_bio_op(bio
), lttng_bio_rw(bio
),
620 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
621 ctf_integer(pid_t
, tid
, current
->pid
)
622 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
627 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
629 * block_bio_complete - completed all work on the block operation
630 * @q: queue holding the block operation
631 * @bio: block operation completed
632 * @error: io error value
634 * This tracepoint indicates there is no further work to do on this
635 * block IO operation @bio.
637 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
639 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
644 ctf_integer(dev_t
, dev
, bio_dev(bio
))
645 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
646 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
647 ctf_integer(int, error
, blk_status_to_errno(bio
->bi_status
))
648 blk_rwbs_ctf_integer(unsigned int, rwbs
,
649 lttng_bio_op(bio
), lttng_bio_rw(bio
),
650 bio
->bi_iter
.bi_size
)
653 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
655 * block_bio_complete - completed all work on the block operation
656 * @q: queue holding the block operation
657 * @bio: block operation completed
658 * @error: io error value
660 * This tracepoint indicates there is no further work to do on this
661 * block IO operation @bio.
663 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
665 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
667 TP_ARGS(q
, bio
, error
),
670 ctf_integer(dev_t
, dev
, bio_dev(bio
))
671 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
672 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
673 ctf_integer(int, error
, error
)
674 blk_rwbs_ctf_integer(unsigned int, rwbs
,
675 lttng_bio_op(bio
), lttng_bio_rw(bio
),
676 bio
->bi_iter
.bi_size
)
679 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
681 * block_bio_complete - completed all work on the block operation
682 * @q: queue holding the block operation
683 * @bio: block operation completed
684 * @error: io error value
686 * This tracepoint indicates there is no further work to do on this
687 * block IO operation @bio.
689 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
691 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
693 TP_ARGS(q
, bio
, error
),
696 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
697 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
698 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
699 ctf_integer(int, error
, error
)
700 blk_rwbs_ctf_integer(unsigned int, rwbs
,
701 lttng_bio_op(bio
), lttng_bio_rw(bio
),
702 bio
->bi_iter
.bi_size
)
707 * block_bio_complete - completed all work on the block operation
708 * @q: queue holding the block operation
709 * @bio: block operation completed
710 * @error: io error value
712 * This tracepoint indicates there is no further work to do on this
713 * block IO operation @bio.
715 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
717 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
719 TP_ARGS(q
, bio
, error
),
722 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
723 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
724 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
725 ctf_integer(int, error
, error
)
726 blk_rwbs_ctf_integer(unsigned int, rwbs
,
727 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
732 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
733 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
735 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
740 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
741 ctf_integer(dev_t
, dev
, bio_dev(bio
))
743 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
745 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
746 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
747 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
748 blk_rwbs_ctf_integer(unsigned int, rwbs
,
749 lttng_bio_op(bio
), lttng_bio_rw(bio
),
750 bio
->bi_iter
.bi_size
)
751 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
752 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
753 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
754 blk_rwbs_ctf_integer(unsigned int, rwbs
,
755 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
756 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
757 ctf_integer(pid_t
, tid
, current
->pid
)
758 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
763 * block_bio_backmerge - merging block operation to the end of an existing operation
764 * @q: queue holding operation
765 * @bio: new block operation to merge
767 * Merging block request @bio to the end of an existing block request
770 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_backmerge
,
772 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
778 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
779 * @q: queue holding operation
780 * @bio: new block operation to merge
782 * Merging block IO operation @bio to the beginning of an existing block
783 * operation in queue @q.
785 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_frontmerge
,
787 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
793 * block_bio_queue - putting new block IO operation in queue
794 * @q: queue holding operation
795 * @bio: new block operation
797 * About to place the block IO operation @bio into queue @q.
799 LTTNG_TRACEPOINT_EVENT(block_bio_queue
,
801 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
806 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
807 ctf_integer(dev_t
, dev
, bio_dev(bio
))
809 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
811 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
812 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
813 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
814 blk_rwbs_ctf_integer(unsigned int, rwbs
,
815 lttng_bio_op(bio
), lttng_bio_rw(bio
),
816 bio
->bi_iter
.bi_size
)
817 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
818 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
819 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
820 blk_rwbs_ctf_integer(unsigned int, rwbs
,
821 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
822 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
823 ctf_integer(pid_t
, tid
, current
->pid
)
824 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
827 #else /* if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
828 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
830 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
835 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
836 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
837 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
838 blk_rwbs_ctf_integer(unsigned int, rwbs
,
839 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
840 ctf_integer(pid_t
, tid
, current
->pid
)
841 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
846 * block_bio_backmerge - merging block operation to the end of an existing operation
847 * @q: queue holding operation
848 * @bio: new block operation to merge
850 * Merging block request @bio to the end of an existing block request
853 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
855 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
861 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
862 * @q: queue holding operation
863 * @bio: new block operation to merge
865 * Merging block IO operation @bio to the beginning of an existing block
866 * operation in queue @q.
868 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
870 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
876 * block_bio_queue - putting new block IO operation in queue
877 * @q: queue holding operation
878 * @bio: new block operation
880 * About to place the block IO operation @bio into queue @q.
882 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
884 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
888 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
890 LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq
,
892 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
897 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
898 ctf_integer(dev_t
, dev
, bio
? bio_dev(bio
) : 0)
900 ctf_integer(dev_t
, dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
902 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
903 ctf_integer(sector_t
, sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
904 ctf_integer(unsigned int, nr_sector
,
905 bio
? bio_sectors(bio
) : 0)
906 blk_rwbs_ctf_integer(unsigned int, rwbs
,
907 bio
? lttng_bio_op(bio
) : 0,
908 bio
? lttng_bio_rw(bio
) : 0,
909 bio
? bio
->bi_iter
.bi_size
: 0)
910 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
911 ctf_integer(sector_t
, sector
, bio
? bio
->bi_sector
: 0)
912 ctf_integer(unsigned int, nr_sector
,
913 bio
? bio
->bi_size
>> 9 : 0)
914 blk_rwbs_ctf_integer(unsigned int, rwbs
,
915 bio
? lttng_bio_op(bio
) : 0,
916 bio
? lttng_bio_rw(bio
) : 0,
917 bio
? bio
->bi_size
: 0)
918 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
919 ctf_integer(pid_t
, tid
, current
->pid
)
920 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
925 * block_getrq - get a free request entry in queue for block IO operations
926 * @q: queue for operations
927 * @bio: pending block IO operation (can be %NULL)
928 * @rw: low bit indicates a read (%0) or a write (%1)
930 * A request struct for queue @q has been allocated to handle the
931 * block IO operation @bio.
933 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_getrq
,
935 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
941 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
942 * @q: queue for operation
943 * @bio: pending block IO operation (can be %NULL)
944 * @rw: low bit indicates a read (%0) or a write (%1)
946 * In the case where a request struct cannot be provided for queue @q
947 * the process needs to wait for an request struct to become
948 * available. This tracepoint event is generated each time the
949 * process goes to sleep waiting for request struct become available.
951 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_sleeprq
,
953 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
959 * block_plug - keep operations requests in request queue
960 * @q: request queue to plug
962 * Plug the request queue @q. Do not allow block operation requests
963 * to be sent to the device driver. Instead, accumulate requests in
964 * the queue to improve throughput performance of the block device.
966 LTTNG_TRACEPOINT_EVENT(block_plug
,
968 TP_PROTO(struct request_queue
*q
),
973 ctf_integer(pid_t
, tid
, current
->pid
)
974 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
978 LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug
,
980 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
982 TP_ARGS(q
, depth
, explicit),
985 ctf_integer(int, nr_rq
, depth
)
986 ctf_integer(pid_t
, tid
, current
->pid
)
987 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
992 * block_unplug - release of operations requests in request queue
993 * @q: request queue to unplug
994 * @depth: number of requests just added to the queue
995 * @explicit: whether this was an explicit unplug, or one from schedule()
997 * Unplug request queue @q because device driver is scheduled to work
998 * on elements in the request queue.
1000 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug
,
1002 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
1004 TP_ARGS(q
, depth
, explicit)
1008 * block_split - split a single bio struct into two bio structs
1009 * @q: queue containing the bio
1010 * @bio: block operation being split
1011 * @new_sector: The starting sector for the new bio
1013 * The bio request @bio in request queue @q needs to be split into two
1014 * bio requests. The newly created @bio request starts at
1015 * @new_sector. This split may be required due to hardware limitation
1016 * such as operation crossing device boundaries in a RAID system.
1018 LTTNG_TRACEPOINT_EVENT(block_split
,
1020 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1021 unsigned int new_sector
),
1023 TP_ARGS(q
, bio
, new_sector
),
1026 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
1027 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1029 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1031 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
1032 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1033 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1034 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1035 bio
->bi_iter
.bi_size
)
1036 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1037 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1038 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1039 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1040 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1041 ctf_integer(sector_t
, new_sector
, new_sector
)
1042 ctf_integer(pid_t
, tid
, current
->pid
)
1043 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1048 * block_bio_remap - map request for a logical device to the raw device
1049 * @q: queue holding the operation
1050 * @bio: revised operation
1051 * @dev: device for the operation
1052 * @from: original sector for the operation
1054 * An operation for a logical device has been mapped to the
1057 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1059 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1062 TP_ARGS(q
, bio
, dev
, from
),
1065 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
1066 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1068 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1070 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
1071 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1072 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1073 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1074 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1075 bio
->bi_iter
.bi_size
)
1076 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1077 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1078 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1079 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1080 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1081 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1082 ctf_integer(dev_t
, old_dev
, dev
)
1083 ctf_integer(sector_t
, old_sector
, from
)
1088 * block_rq_remap - map request for a block operation request
1089 * @q: queue holding the operation
1090 * @rq: block IO operation request
1091 * @dev: device for the operation
1092 * @from: original sector for the operation
1094 * The block operation request @rq in @q has been remapped. The block
1095 * operation request @rq holds the current information and @from hold
1096 * the original sector.
1098 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1100 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
1103 TP_ARGS(q
, rq
, dev
, from
),
1106 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1107 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1108 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1109 ctf_integer(dev_t
, old_dev
, dev
)
1110 ctf_integer(sector_t
, old_sector
, from
)
1111 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1112 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1116 #undef __print_rwbs_flags
1117 #undef blk_fill_rwbs
1119 #endif /* LTTNG_TRACE_BLOCK_H */
1121 /* This part must be outside protection */
1122 #include <probes/define_trace.h>
This page took 0.062734 seconds and 4 git commands to generate.