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))
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))
103 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
104 LTTNG_TRACEPOINT_EVENT_CLASS(block_buffer
,
106 TP_PROTO(struct buffer_head
*bh
),
111 ctf_integer(dev_t
, dev
, bh
->b_bdev
->bd_dev
)
112 ctf_integer(sector_t
, sector
, bh
->b_blocknr
)
113 ctf_integer(size_t, size
, bh
->b_size
)
118 * block_touch_buffer - mark a buffer accessed
119 * @bh: buffer_head being touched
121 * Called from touch_buffer().
123 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_touch_buffer
,
125 TP_PROTO(struct buffer_head
*bh
),
131 * block_dirty_buffer - mark a buffer dirty
132 * @bh: buffer_head being dirtied
134 * Called from mark_buffer_dirty().
136 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_dirty_buffer
,
138 TP_PROTO(struct buffer_head
*bh
),
144 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
145 /* block_rq_with_error event class removed in kernel 4.12 */
146 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
147 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
149 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
155 unsigned int nr_sector
;
161 if (blk_rq_is_scsi(rq
)) {
162 struct scsi_request
*scsi_rq
= scsi_req(rq
);
163 tp_locvar
->sector
= 0;
164 tp_locvar
->nr_sector
= 0;
165 tp_locvar
->cmd
= scsi_rq
->cmd
;
166 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
168 tp_locvar
->sector
= blk_rq_pos(rq
);
169 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
170 tp_locvar
->cmd
= NULL
;
171 tp_locvar
->cmd_len
= 0;
176 ctf_integer(dev_t
, dev
,
177 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
178 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
179 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
180 ctf_integer(int, errors
, rq
->errors
)
181 blk_rwbs_ctf_integer(unsigned int, rwbs
,
182 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
183 ctf_sequence_hex(unsigned char, cmd
,
184 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
189 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
190 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
192 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
198 unsigned int nr_sector
;
205 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
206 tp_locvar
->sector
= 0;
207 tp_locvar
->nr_sector
= 0;
208 tp_locvar
->cmd
= rq
->cmd
;
209 tp_locvar
->cmd_len
= rq
->cmd_len
;
211 tp_locvar
->sector
= blk_rq_pos(rq
);
212 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
213 tp_locvar
->cmd
= NULL
;
214 tp_locvar
->cmd_len
= 0;
219 ctf_integer(dev_t
, dev
,
220 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
221 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
222 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
223 ctf_integer(int, errors
, rq
->errors
)
224 blk_rwbs_ctf_integer(unsigned int, rwbs
,
225 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
226 ctf_sequence_hex(unsigned char, cmd
,
227 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
232 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
234 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0))
236 * block_rq_abort - abort block operation request
237 * @q: queue containing the block operation request
238 * @rq: block IO operation request
240 * Called immediately after pending block IO operation request @rq in
241 * queue @q is aborted. The fields in the operation request @rq
242 * can be examined to determine which device and sectors the pending
243 * operation would access.
245 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_abort
,
247 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
254 * block_rq_requeue - place block IO request back on a queue
255 * @q: queue holding operation
256 * @rq: block IO operation request
258 * The block operation request @rq is being placed back into queue
259 * @q. For some reason the request was not completed and needs to be
260 * put back in the queue.
262 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
263 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
265 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
270 ctf_integer(dev_t
, dev
,
271 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
272 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
273 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
274 blk_rwbs_ctf_integer(unsigned int, rwbs
,
275 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
279 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_requeue
,
281 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
288 * block_rq_complete - block IO operation completed by device driver
289 * @q: queue containing the block operation request
290 * @rq: block operations request
291 * @nr_bytes: number of completed bytes
293 * The block_rq_complete tracepoint event indicates that some portion
294 * of operation request has been completed by the device driver. If
295 * the @rq->bio is %NULL, then there is absolutely no additional work to
296 * do for the request. If @rq->bio is non-NULL then there is
297 * additional work required to complete the request.
299 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
300 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
302 TP_PROTO(struct request
*rq
, int error
, unsigned int nr_bytes
),
304 TP_ARGS(rq
, error
, nr_bytes
),
307 ctf_integer(dev_t
, dev
,
308 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
309 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
310 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
311 ctf_integer(int, error
, error
)
312 blk_rwbs_ctf_integer(unsigned int, rwbs
,
313 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
316 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
317 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
319 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
320 unsigned int nr_bytes
),
322 TP_ARGS(q
, rq
, nr_bytes
),
330 if (blk_rq_is_scsi(rq
)) {
331 struct scsi_request
*scsi_rq
= scsi_req(rq
);
332 tp_locvar
->cmd
= scsi_rq
->cmd
;
333 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
335 tp_locvar
->cmd
= NULL
;
336 tp_locvar
->cmd_len
= 0;
341 ctf_integer(dev_t
, dev
,
342 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
343 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
344 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
345 ctf_integer(int, errors
, rq
->errors
)
346 blk_rwbs_ctf_integer(unsigned int, rwbs
,
347 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
348 ctf_sequence_hex(unsigned char, cmd
,
349 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
354 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,5) \
355 || LTTNG_KERNEL_RANGE(3,12,21, 3,13,0) \
356 || LTTNG_KERNEL_RANGE(3,10,41, 3,11,0) \
357 || LTTNG_KERNEL_RANGE(3,4,91, 3,5,0) \
358 || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0) \
359 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,28, 3,14,0,0) \
360 || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0))
362 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
364 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
365 unsigned int nr_bytes
),
367 TP_ARGS(q
, rq
, nr_bytes
),
375 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
376 tp_locvar
->cmd
= rq
->cmd
;
377 tp_locvar
->cmd_len
= rq
->cmd_len
;
379 tp_locvar
->cmd
= NULL
;
380 tp_locvar
->cmd_len
= 0;
385 ctf_integer(dev_t
, dev
,
386 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
387 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
388 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
389 ctf_integer(int, errors
, rq
->errors
)
390 blk_rwbs_ctf_integer(unsigned int, rwbs
,
391 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
392 ctf_sequence_hex(unsigned char, cmd
,
393 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
399 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
402 * block_rq_complete - block IO operation completed by device driver
403 * @q: queue containing the block operation request
404 * @rq: block operations request
406 * The block_rq_complete tracepoint event indicates that some portion
407 * of operation request has been completed by the device driver. If
408 * the @rq->bio is %NULL, then there is absolutely no additional work to
409 * do for the request. If @rq->bio is non-NULL then there is
410 * additional work required to complete the request.
412 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_complete
,
414 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
419 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
421 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
422 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
424 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
429 ctf_integer(dev_t
, dev
,
430 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
431 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
432 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
433 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
434 ctf_integer(pid_t
, tid
, current
->pid
)
435 blk_rwbs_ctf_integer(unsigned int, rwbs
,
436 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
437 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
440 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
441 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
443 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
449 unsigned int nr_sector
;
456 if (blk_rq_is_scsi(rq
)) {
457 struct scsi_request
*scsi_rq
= scsi_req(rq
);
458 tp_locvar
->sector
= 0;
459 tp_locvar
->nr_sector
= 0;
460 tp_locvar
->bytes
= scsi_rq
->resid_len
;
461 tp_locvar
->cmd
= scsi_rq
->cmd
;
462 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
464 tp_locvar
->sector
= blk_rq_pos(rq
);
465 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
466 tp_locvar
->bytes
= 0;
467 tp_locvar
->cmd
= NULL
;
468 tp_locvar
->cmd_len
= 0;
473 ctf_integer(dev_t
, dev
,
474 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
475 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
476 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
477 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
478 ctf_integer(pid_t
, tid
, current
->pid
)
479 blk_rwbs_ctf_integer(unsigned int, rwbs
,
480 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
481 ctf_sequence_hex(unsigned char, cmd
,
482 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
483 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
488 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
489 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
491 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
497 unsigned int nr_sector
;
504 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
505 tp_locvar
->sector
= 0;
506 tp_locvar
->nr_sector
= 0;
507 tp_locvar
->bytes
= blk_rq_bytes(rq
);
508 tp_locvar
->cmd
= rq
->cmd
;
509 tp_locvar
->cmd_len
= rq
->cmd_len
;
511 tp_locvar
->sector
= blk_rq_pos(rq
);
512 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
513 tp_locvar
->bytes
= 0;
514 tp_locvar
->cmd
= NULL
;
515 tp_locvar
->cmd_len
= 0;
520 ctf_integer(dev_t
, dev
,
521 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
522 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
523 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
524 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
525 ctf_integer(pid_t
, tid
, current
->pid
)
526 blk_rwbs_ctf_integer(unsigned int, rwbs
,
527 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
528 ctf_sequence_hex(unsigned char, cmd
,
529 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
530 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
535 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
538 * block_rq_insert - insert block operation request into queue
540 * @rq: block IO operation request
542 * Called immediately before block operation request @rq is inserted
543 * into queue @q. The fields in the operation request @rq struct can
544 * be examined to determine which device and sectors the pending
545 * operation would access.
547 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
549 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
555 * block_rq_issue - issue pending block IO request operation to device driver
556 * @q: queue holding operation
557 * @rq: block IO operation operation request
559 * Called when block operation request @rq from queue @q is sent to a
560 * device driver for processing.
562 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
564 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
570 * block_bio_bounce - used bounce buffer when processing block operation
571 * @q: queue holding the block operation
572 * @bio: block operation
574 * A bounce buffer was used to handle the block operation @bio in @q.
575 * This occurs when hardware limitations prevent a direct transfer of
576 * data between the @bio data memory area and the IO device. Use of a
577 * bounce buffer requires extra copying of data and decreases
580 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
582 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
587 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
588 ctf_integer(dev_t
, dev
, bio_dev(bio
))
590 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
592 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
593 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
594 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
595 blk_rwbs_ctf_integer(unsigned int, rwbs
,
596 lttng_bio_op(bio
), lttng_bio_rw(bio
),
597 bio
->bi_iter
.bi_size
)
598 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
599 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
600 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
601 blk_rwbs_ctf_integer(unsigned int, rwbs
,
602 lttng_bio_op(bio
), lttng_bio_rw(bio
),
604 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
605 ctf_integer(pid_t
, tid
, current
->pid
)
606 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
611 * block_bio_complete - completed all work on the block operation
612 * @q: queue holding the block operation
613 * @bio: block operation completed
614 * @error: io error value
616 * This tracepoint indicates there is no further work to do on this
617 * block IO operation @bio.
619 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
621 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
623 TP_ARGS(q
, bio
, error
),
626 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
627 ctf_integer(dev_t
, dev
, bio_dev(bio
))
629 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
631 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
632 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
633 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
634 ctf_integer(int, error
, error
)
635 blk_rwbs_ctf_integer(unsigned int, rwbs
,
636 lttng_bio_op(bio
), lttng_bio_rw(bio
),
637 bio
->bi_iter
.bi_size
)
638 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
639 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
640 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
641 ctf_integer(int, error
, error
)
642 blk_rwbs_ctf_integer(unsigned int, rwbs
,
643 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
644 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
648 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
649 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
651 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
656 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
657 ctf_integer(dev_t
, dev
, bio_dev(bio
))
659 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
661 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
662 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
663 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
664 blk_rwbs_ctf_integer(unsigned int, rwbs
,
665 lttng_bio_op(bio
), lttng_bio_rw(bio
),
666 bio
->bi_iter
.bi_size
)
667 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
668 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
669 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
670 blk_rwbs_ctf_integer(unsigned int, rwbs
,
671 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
672 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
673 ctf_integer(pid_t
, tid
, current
->pid
)
674 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
679 * block_bio_backmerge - merging block operation to the end of an existing operation
680 * @q: queue holding operation
681 * @bio: new block operation to merge
683 * Merging block request @bio to the end of an existing block request
686 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_backmerge
,
688 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
694 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
695 * @q: queue holding operation
696 * @bio: new block operation to merge
698 * Merging block IO operation @bio to the beginning of an existing block
699 * operation in queue @q.
701 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_frontmerge
,
703 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
709 * block_bio_queue - putting new block IO operation in queue
710 * @q: queue holding operation
711 * @bio: new block operation
713 * About to place the block IO operation @bio into queue @q.
715 LTTNG_TRACEPOINT_EVENT(block_bio_queue
,
717 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
722 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
723 ctf_integer(dev_t
, dev
, bio_dev(bio
))
725 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
727 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
728 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
729 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
730 blk_rwbs_ctf_integer(unsigned int, rwbs
,
731 lttng_bio_op(bio
), lttng_bio_rw(bio
),
732 bio
->bi_iter
.bi_size
)
733 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
734 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
735 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
736 blk_rwbs_ctf_integer(unsigned int, rwbs
,
737 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
738 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
739 ctf_integer(pid_t
, tid
, current
->pid
)
740 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
743 #else /* if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
744 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
746 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
751 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 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 ctf_integer(pid_t
, tid
, current
->pid
)
757 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
762 * block_bio_backmerge - merging block operation to the end of an existing operation
763 * @q: queue holding operation
764 * @bio: new block operation to merge
766 * Merging block request @bio to the end of an existing block request
769 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
771 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
777 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
778 * @q: queue holding operation
779 * @bio: new block operation to merge
781 * Merging block IO operation @bio to the beginning of an existing block
782 * operation in queue @q.
784 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
786 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
792 * block_bio_queue - putting new block IO operation in queue
793 * @q: queue holding operation
794 * @bio: new block operation
796 * About to place the block IO operation @bio into queue @q.
798 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
800 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
804 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
806 LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq
,
808 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
813 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
814 ctf_integer(dev_t
, dev
, bio
? bio_dev(bio
) : 0)
816 ctf_integer(dev_t
, dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
818 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
819 ctf_integer(sector_t
, sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
820 ctf_integer(unsigned int, nr_sector
,
821 bio
? bio_sectors(bio
) : 0)
822 blk_rwbs_ctf_integer(unsigned int, rwbs
,
823 bio
? lttng_bio_op(bio
) : 0,
824 bio
? lttng_bio_rw(bio
) : 0,
825 bio
? bio
->bi_iter
.bi_size
: 0)
826 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
827 ctf_integer(sector_t
, sector
, bio
? bio
->bi_sector
: 0)
828 ctf_integer(unsigned int, nr_sector
,
829 bio
? bio
->bi_size
>> 9 : 0)
830 blk_rwbs_ctf_integer(unsigned int, rwbs
,
831 bio
? lttng_bio_op(bio
) : 0,
832 bio
? lttng_bio_rw(bio
) : 0,
833 bio
? bio
->bi_size
: 0)
834 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
835 ctf_integer(pid_t
, tid
, current
->pid
)
836 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
841 * block_getrq - get a free request entry in queue for block IO operations
842 * @q: queue for operations
843 * @bio: pending block IO operation (can be %NULL)
844 * @rw: low bit indicates a read (%0) or a write (%1)
846 * A request struct for queue @q has been allocated to handle the
847 * block IO operation @bio.
849 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_getrq
,
851 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
857 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
858 * @q: queue for operation
859 * @bio: pending block IO operation (can be %NULL)
860 * @rw: low bit indicates a read (%0) or a write (%1)
862 * In the case where a request struct cannot be provided for queue @q
863 * the process needs to wait for an request struct to become
864 * available. This tracepoint event is generated each time the
865 * process goes to sleep waiting for request struct become available.
867 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_sleeprq
,
869 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
875 * block_plug - keep operations requests in request queue
876 * @q: request queue to plug
878 * Plug the request queue @q. Do not allow block operation requests
879 * to be sent to the device driver. Instead, accumulate requests in
880 * the queue to improve throughput performance of the block device.
882 LTTNG_TRACEPOINT_EVENT(block_plug
,
884 TP_PROTO(struct request_queue
*q
),
889 ctf_integer(pid_t
, tid
, current
->pid
)
890 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
894 LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug
,
896 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
898 TP_ARGS(q
, depth
, explicit),
901 ctf_integer(int, nr_rq
, depth
)
902 ctf_integer(pid_t
, tid
, current
->pid
)
903 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
908 * block_unplug - release of operations requests in request queue
909 * @q: request queue to unplug
910 * @depth: number of requests just added to the queue
911 * @explicit: whether this was an explicit unplug, or one from schedule()
913 * Unplug request queue @q because device driver is scheduled to work
914 * on elements in the request queue.
916 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug
,
918 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
920 TP_ARGS(q
, depth
, explicit)
924 * block_split - split a single bio struct into two bio structs
925 * @q: queue containing the bio
926 * @bio: block operation being split
927 * @new_sector: The starting sector for the new bio
929 * The bio request @bio in request queue @q needs to be split into two
930 * bio requests. The newly created @bio request starts at
931 * @new_sector. This split may be required due to hardware limitation
932 * such as operation crossing device boundaries in a RAID system.
934 LTTNG_TRACEPOINT_EVENT(block_split
,
936 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
937 unsigned int new_sector
),
939 TP_ARGS(q
, bio
, new_sector
),
942 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
943 ctf_integer(dev_t
, dev
, bio_dev(bio
))
945 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
947 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
948 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
949 blk_rwbs_ctf_integer(unsigned int, rwbs
,
950 lttng_bio_op(bio
), lttng_bio_rw(bio
),
951 bio
->bi_iter
.bi_size
)
952 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
953 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
954 blk_rwbs_ctf_integer(unsigned int, rwbs
,
955 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
956 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
957 ctf_integer(sector_t
, new_sector
, new_sector
)
958 ctf_integer(pid_t
, tid
, current
->pid
)
959 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
964 * block_bio_remap - map request for a logical device to the raw device
965 * @q: queue holding the operation
966 * @bio: revised operation
967 * @dev: device for the operation
968 * @from: original sector for the operation
970 * An operation for a logical device has been mapped to the
973 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
975 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
978 TP_ARGS(q
, bio
, dev
, from
),
981 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
982 ctf_integer(dev_t
, dev
, bio_dev(bio
))
984 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
986 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
987 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
988 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
989 blk_rwbs_ctf_integer(unsigned int, rwbs
,
990 lttng_bio_op(bio
), lttng_bio_rw(bio
),
991 bio
->bi_iter
.bi_size
)
992 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
993 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
994 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
995 blk_rwbs_ctf_integer(unsigned int, rwbs
,
996 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
997 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
998 ctf_integer(dev_t
, old_dev
, dev
)
999 ctf_integer(sector_t
, old_sector
, from
)
1004 * block_rq_remap - map request for a block operation request
1005 * @q: queue holding the operation
1006 * @rq: block IO operation request
1007 * @dev: device for the operation
1008 * @from: original sector for the operation
1010 * The block operation request @rq in @q has been remapped. The block
1011 * operation request @rq holds the current information and @from hold
1012 * the original sector.
1014 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1016 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
1019 TP_ARGS(q
, rq
, dev
, from
),
1022 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1023 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1024 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1025 ctf_integer(dev_t
, old_dev
, dev
)
1026 ctf_integer(sector_t
, old_sector
, from
)
1027 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1028 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1032 #undef __print_rwbs_flags
1033 #undef blk_fill_rwbs
1035 #endif /* LTTNG_TRACE_BLOCK_H */
1037 /* This part must be outside protection */
1038 #include <probes/define_trace.h>
This page took 0.050646 seconds and 4 git commands to generate.