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,73,6,0,0) || \
39 LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
40 LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
41 LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,4,103,7,0,0) || \
42 LTTNG_SLE_KERNEL_RANGE(4,4,114,94,0,0, 4,4,114,95,0,0) || \
43 LTTNG_SLE_KERNEL_RANGE(4,4,120,94,0,0, 4,4,120,95,0,0) || \
44 LTTNG_SLE_KERNEL_RANGE(4,4,126,94,0,0, 4,5,0,0,0,0))
46 #define lttng_req_op(rq) req_op(rq)
47 #define lttng_req_rw(rq) ((rq)->cmd_flags)
48 #define lttng_bio_op(bio) bio_op(bio)
49 #define lttng_bio_rw(bio) ((bio)->bi_opf)
51 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
52 ctf_integer(type, rwbs, \
53 (((op) == REQ_OP_WRITE || (op) == REQ_OP_WRITE_SAME) ? RWBS_FLAG_WRITE : \
54 ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
55 ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
56 ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
57 ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
59 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
60 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
61 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
62 | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
63 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
65 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
67 #define lttng_req_op(rq)
68 #define lttng_req_rw(rq) ((rq)->cmd_flags)
69 #define lttng_bio_op(bio)
70 #define lttng_bio_rw(bio) ((bio)->bi_rw)
72 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
73 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
74 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
75 ( (bytes) ? RWBS_FLAG_READ : \
77 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
78 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
79 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
80 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \
81 | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \
82 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
84 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
86 #define lttng_req_op(rq)
87 #define lttng_req_rw(rq) ((rq)->cmd_flags)
88 #define lttng_bio_op(bio)
89 #define lttng_bio_rw(bio) ((bio)->bi_rw)
91 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
92 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
93 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
94 ( (bytes) ? RWBS_FLAG_READ : \
96 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
97 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
98 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
99 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
101 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
103 #define lttng_req_op(rq)
104 #define lttng_req_rw(rq) ((rq)->cmd_flags)
105 #define lttng_bio_op(bio)
106 #define lttng_bio_rw(bio) ((bio)->bi_rw)
108 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
109 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
110 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
111 ( (bytes) ? RWBS_FLAG_READ : \
113 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
114 | ((rw) & REQ_HARDBARRIER ? RWBS_FLAG_BARRIER : 0) \
115 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
116 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
117 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
121 #define lttng_req_op(rq)
122 #define lttng_req_rw(rq) ((rq)->cmd_flags)
123 #define lttng_bio_op(bio)
124 #define lttng_bio_rw(bio) ((bio)->bi_rw)
126 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
127 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
128 ( (rw) & (1 << BIO_RW_DISCARD) ? RWBS_FLAG_DISCARD : \
129 ( (bytes) ? RWBS_FLAG_READ : \
131 | ((rw) & (1 << BIO_RW_AHEAD) ? RWBS_FLAG_RAHEAD : 0) \
132 | ((rw) & (1 << BIO_RW_SYNCIO) ? RWBS_FLAG_SYNC : 0) \
133 | ((rw) & (1 << BIO_RW_META) ? RWBS_FLAG_META : 0) \
134 | ((rw) & (1 << BIO_RW_BARRIER) ? RWBS_FLAG_BARRIER : 0))
138 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
139 LTTNG_TRACEPOINT_EVENT_CLASS(block_buffer
,
141 TP_PROTO(struct buffer_head
*bh
),
146 ctf_integer(dev_t
, dev
, bh
->b_bdev
->bd_dev
)
147 ctf_integer(sector_t
, sector
, bh
->b_blocknr
)
148 ctf_integer(size_t, size
, bh
->b_size
)
153 * block_touch_buffer - mark a buffer accessed
154 * @bh: buffer_head being touched
156 * Called from touch_buffer().
158 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_touch_buffer
,
160 TP_PROTO(struct buffer_head
*bh
),
166 * block_dirty_buffer - mark a buffer dirty
167 * @bh: buffer_head being dirtied
169 * Called from mark_buffer_dirty().
171 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_dirty_buffer
,
173 TP_PROTO(struct buffer_head
*bh
),
179 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
180 /* block_rq_with_error event class removed in kernel 4.12 */
181 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
182 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
184 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
190 unsigned int nr_sector
;
196 if (blk_rq_is_scsi(rq
)) {
197 struct scsi_request
*scsi_rq
= scsi_req(rq
);
198 tp_locvar
->sector
= 0;
199 tp_locvar
->nr_sector
= 0;
200 tp_locvar
->cmd
= scsi_rq
->cmd
;
201 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
203 tp_locvar
->sector
= blk_rq_pos(rq
);
204 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
205 tp_locvar
->cmd
= NULL
;
206 tp_locvar
->cmd_len
= 0;
211 ctf_integer(dev_t
, dev
,
212 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
213 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
214 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
215 ctf_integer(int, errors
, rq
->errors
)
216 blk_rwbs_ctf_integer(unsigned int, rwbs
,
217 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
218 ctf_sequence_hex(unsigned char, cmd
,
219 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
224 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
225 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
227 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
233 unsigned int nr_sector
;
240 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
241 tp_locvar
->sector
= 0;
242 tp_locvar
->nr_sector
= 0;
243 tp_locvar
->cmd
= rq
->cmd
;
244 tp_locvar
->cmd_len
= rq
->cmd_len
;
246 tp_locvar
->sector
= blk_rq_pos(rq
);
247 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
248 tp_locvar
->cmd
= NULL
;
249 tp_locvar
->cmd_len
= 0;
254 ctf_integer(dev_t
, dev
,
255 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
256 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
257 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
258 ctf_integer(int, errors
, rq
->errors
)
259 blk_rwbs_ctf_integer(unsigned int, rwbs
,
260 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
261 ctf_sequence_hex(unsigned char, cmd
,
262 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
267 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
269 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0))
271 * block_rq_abort - abort block operation request
272 * @q: queue containing the block operation request
273 * @rq: block IO operation request
275 * Called immediately after pending block IO operation request @rq in
276 * queue @q is aborted. The fields in the operation request @rq
277 * can be examined to determine which device and sectors the pending
278 * operation would access.
280 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_abort
,
282 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
289 * block_rq_requeue - place block IO request back on a queue
290 * @q: queue holding operation
291 * @rq: block IO operation request
293 * The block operation request @rq is being placed back into queue
294 * @q. For some reason the request was not completed and needs to be
295 * put back in the queue.
297 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
298 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
300 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
305 ctf_integer(dev_t
, dev
,
306 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
307 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
308 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
309 blk_rwbs_ctf_integer(unsigned int, rwbs
,
310 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
314 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_requeue
,
316 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
323 * block_rq_complete - block IO operation completed by device driver
324 * @q: queue containing the block operation request
325 * @rq: block operations request
326 * @nr_bytes: number of completed bytes
328 * The block_rq_complete tracepoint event indicates that some portion
329 * of operation request has been completed by the device driver. If
330 * the @rq->bio is %NULL, then there is absolutely no additional work to
331 * do for the request. If @rq->bio is non-NULL then there is
332 * additional work required to complete the request.
334 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
335 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
337 TP_PROTO(struct request
*rq
, int error
, unsigned int nr_bytes
),
339 TP_ARGS(rq
, error
, nr_bytes
),
342 ctf_integer(dev_t
, dev
,
343 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
344 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
345 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
346 ctf_integer(int, error
, error
)
347 blk_rwbs_ctf_integer(unsigned int, rwbs
,
348 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
351 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
352 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
354 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
355 unsigned int nr_bytes
),
357 TP_ARGS(q
, rq
, nr_bytes
),
365 if (blk_rq_is_scsi(rq
)) {
366 struct scsi_request
*scsi_rq
= scsi_req(rq
);
367 tp_locvar
->cmd
= scsi_rq
->cmd
;
368 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
370 tp_locvar
->cmd
= NULL
;
371 tp_locvar
->cmd_len
= 0;
376 ctf_integer(dev_t
, dev
,
377 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
378 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
379 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
380 ctf_integer(int, errors
, rq
->errors
)
381 blk_rwbs_ctf_integer(unsigned int, rwbs
,
382 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
383 ctf_sequence_hex(unsigned char, cmd
,
384 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
389 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,5) \
390 || LTTNG_KERNEL_RANGE(3,12,21, 3,13,0) \
391 || LTTNG_KERNEL_RANGE(3,10,41, 3,11,0) \
392 || LTTNG_KERNEL_RANGE(3,4,91, 3,5,0) \
393 || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0) \
394 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,28, 3,14,0,0) \
395 || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0))
397 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
399 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
400 unsigned int nr_bytes
),
402 TP_ARGS(q
, rq
, nr_bytes
),
410 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
411 tp_locvar
->cmd
= rq
->cmd
;
412 tp_locvar
->cmd_len
= rq
->cmd_len
;
414 tp_locvar
->cmd
= NULL
;
415 tp_locvar
->cmd_len
= 0;
420 ctf_integer(dev_t
, dev
,
421 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
422 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
423 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
424 ctf_integer(int, errors
, rq
->errors
)
425 blk_rwbs_ctf_integer(unsigned int, rwbs
,
426 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
427 ctf_sequence_hex(unsigned char, cmd
,
428 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
434 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
437 * block_rq_complete - block IO operation completed by device driver
438 * @q: queue containing the block operation request
439 * @rq: block operations request
441 * The block_rq_complete tracepoint event indicates that some portion
442 * of operation request has been completed by the device driver. If
443 * the @rq->bio is %NULL, then there is absolutely no additional work to
444 * do for the request. If @rq->bio is non-NULL then there is
445 * additional work required to complete the request.
447 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_complete
,
449 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
454 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
456 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
457 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
459 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
464 ctf_integer(dev_t
, dev
,
465 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
466 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
467 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
468 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
469 ctf_integer(pid_t
, tid
, current
->pid
)
470 blk_rwbs_ctf_integer(unsigned int, rwbs
,
471 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
472 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
475 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
476 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
478 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
484 unsigned int nr_sector
;
491 if (blk_rq_is_scsi(rq
)) {
492 struct scsi_request
*scsi_rq
= scsi_req(rq
);
493 tp_locvar
->sector
= 0;
494 tp_locvar
->nr_sector
= 0;
495 tp_locvar
->bytes
= scsi_rq
->resid_len
;
496 tp_locvar
->cmd
= scsi_rq
->cmd
;
497 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
499 tp_locvar
->sector
= blk_rq_pos(rq
);
500 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
501 tp_locvar
->bytes
= 0;
502 tp_locvar
->cmd
= NULL
;
503 tp_locvar
->cmd_len
= 0;
508 ctf_integer(dev_t
, dev
,
509 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
510 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
511 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
512 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
513 ctf_integer(pid_t
, tid
, current
->pid
)
514 blk_rwbs_ctf_integer(unsigned int, rwbs
,
515 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
516 ctf_sequence_hex(unsigned char, cmd
,
517 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
518 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
523 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
524 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
526 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
532 unsigned int nr_sector
;
539 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
540 tp_locvar
->sector
= 0;
541 tp_locvar
->nr_sector
= 0;
542 tp_locvar
->bytes
= blk_rq_bytes(rq
);
543 tp_locvar
->cmd
= rq
->cmd
;
544 tp_locvar
->cmd_len
= rq
->cmd_len
;
546 tp_locvar
->sector
= blk_rq_pos(rq
);
547 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
548 tp_locvar
->bytes
= 0;
549 tp_locvar
->cmd
= NULL
;
550 tp_locvar
->cmd_len
= 0;
555 ctf_integer(dev_t
, dev
,
556 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
557 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
558 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
559 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
560 ctf_integer(pid_t
, tid
, current
->pid
)
561 blk_rwbs_ctf_integer(unsigned int, rwbs
,
562 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
563 ctf_sequence_hex(unsigned char, cmd
,
564 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
565 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
570 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
573 * block_rq_insert - insert block operation request into queue
575 * @rq: block IO operation request
577 * Called immediately before block operation request @rq is inserted
578 * into queue @q. The fields in the operation request @rq struct can
579 * be examined to determine which device and sectors the pending
580 * operation would access.
582 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
584 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
590 * block_rq_issue - issue pending block IO request operation to device driver
591 * @q: queue holding operation
592 * @rq: block IO operation operation request
594 * Called when block operation request @rq from queue @q is sent to a
595 * device driver for processing.
597 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
599 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
605 * block_bio_bounce - used bounce buffer when processing block operation
606 * @q: queue holding the block operation
607 * @bio: block operation
609 * A bounce buffer was used to handle the block operation @bio in @q.
610 * This occurs when hardware limitations prevent a direct transfer of
611 * data between the @bio data memory area and the IO device. Use of a
612 * bounce buffer requires extra copying of data and decreases
615 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
617 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
622 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
623 ctf_integer(dev_t
, dev
, bio_dev(bio
))
625 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
627 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
628 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
629 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
630 blk_rwbs_ctf_integer(unsigned int, rwbs
,
631 lttng_bio_op(bio
), lttng_bio_rw(bio
),
632 bio
->bi_iter
.bi_size
)
633 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
634 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
635 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
636 blk_rwbs_ctf_integer(unsigned int, rwbs
,
637 lttng_bio_op(bio
), lttng_bio_rw(bio
),
639 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
640 ctf_integer(pid_t
, tid
, current
->pid
)
641 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
646 * block_bio_complete - completed all work on the block operation
647 * @q: queue holding the block operation
648 * @bio: block operation completed
649 * @error: io error value
651 * This tracepoint indicates there is no further work to do on this
652 * block IO operation @bio.
654 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
656 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
657 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
659 TP_ARGS(q
, bio
, error
),
661 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
667 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
668 ctf_integer(dev_t
, dev
, bio_dev(bio
))
670 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
672 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
673 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
674 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
675 ctf_integer(int, error
, error
)
676 blk_rwbs_ctf_integer(unsigned int, rwbs
,
677 lttng_bio_op(bio
), lttng_bio_rw(bio
),
678 bio
->bi_iter
.bi_size
)
679 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
680 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
681 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
682 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
683 ctf_integer(int, error
, error
)
685 ctf_integer(int, error
, 0)
687 blk_rwbs_ctf_integer(unsigned int, rwbs
,
688 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
689 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
693 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
694 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
696 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
701 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
702 ctf_integer(dev_t
, dev
, bio_dev(bio
))
704 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
706 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
707 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
708 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
709 blk_rwbs_ctf_integer(unsigned int, rwbs
,
710 lttng_bio_op(bio
), lttng_bio_rw(bio
),
711 bio
->bi_iter
.bi_size
)
712 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
713 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
714 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
715 blk_rwbs_ctf_integer(unsigned int, rwbs
,
716 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
717 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
718 ctf_integer(pid_t
, tid
, current
->pid
)
719 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
724 * block_bio_backmerge - merging block operation to the end of an existing operation
725 * @q: queue holding operation
726 * @bio: new block operation to merge
728 * Merging block request @bio to the end of an existing block request
731 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_backmerge
,
733 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
739 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
740 * @q: queue holding operation
741 * @bio: new block operation to merge
743 * Merging block IO operation @bio to the beginning of an existing block
744 * operation in queue @q.
746 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_frontmerge
,
748 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
754 * block_bio_queue - putting new block IO operation in queue
755 * @q: queue holding operation
756 * @bio: new block operation
758 * About to place the block IO operation @bio into queue @q.
760 LTTNG_TRACEPOINT_EVENT(block_bio_queue
,
762 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
767 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
768 ctf_integer(dev_t
, dev
, bio_dev(bio
))
770 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
772 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
773 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
774 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
775 blk_rwbs_ctf_integer(unsigned int, rwbs
,
776 lttng_bio_op(bio
), lttng_bio_rw(bio
),
777 bio
->bi_iter
.bi_size
)
778 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
779 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
780 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
781 blk_rwbs_ctf_integer(unsigned int, rwbs
,
782 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
783 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
784 ctf_integer(pid_t
, tid
, current
->pid
)
785 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
788 #else /* if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
789 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
791 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
796 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
797 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
798 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
799 blk_rwbs_ctf_integer(unsigned int, rwbs
,
800 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
801 ctf_integer(pid_t
, tid
, current
->pid
)
802 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
807 * block_bio_backmerge - merging block operation to the end of an existing operation
808 * @q: queue holding operation
809 * @bio: new block operation to merge
811 * Merging block request @bio to the end of an existing block request
814 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
816 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
822 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
823 * @q: queue holding operation
824 * @bio: new block operation to merge
826 * Merging block IO operation @bio to the beginning of an existing block
827 * operation in queue @q.
829 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
831 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
837 * block_bio_queue - putting new block IO operation in queue
838 * @q: queue holding operation
839 * @bio: new block operation
841 * About to place the block IO operation @bio into queue @q.
843 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
845 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
849 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
851 LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq
,
853 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
858 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
859 ctf_integer(dev_t
, dev
, bio
? bio_dev(bio
) : 0)
861 ctf_integer(dev_t
, dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
863 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
864 ctf_integer(sector_t
, sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
865 ctf_integer(unsigned int, nr_sector
,
866 bio
? bio_sectors(bio
) : 0)
867 blk_rwbs_ctf_integer(unsigned int, rwbs
,
868 bio
? lttng_bio_op(bio
) : 0,
869 bio
? lttng_bio_rw(bio
) : 0,
870 bio
? bio
->bi_iter
.bi_size
: 0)
871 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
872 ctf_integer(sector_t
, sector
, bio
? bio
->bi_sector
: 0)
873 ctf_integer(unsigned int, nr_sector
,
874 bio
? bio
->bi_size
>> 9 : 0)
875 blk_rwbs_ctf_integer(unsigned int, rwbs
,
876 bio
? lttng_bio_op(bio
) : 0,
877 bio
? lttng_bio_rw(bio
) : 0,
878 bio
? bio
->bi_size
: 0)
879 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
880 ctf_integer(pid_t
, tid
, current
->pid
)
881 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
886 * block_getrq - get a free request entry in queue for block IO operations
887 * @q: queue for operations
888 * @bio: pending block IO operation (can be %NULL)
889 * @rw: low bit indicates a read (%0) or a write (%1)
891 * A request struct for queue @q has been allocated to handle the
892 * block IO operation @bio.
894 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_getrq
,
896 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
902 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
903 * @q: queue for operation
904 * @bio: pending block IO operation (can be %NULL)
905 * @rw: low bit indicates a read (%0) or a write (%1)
907 * In the case where a request struct cannot be provided for queue @q
908 * the process needs to wait for an request struct to become
909 * available. This tracepoint event is generated each time the
910 * process goes to sleep waiting for request struct become available.
912 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_sleeprq
,
914 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
920 * block_plug - keep operations requests in request queue
921 * @q: request queue to plug
923 * Plug the request queue @q. Do not allow block operation requests
924 * to be sent to the device driver. Instead, accumulate requests in
925 * the queue to improve throughput performance of the block device.
927 LTTNG_TRACEPOINT_EVENT(block_plug
,
929 TP_PROTO(struct request_queue
*q
),
934 ctf_integer(pid_t
, tid
, current
->pid
)
935 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
939 LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug
,
941 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
942 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
944 TP_ARGS(q
, depth
, explicit),
946 TP_PROTO(struct request_queue
*q
),
952 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
953 ctf_integer(int, nr_rq
, depth
)
955 ctf_integer(int, nr_rq
, q
->rq
.count
[READ
] + q
->rq
.count
[WRITE
])
957 ctf_integer(pid_t
, tid
, current
->pid
)
958 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
962 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
964 * block_unplug_timer - timed release of operations requests in queue to device driver
965 * @q: request queue to unplug
967 * Unplug the request queue @q because a timer expired and allow block
968 * operation requests to be sent to the device driver.
970 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_timer
,
972 TP_PROTO(struct request_queue
*q
),
979 * block_unplug - release of operations requests in request queue
980 * @q: request queue to unplug
981 * @depth: number of requests just added to the queue
982 * @explicit: whether this was an explicit unplug, or one from schedule()
984 * Unplug request queue @q because device driver is scheduled to work
985 * on elements in the request queue.
987 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
988 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug
,
990 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_io
,
993 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
994 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
996 TP_ARGS(q
, depth
, explicit)
998 TP_PROTO(struct request_queue
*q
),
1005 * block_split - split a single bio struct into two bio structs
1006 * @q: queue containing the bio
1007 * @bio: block operation being split
1008 * @new_sector: The starting sector for the new bio
1010 * The bio request @bio in request queue @q needs to be split into two
1011 * bio requests. The newly created @bio request starts at
1012 * @new_sector. This split may be required due to hardware limitation
1013 * such as operation crossing device boundaries in a RAID system.
1015 LTTNG_TRACEPOINT_EVENT(block_split
,
1017 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1018 unsigned int new_sector
),
1020 TP_ARGS(q
, bio
, new_sector
),
1023 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
1024 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1026 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1028 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
1029 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1030 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1031 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1032 bio
->bi_iter
.bi_size
)
1033 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1034 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1035 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1036 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1037 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1038 ctf_integer(sector_t
, new_sector
, new_sector
)
1039 ctf_integer(pid_t
, tid
, current
->pid
)
1040 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1045 * block_bio_remap - map request for a logical device to the raw device
1046 * @q: queue holding the operation
1047 * @bio: revised operation
1048 * @dev: device for the operation
1049 * @from: original sector for the operation
1051 * An operation for a logical device has been mapped to the
1054 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
1055 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1057 LTTNG_TRACEPOINT_EVENT(block_remap
,
1060 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1063 TP_ARGS(q
, bio
, dev
, from
),
1066 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
1067 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1069 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1071 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
1072 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1073 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1074 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1075 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1076 bio
->bi_iter
.bi_size
)
1077 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1078 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1079 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1080 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1081 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1082 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1083 ctf_integer(dev_t
, old_dev
, dev
)
1084 ctf_integer(sector_t
, old_sector
, from
)
1088 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
1090 * block_rq_remap - map request for a block operation request
1091 * @q: queue holding the operation
1092 * @rq: block IO operation request
1093 * @dev: device for the operation
1094 * @from: original sector for the operation
1096 * The block operation request @rq in @q has been remapped. The block
1097 * operation request @rq holds the current information and @from hold
1098 * the original sector.
1100 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1102 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
1105 TP_ARGS(q
, rq
, dev
, from
),
1108 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1109 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1110 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1111 ctf_integer(dev_t
, old_dev
, dev
)
1112 ctf_integer(sector_t
, old_sector
, from
)
1113 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1114 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1119 #undef __print_rwbs_flags
1120 #undef blk_fill_rwbs
1122 #endif /* LTTNG_TRACE_BLOCK_H */
1124 /* This part must be outside protection */
1125 #include <probes/define_trace.h>
This page took 0.129558 seconds and 4 git commands to generate.