0dab9317cef6f729f310c0a7c45f9faf5fc0e836
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 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0) || \
38 LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,114,92,0,0))
40 #define lttng_req_op(rq) req_op(rq)
41 #define lttng_req_rw(rq) ((rq)->cmd_flags)
42 #define lttng_bio_op(bio) bio_op(bio)
43 #define lttng_bio_rw(bio) ((bio)->bi_opf)
45 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
46 ctf_integer(type, rwbs, \
47 (((op) == REQ_OP_WRITE || (op) == REQ_OP_WRITE_SAME) ? RWBS_FLAG_WRITE : \
48 ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
49 ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
50 ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
51 ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
53 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
54 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
55 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
56 | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
57 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
59 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
61 #define lttng_req_op(rq)
62 #define lttng_req_rw(rq) ((rq)->cmd_flags)
63 #define lttng_bio_op(bio)
64 #define lttng_bio_rw(bio) ((bio)->bi_rw)
66 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
67 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
68 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
69 ( (bytes) ? RWBS_FLAG_READ : \
71 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
72 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
73 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
74 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \
75 | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \
76 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
78 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
80 #define lttng_req_op(rq)
81 #define lttng_req_rw(rq) ((rq)->cmd_flags)
82 #define lttng_bio_op(bio)
83 #define lttng_bio_rw(bio) ((bio)->bi_rw)
85 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
86 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
87 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
88 ( (bytes) ? RWBS_FLAG_READ : \
90 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
91 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
92 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
93 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
95 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
97 #define lttng_req_op(rq)
98 #define lttng_req_rw(rq) ((rq)->cmd_flags)
99 #define lttng_bio_op(bio)
100 #define lttng_bio_rw(bio) ((bio)->bi_rw)
102 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
103 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
104 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
105 ( (bytes) ? RWBS_FLAG_READ : \
107 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
108 | ((rw) & REQ_HARDBARRIER ? RWBS_FLAG_BARRIER : 0) \
109 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
110 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
111 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
115 #define lttng_req_op(rq)
116 #define lttng_req_rw(rq) ((rq)->cmd_flags)
117 #define lttng_bio_op(bio)
118 #define lttng_bio_rw(bio) ((bio)->bi_rw)
120 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
121 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
122 ( (rw) & (1 << BIO_RW_DISCARD) ? RWBS_FLAG_DISCARD : \
123 ( (bytes) ? RWBS_FLAG_READ : \
125 | ((rw) & (1 << BIO_RW_AHEAD) ? RWBS_FLAG_RAHEAD : 0) \
126 | ((rw) & (1 << BIO_RW_SYNCIO) ? RWBS_FLAG_SYNC : 0) \
127 | ((rw) & (1 << BIO_RW_META) ? RWBS_FLAG_META : 0) \
128 | ((rw) & (1 << BIO_RW_BARRIER) ? RWBS_FLAG_BARRIER : 0))
132 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
133 LTTNG_TRACEPOINT_EVENT_CLASS(block_buffer
,
135 TP_PROTO(struct buffer_head
*bh
),
140 ctf_integer(dev_t
, dev
, bh
->b_bdev
->bd_dev
)
141 ctf_integer(sector_t
, sector
, bh
->b_blocknr
)
142 ctf_integer(size_t, size
, bh
->b_size
)
147 * block_touch_buffer - mark a buffer accessed
148 * @bh: buffer_head being touched
150 * Called from touch_buffer().
152 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_touch_buffer
,
154 TP_PROTO(struct buffer_head
*bh
),
160 * block_dirty_buffer - mark a buffer dirty
161 * @bh: buffer_head being dirtied
163 * Called from mark_buffer_dirty().
165 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_dirty_buffer
,
167 TP_PROTO(struct buffer_head
*bh
),
173 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
174 /* block_rq_with_error event class removed in kernel 4.12 */
175 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
176 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
178 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
184 unsigned int nr_sector
;
190 if (blk_rq_is_scsi(rq
)) {
191 struct scsi_request
*scsi_rq
= scsi_req(rq
);
192 tp_locvar
->sector
= 0;
193 tp_locvar
->nr_sector
= 0;
194 tp_locvar
->cmd
= scsi_rq
->cmd
;
195 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
197 tp_locvar
->sector
= blk_rq_pos(rq
);
198 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
199 tp_locvar
->cmd
= NULL
;
200 tp_locvar
->cmd_len
= 0;
205 ctf_integer(dev_t
, dev
,
206 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
207 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
208 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
209 ctf_integer(int, errors
, rq
->errors
)
210 blk_rwbs_ctf_integer(unsigned int, rwbs
,
211 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
212 ctf_sequence_hex(unsigned char, cmd
,
213 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
218 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
219 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
221 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
227 unsigned int nr_sector
;
234 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
235 tp_locvar
->sector
= 0;
236 tp_locvar
->nr_sector
= 0;
237 tp_locvar
->cmd
= rq
->cmd
;
238 tp_locvar
->cmd_len
= rq
->cmd_len
;
240 tp_locvar
->sector
= blk_rq_pos(rq
);
241 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
242 tp_locvar
->cmd
= NULL
;
243 tp_locvar
->cmd_len
= 0;
248 ctf_integer(dev_t
, dev
,
249 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
250 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
251 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
252 ctf_integer(int, errors
, rq
->errors
)
253 blk_rwbs_ctf_integer(unsigned int, rwbs
,
254 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
255 ctf_sequence_hex(unsigned char, cmd
,
256 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
261 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
263 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0))
265 * block_rq_abort - abort block operation request
266 * @q: queue containing the block operation request
267 * @rq: block IO operation request
269 * Called immediately after pending block IO operation request @rq in
270 * queue @q is aborted. The fields in the operation request @rq
271 * can be examined to determine which device and sectors the pending
272 * operation would access.
274 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_abort
,
276 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
283 * block_rq_requeue - place block IO request back on a queue
284 * @q: queue holding operation
285 * @rq: block IO operation request
287 * The block operation request @rq is being placed back into queue
288 * @q. For some reason the request was not completed and needs to be
289 * put back in the queue.
291 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
292 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
294 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
299 ctf_integer(dev_t
, dev
,
300 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
301 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
302 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
303 blk_rwbs_ctf_integer(unsigned int, rwbs
,
304 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
308 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_requeue
,
310 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
317 * block_rq_complete - block IO operation completed by device driver
318 * @q: queue containing the block operation request
319 * @rq: block operations request
320 * @nr_bytes: number of completed bytes
322 * The block_rq_complete tracepoint event indicates that some portion
323 * of operation request has been completed by the device driver. If
324 * the @rq->bio is %NULL, then there is absolutely no additional work to
325 * do for the request. If @rq->bio is non-NULL then there is
326 * additional work required to complete the request.
328 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
329 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
331 TP_PROTO(struct request
*rq
, int error
, unsigned int nr_bytes
),
333 TP_ARGS(rq
, error
, nr_bytes
),
336 ctf_integer(dev_t
, dev
,
337 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
338 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
339 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
340 ctf_integer(int, error
, error
)
341 blk_rwbs_ctf_integer(unsigned int, rwbs
,
342 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
345 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
346 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
348 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
349 unsigned int nr_bytes
),
351 TP_ARGS(q
, rq
, nr_bytes
),
359 if (blk_rq_is_scsi(rq
)) {
360 struct scsi_request
*scsi_rq
= scsi_req(rq
);
361 tp_locvar
->cmd
= scsi_rq
->cmd
;
362 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
364 tp_locvar
->cmd
= NULL
;
365 tp_locvar
->cmd_len
= 0;
370 ctf_integer(dev_t
, dev
,
371 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
372 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
373 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
374 ctf_integer(int, errors
, rq
->errors
)
375 blk_rwbs_ctf_integer(unsigned int, rwbs
,
376 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
377 ctf_sequence_hex(unsigned char, cmd
,
378 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
383 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,5) \
384 || LTTNG_KERNEL_RANGE(3,12,21, 3,13,0) \
385 || LTTNG_KERNEL_RANGE(3,10,41, 3,11,0) \
386 || LTTNG_KERNEL_RANGE(3,4,91, 3,5,0) \
387 || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0) \
388 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,28, 3,14,0,0) \
389 || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0))
391 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
393 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
394 unsigned int nr_bytes
),
396 TP_ARGS(q
, rq
, nr_bytes
),
404 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
405 tp_locvar
->cmd
= rq
->cmd
;
406 tp_locvar
->cmd_len
= rq
->cmd_len
;
408 tp_locvar
->cmd
= NULL
;
409 tp_locvar
->cmd_len
= 0;
414 ctf_integer(dev_t
, dev
,
415 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
416 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
417 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
418 ctf_integer(int, errors
, rq
->errors
)
419 blk_rwbs_ctf_integer(unsigned int, rwbs
,
420 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
421 ctf_sequence_hex(unsigned char, cmd
,
422 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
428 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
431 * block_rq_complete - block IO operation completed by device driver
432 * @q: queue containing the block operation request
433 * @rq: block operations request
435 * The block_rq_complete tracepoint event indicates that some portion
436 * of operation request has been completed by the device driver. If
437 * the @rq->bio is %NULL, then there is absolutely no additional work to
438 * do for the request. If @rq->bio is non-NULL then there is
439 * additional work required to complete the request.
441 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_complete
,
443 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
448 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
450 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
451 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
453 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
458 ctf_integer(dev_t
, dev
,
459 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
460 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
461 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
462 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
463 ctf_integer(pid_t
, tid
, current
->pid
)
464 blk_rwbs_ctf_integer(unsigned int, rwbs
,
465 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
466 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
469 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
470 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
472 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
478 unsigned int nr_sector
;
485 if (blk_rq_is_scsi(rq
)) {
486 struct scsi_request
*scsi_rq
= scsi_req(rq
);
487 tp_locvar
->sector
= 0;
488 tp_locvar
->nr_sector
= 0;
489 tp_locvar
->bytes
= scsi_rq
->resid_len
;
490 tp_locvar
->cmd
= scsi_rq
->cmd
;
491 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
493 tp_locvar
->sector
= blk_rq_pos(rq
);
494 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
495 tp_locvar
->bytes
= 0;
496 tp_locvar
->cmd
= NULL
;
497 tp_locvar
->cmd_len
= 0;
502 ctf_integer(dev_t
, dev
,
503 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
504 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
505 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
506 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
507 ctf_integer(pid_t
, tid
, current
->pid
)
508 blk_rwbs_ctf_integer(unsigned int, rwbs
,
509 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
510 ctf_sequence_hex(unsigned char, cmd
,
511 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
512 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
517 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
518 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
520 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
526 unsigned int nr_sector
;
533 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
534 tp_locvar
->sector
= 0;
535 tp_locvar
->nr_sector
= 0;
536 tp_locvar
->bytes
= blk_rq_bytes(rq
);
537 tp_locvar
->cmd
= rq
->cmd
;
538 tp_locvar
->cmd_len
= rq
->cmd_len
;
540 tp_locvar
->sector
= blk_rq_pos(rq
);
541 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
542 tp_locvar
->bytes
= 0;
543 tp_locvar
->cmd
= NULL
;
544 tp_locvar
->cmd_len
= 0;
549 ctf_integer(dev_t
, dev
,
550 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
551 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
552 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
553 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
554 ctf_integer(pid_t
, tid
, current
->pid
)
555 blk_rwbs_ctf_integer(unsigned int, rwbs
,
556 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
557 ctf_sequence_hex(unsigned char, cmd
,
558 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
559 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
564 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
567 * block_rq_insert - insert block operation request into queue
569 * @rq: block IO operation request
571 * Called immediately before block operation request @rq is inserted
572 * into queue @q. The fields in the operation request @rq struct can
573 * be examined to determine which device and sectors the pending
574 * operation would access.
576 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
578 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
584 * block_rq_issue - issue pending block IO request operation to device driver
585 * @q: queue holding operation
586 * @rq: block IO operation operation request
588 * Called when block operation request @rq from queue @q is sent to a
589 * device driver for processing.
591 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
593 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
599 * block_bio_bounce - used bounce buffer when processing block operation
600 * @q: queue holding the block operation
601 * @bio: block operation
603 * A bounce buffer was used to handle the block operation @bio in @q.
604 * This occurs when hardware limitations prevent a direct transfer of
605 * data between the @bio data memory area and the IO device. Use of a
606 * bounce buffer requires extra copying of data and decreases
609 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
611 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
616 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
617 ctf_integer(dev_t
, dev
, bio_dev(bio
))
619 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
621 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
622 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
623 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
624 blk_rwbs_ctf_integer(unsigned int, rwbs
,
625 lttng_bio_op(bio
), lttng_bio_rw(bio
),
626 bio
->bi_iter
.bi_size
)
627 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
628 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
629 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
630 blk_rwbs_ctf_integer(unsigned int, rwbs
,
631 lttng_bio_op(bio
), lttng_bio_rw(bio
),
633 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
634 ctf_integer(pid_t
, tid
, current
->pid
)
635 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
640 * block_bio_complete - completed all work on the block operation
641 * @q: queue holding the block operation
642 * @bio: block operation completed
643 * @error: io error value
645 * This tracepoint indicates there is no further work to do on this
646 * block IO operation @bio.
648 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
650 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
651 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
653 TP_ARGS(q
, bio
, error
),
655 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
661 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
662 ctf_integer(dev_t
, dev
, bio_dev(bio
))
664 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
666 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
667 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
668 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
669 ctf_integer(int, error
, error
)
670 blk_rwbs_ctf_integer(unsigned int, rwbs
,
671 lttng_bio_op(bio
), lttng_bio_rw(bio
),
672 bio
->bi_iter
.bi_size
)
673 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
674 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
675 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
676 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
677 ctf_integer(int, error
, error
)
679 ctf_integer(int, error
, 0)
681 blk_rwbs_ctf_integer(unsigned int, rwbs
,
682 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
683 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
687 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
688 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
690 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
695 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
696 ctf_integer(dev_t
, dev
, bio_dev(bio
))
698 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
700 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
701 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
702 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
703 blk_rwbs_ctf_integer(unsigned int, rwbs
,
704 lttng_bio_op(bio
), lttng_bio_rw(bio
),
705 bio
->bi_iter
.bi_size
)
706 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
707 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
708 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
709 blk_rwbs_ctf_integer(unsigned int, rwbs
,
710 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
711 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
712 ctf_integer(pid_t
, tid
, current
->pid
)
713 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
718 * block_bio_backmerge - merging block operation to the end of an existing operation
719 * @q: queue holding operation
720 * @bio: new block operation to merge
722 * Merging block request @bio to the end of an existing block request
725 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_backmerge
,
727 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
733 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
734 * @q: queue holding operation
735 * @bio: new block operation to merge
737 * Merging block IO operation @bio to the beginning of an existing block
738 * operation in queue @q.
740 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_frontmerge
,
742 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
748 * block_bio_queue - putting new block IO operation in queue
749 * @q: queue holding operation
750 * @bio: new block operation
752 * About to place the block IO operation @bio into queue @q.
754 LTTNG_TRACEPOINT_EVENT(block_bio_queue
,
756 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
761 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
762 ctf_integer(dev_t
, dev
, bio_dev(bio
))
764 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
766 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
767 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
768 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
769 blk_rwbs_ctf_integer(unsigned int, rwbs
,
770 lttng_bio_op(bio
), lttng_bio_rw(bio
),
771 bio
->bi_iter
.bi_size
)
772 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
773 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
774 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
775 blk_rwbs_ctf_integer(unsigned int, rwbs
,
776 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
777 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
778 ctf_integer(pid_t
, tid
, current
->pid
)
779 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
782 #else /* if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
783 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
785 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
790 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
791 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
792 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
793 blk_rwbs_ctf_integer(unsigned int, rwbs
,
794 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
795 ctf_integer(pid_t
, tid
, current
->pid
)
796 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
801 * block_bio_backmerge - merging block operation to the end of an existing operation
802 * @q: queue holding operation
803 * @bio: new block operation to merge
805 * Merging block request @bio to the end of an existing block request
808 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
810 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
816 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
817 * @q: queue holding operation
818 * @bio: new block operation to merge
820 * Merging block IO operation @bio to the beginning of an existing block
821 * operation in queue @q.
823 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
825 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
831 * block_bio_queue - putting new block IO operation in queue
832 * @q: queue holding operation
833 * @bio: new block operation
835 * About to place the block IO operation @bio into queue @q.
837 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
839 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
843 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
845 LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq
,
847 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
852 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
853 ctf_integer(dev_t
, dev
, bio
? bio_dev(bio
) : 0)
855 ctf_integer(dev_t
, dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
857 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
858 ctf_integer(sector_t
, sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
859 ctf_integer(unsigned int, nr_sector
,
860 bio
? bio_sectors(bio
) : 0)
861 blk_rwbs_ctf_integer(unsigned int, rwbs
,
862 bio
? lttng_bio_op(bio
) : 0,
863 bio
? lttng_bio_rw(bio
) : 0,
864 bio
? bio
->bi_iter
.bi_size
: 0)
865 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
866 ctf_integer(sector_t
, sector
, bio
? bio
->bi_sector
: 0)
867 ctf_integer(unsigned int, nr_sector
,
868 bio
? bio
->bi_size
>> 9 : 0)
869 blk_rwbs_ctf_integer(unsigned int, rwbs
,
870 bio
? lttng_bio_op(bio
) : 0,
871 bio
? lttng_bio_rw(bio
) : 0,
872 bio
? bio
->bi_size
: 0)
873 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
874 ctf_integer(pid_t
, tid
, current
->pid
)
875 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
880 * block_getrq - get a free request entry in queue for block IO operations
881 * @q: queue for operations
882 * @bio: pending block IO operation (can be %NULL)
883 * @rw: low bit indicates a read (%0) or a write (%1)
885 * A request struct for queue @q has been allocated to handle the
886 * block IO operation @bio.
888 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_getrq
,
890 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
896 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
897 * @q: queue for operation
898 * @bio: pending block IO operation (can be %NULL)
899 * @rw: low bit indicates a read (%0) or a write (%1)
901 * In the case where a request struct cannot be provided for queue @q
902 * the process needs to wait for an request struct to become
903 * available. This tracepoint event is generated each time the
904 * process goes to sleep waiting for request struct become available.
906 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_sleeprq
,
908 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
914 * block_plug - keep operations requests in request queue
915 * @q: request queue to plug
917 * Plug the request queue @q. Do not allow block operation requests
918 * to be sent to the device driver. Instead, accumulate requests in
919 * the queue to improve throughput performance of the block device.
921 LTTNG_TRACEPOINT_EVENT(block_plug
,
923 TP_PROTO(struct request_queue
*q
),
928 ctf_integer(pid_t
, tid
, current
->pid
)
929 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
933 LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug
,
935 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
936 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
938 TP_ARGS(q
, depth
, explicit),
940 TP_PROTO(struct request_queue
*q
),
946 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
947 ctf_integer(int, nr_rq
, depth
)
949 ctf_integer(int, nr_rq
, q
->rq
.count
[READ
] + q
->rq
.count
[WRITE
])
951 ctf_integer(pid_t
, tid
, current
->pid
)
952 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
956 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
958 * block_unplug_timer - timed release of operations requests in queue to device driver
959 * @q: request queue to unplug
961 * Unplug the request queue @q because a timer expired and allow block
962 * operation requests to be sent to the device driver.
964 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_timer
,
966 TP_PROTO(struct request_queue
*q
),
973 * block_unplug - release of operations requests in request queue
974 * @q: request queue to unplug
975 * @depth: number of requests just added to the queue
976 * @explicit: whether this was an explicit unplug, or one from schedule()
978 * Unplug request queue @q because device driver is scheduled to work
979 * on elements in the request queue.
981 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
982 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug
,
984 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_io
,
987 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
988 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
990 TP_ARGS(q
, depth
, explicit)
992 TP_PROTO(struct request_queue
*q
),
999 * block_split - split a single bio struct into two bio structs
1000 * @q: queue containing the bio
1001 * @bio: block operation being split
1002 * @new_sector: The starting sector for the new bio
1004 * The bio request @bio in request queue @q needs to be split into two
1005 * bio requests. The newly created @bio request starts at
1006 * @new_sector. This split may be required due to hardware limitation
1007 * such as operation crossing device boundaries in a RAID system.
1009 LTTNG_TRACEPOINT_EVENT(block_split
,
1011 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1012 unsigned int new_sector
),
1014 TP_ARGS(q
, bio
, new_sector
),
1017 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
1018 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1020 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1022 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
1023 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1024 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1025 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1026 bio
->bi_iter
.bi_size
)
1027 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1028 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1029 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1030 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1031 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1032 ctf_integer(sector_t
, new_sector
, new_sector
)
1033 ctf_integer(pid_t
, tid
, current
->pid
)
1034 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1039 * block_bio_remap - map request for a logical device to the raw device
1040 * @q: queue holding the operation
1041 * @bio: revised operation
1042 * @dev: device for the operation
1043 * @from: original sector for the operation
1045 * An operation for a logical device has been mapped to the
1048 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
1049 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1051 LTTNG_TRACEPOINT_EVENT(block_remap
,
1054 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1057 TP_ARGS(q
, bio
, dev
, from
),
1060 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
1061 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1063 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1065 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
1066 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1067 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1068 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1069 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1070 bio
->bi_iter
.bi_size
)
1071 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1072 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1073 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1074 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1075 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1076 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1077 ctf_integer(dev_t
, old_dev
, dev
)
1078 ctf_integer(sector_t
, old_sector
, from
)
1082 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
1084 * block_rq_remap - map request for a block operation request
1085 * @q: queue holding the operation
1086 * @rq: block IO operation request
1087 * @dev: device for the operation
1088 * @from: original sector for the operation
1090 * The block operation request @rq in @q has been remapped. The block
1091 * operation request @rq holds the current information and @from hold
1092 * the original sector.
1094 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1096 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
1099 TP_ARGS(q
, rq
, dev
, from
),
1102 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1103 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1104 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1105 ctf_integer(dev_t
, old_dev
, dev
)
1106 ctf_integer(sector_t
, old_sector
, from
)
1107 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1108 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1113 #undef __print_rwbs_flags
1114 #undef blk_fill_rwbs
1116 #endif /* LTTNG_TRACE_BLOCK_H */
1118 /* This part must be outside protection */
1119 #include <probes/define_trace.h>
This page took 0.053683 seconds and 4 git commands to generate.