2 #define TRACE_SYSTEM block
4 #if !defined(LTTNG_TRACE_BLOCK_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define LTTNG_TRACE_BLOCK_H
7 #include <probes/lttng-tracepoint-event.h>
8 #include <linux/blktrace_api.h>
9 #include <linux/blkdev.h>
10 #include <linux/trace_seq.h>
11 #include <linux/version.h>
13 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
14 #include <scsi/scsi_request.h>
15 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
17 #ifndef _TRACE_BLOCK_DEF_
18 #define _TRACE_BLOCK_DEF_
21 RWBS_FLAG_WRITE
= (1 << 0),
22 RWBS_FLAG_DISCARD
= (1 << 1),
23 RWBS_FLAG_READ
= (1 << 2),
24 RWBS_FLAG_RAHEAD
= (1 << 3),
25 RWBS_FLAG_BARRIER
= (1 << 4),
26 RWBS_FLAG_SYNC
= (1 << 5),
27 RWBS_FLAG_META
= (1 << 6),
28 RWBS_FLAG_SECURE
= (1 << 7),
29 RWBS_FLAG_FLUSH
= (1 << 8),
30 RWBS_FLAG_FUA
= (1 << 9),
31 RWBS_FLAG_PREFLUSH
= (1 << 10),
34 #endif /* _TRACE_BLOCK_DEF_ */
36 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
38 #define lttng_req_op(rq) req_op(rq)
39 #define lttng_req_rw(rq) ((rq)->cmd_flags)
40 #define lttng_bio_op(bio) bio_op(bio)
41 #define lttng_bio_rw(bio) ((bio)->bi_opf)
43 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
44 ctf_integer(type, rwbs, \
45 (((op) == REQ_OP_WRITE || (op) == REQ_OP_WRITE_SAME) ? RWBS_FLAG_WRITE : \
46 ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
47 ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
48 ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
49 ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
51 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
52 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
53 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
54 | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
55 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
57 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
59 #define lttng_req_op(rq)
60 #define lttng_req_rw(rq) ((rq)->cmd_flags)
61 #define lttng_bio_op(bio)
62 #define lttng_bio_rw(bio) ((bio)->bi_rw)
64 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
65 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
66 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
67 ( (bytes) ? RWBS_FLAG_READ : \
69 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
70 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
71 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
72 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \
73 | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \
74 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
76 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
78 #define lttng_req_op(rq)
79 #define lttng_req_rw(rq) ((rq)->cmd_flags)
80 #define lttng_bio_op(bio)
81 #define lttng_bio_rw(bio) ((bio)->bi_rw)
83 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
84 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
85 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
86 ( (bytes) ? RWBS_FLAG_READ : \
88 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
89 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
90 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
91 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
93 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
95 #define lttng_req_op(rq)
96 #define lttng_req_rw(rq) ((rq)->cmd_flags)
97 #define lttng_bio_op(bio)
98 #define lttng_bio_rw(bio) ((bio)->bi_rw)
100 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
101 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
102 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
103 ( (bytes) ? RWBS_FLAG_READ : \
105 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
106 | ((rw) & REQ_HARDBARRIER ? RWBS_FLAG_BARRIER : 0) \
107 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
108 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
109 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
113 #define lttng_req_op(rq)
114 #define lttng_req_rw(rq) ((rq)->cmd_flags)
115 #define lttng_bio_op(bio)
116 #define lttng_bio_rw(bio) ((bio)->bi_rw)
118 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
119 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
120 ( (rw) & (1 << BIO_RW_DISCARD) ? RWBS_FLAG_DISCARD : \
121 ( (bytes) ? RWBS_FLAG_READ : \
123 | ((rw) & (1 << BIO_RW_AHEAD) ? RWBS_FLAG_RAHEAD : 0) \
124 | ((rw) & (1 << BIO_RW_SYNCIO) ? RWBS_FLAG_SYNC : 0) \
125 | ((rw) & (1 << BIO_RW_META) ? RWBS_FLAG_META : 0) \
126 | ((rw) & (1 << BIO_RW_BARRIER) ? RWBS_FLAG_BARRIER : 0))
130 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
131 LTTNG_TRACEPOINT_EVENT_CLASS(block_buffer
,
133 TP_PROTO(struct buffer_head
*bh
),
138 ctf_integer(dev_t
, dev
, bh
->b_bdev
->bd_dev
)
139 ctf_integer(sector_t
, sector
, bh
->b_blocknr
)
140 ctf_integer(size_t, size
, bh
->b_size
)
145 * block_touch_buffer - mark a buffer accessed
146 * @bh: buffer_head being touched
148 * Called from touch_buffer().
150 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_touch_buffer
,
152 TP_PROTO(struct buffer_head
*bh
),
158 * block_dirty_buffer - mark a buffer dirty
159 * @bh: buffer_head being dirtied
161 * Called from mark_buffer_dirty().
163 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_dirty_buffer
,
165 TP_PROTO(struct buffer_head
*bh
),
171 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
172 /* block_rq_with_error event class removed in kernel 4.12 */
173 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
174 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
176 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
182 unsigned int nr_sector
;
188 if (blk_rq_is_scsi(rq
)) {
189 struct scsi_request
*scsi_rq
= scsi_req(rq
);
190 tp_locvar
->sector
= 0;
191 tp_locvar
->nr_sector
= 0;
192 tp_locvar
->cmd
= scsi_rq
->cmd
;
193 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
195 tp_locvar
->sector
= blk_rq_pos(rq
);
196 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
197 tp_locvar
->cmd
= NULL
;
198 tp_locvar
->cmd_len
= 0;
203 ctf_integer(dev_t
, dev
,
204 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
205 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
206 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
207 ctf_integer(int, errors
, rq
->errors
)
208 blk_rwbs_ctf_integer(unsigned int, rwbs
,
209 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
210 ctf_sequence_hex(unsigned char, cmd
,
211 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
216 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
217 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
219 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
225 unsigned int nr_sector
;
232 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
233 tp_locvar
->sector
= 0;
234 tp_locvar
->nr_sector
= 0;
235 tp_locvar
->cmd
= rq
->cmd
;
236 tp_locvar
->cmd_len
= rq
->cmd_len
;
238 tp_locvar
->sector
= blk_rq_pos(rq
);
239 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
240 tp_locvar
->cmd
= NULL
;
241 tp_locvar
->cmd_len
= 0;
246 ctf_integer(dev_t
, dev
,
247 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
248 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
249 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
250 ctf_integer(int, errors
, rq
->errors
)
251 blk_rwbs_ctf_integer(unsigned int, rwbs
,
252 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
253 ctf_sequence_hex(unsigned char, cmd
,
254 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
259 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
261 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0))
263 * block_rq_abort - abort block operation request
264 * @q: queue containing the block operation request
265 * @rq: block IO operation request
267 * Called immediately after pending block IO operation request @rq in
268 * queue @q is aborted. The fields in the operation request @rq
269 * can be examined to determine which device and sectors the pending
270 * operation would access.
272 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_abort
,
274 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
281 * block_rq_requeue - place block IO request back on a queue
282 * @q: queue holding operation
283 * @rq: block IO operation request
285 * The block operation request @rq is being placed back into queue
286 * @q. For some reason the request was not completed and needs to be
287 * put back in the queue.
289 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
290 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
292 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
297 ctf_integer(dev_t
, dev
,
298 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
299 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
300 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
301 blk_rwbs_ctf_integer(unsigned int, rwbs
,
302 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
306 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_requeue
,
308 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
315 * block_rq_complete - block IO operation completed by device driver
316 * @q: queue containing the block operation request
317 * @rq: block operations request
318 * @nr_bytes: number of completed bytes
320 * The block_rq_complete tracepoint event indicates that some portion
321 * of operation request has been completed by the device driver. If
322 * the @rq->bio is %NULL, then there is absolutely no additional work to
323 * do for the request. If @rq->bio is non-NULL then there is
324 * additional work required to complete the request.
326 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
327 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
329 TP_PROTO(struct request
*rq
, int error
, unsigned int nr_bytes
),
331 TP_ARGS(rq
, error
, nr_bytes
),
334 ctf_integer(dev_t
, dev
,
335 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
336 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
337 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
338 ctf_integer(int, error
, error
)
339 blk_rwbs_ctf_integer(unsigned int, rwbs
,
340 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
343 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
344 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
346 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
347 unsigned int nr_bytes
),
349 TP_ARGS(q
, rq
, nr_bytes
),
357 if (blk_rq_is_scsi(rq
)) {
358 struct scsi_request
*scsi_rq
= scsi_req(rq
);
359 tp_locvar
->cmd
= scsi_rq
->cmd
;
360 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
362 tp_locvar
->cmd
= NULL
;
363 tp_locvar
->cmd_len
= 0;
368 ctf_integer(dev_t
, dev
,
369 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
370 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
371 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
372 ctf_integer(int, errors
, rq
->errors
)
373 blk_rwbs_ctf_integer(unsigned int, rwbs
,
374 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
375 ctf_sequence_hex(unsigned char, cmd
,
376 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
381 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,5) \
382 || LTTNG_KERNEL_RANGE(3,12,21, 3,13,0) \
383 || LTTNG_KERNEL_RANGE(3,10,41, 3,11,0) \
384 || LTTNG_KERNEL_RANGE(3,4,91, 3,5,0) \
385 || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0) \
386 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,28, 3,14,0,0) \
387 || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0))
389 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
391 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
392 unsigned int nr_bytes
),
394 TP_ARGS(q
, rq
, nr_bytes
),
402 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
403 tp_locvar
->cmd
= rq
->cmd
;
404 tp_locvar
->cmd_len
= rq
->cmd_len
;
406 tp_locvar
->cmd
= NULL
;
407 tp_locvar
->cmd_len
= 0;
412 ctf_integer(dev_t
, dev
,
413 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
414 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
415 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
416 ctf_integer(int, errors
, rq
->errors
)
417 blk_rwbs_ctf_integer(unsigned int, rwbs
,
418 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
419 ctf_sequence_hex(unsigned char, cmd
,
420 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
426 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
429 * block_rq_complete - block IO operation completed by device driver
430 * @q: queue containing the block operation request
431 * @rq: block operations request
433 * The block_rq_complete tracepoint event indicates that some portion
434 * of operation request has been completed by the device driver. If
435 * the @rq->bio is %NULL, then there is absolutely no additional work to
436 * do for the request. If @rq->bio is non-NULL then there is
437 * additional work required to complete the request.
439 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_complete
,
441 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
446 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
448 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
449 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
451 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
456 ctf_integer(dev_t
, dev
,
457 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
458 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
459 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
460 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
461 ctf_integer(pid_t
, tid
, current
->pid
)
462 blk_rwbs_ctf_integer(unsigned int, rwbs
,
463 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
464 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
467 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
468 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
470 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
476 unsigned int nr_sector
;
483 if (blk_rq_is_scsi(rq
)) {
484 struct scsi_request
*scsi_rq
= scsi_req(rq
);
485 tp_locvar
->sector
= 0;
486 tp_locvar
->nr_sector
= 0;
487 tp_locvar
->bytes
= scsi_rq
->resid_len
;
488 tp_locvar
->cmd
= scsi_rq
->cmd
;
489 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
491 tp_locvar
->sector
= blk_rq_pos(rq
);
492 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
493 tp_locvar
->bytes
= 0;
494 tp_locvar
->cmd
= NULL
;
495 tp_locvar
->cmd_len
= 0;
500 ctf_integer(dev_t
, dev
,
501 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
502 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
503 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
504 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
505 ctf_integer(pid_t
, tid
, current
->pid
)
506 blk_rwbs_ctf_integer(unsigned int, rwbs
,
507 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
508 ctf_sequence_hex(unsigned char, cmd
,
509 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
510 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
515 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
516 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
518 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
524 unsigned int nr_sector
;
531 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
532 tp_locvar
->sector
= 0;
533 tp_locvar
->nr_sector
= 0;
534 tp_locvar
->bytes
= blk_rq_bytes(rq
);
535 tp_locvar
->cmd
= rq
->cmd
;
536 tp_locvar
->cmd_len
= rq
->cmd_len
;
538 tp_locvar
->sector
= blk_rq_pos(rq
);
539 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
540 tp_locvar
->bytes
= 0;
541 tp_locvar
->cmd
= NULL
;
542 tp_locvar
->cmd_len
= 0;
547 ctf_integer(dev_t
, dev
,
548 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
549 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
550 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
551 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
552 ctf_integer(pid_t
, tid
, current
->pid
)
553 blk_rwbs_ctf_integer(unsigned int, rwbs
,
554 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
555 ctf_sequence_hex(unsigned char, cmd
,
556 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
557 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
562 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
565 * block_rq_insert - insert block operation request into queue
567 * @rq: block IO operation request
569 * Called immediately before block operation request @rq is inserted
570 * into queue @q. The fields in the operation request @rq struct can
571 * be examined to determine which device and sectors the pending
572 * operation would access.
574 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
576 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
582 * block_rq_issue - issue pending block IO request operation to device driver
583 * @q: queue holding operation
584 * @rq: block IO operation operation request
586 * Called when block operation request @rq from queue @q is sent to a
587 * device driver for processing.
589 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
591 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
597 * block_bio_bounce - used bounce buffer when processing block operation
598 * @q: queue holding the block operation
599 * @bio: block operation
601 * A bounce buffer was used to handle the block operation @bio in @q.
602 * This occurs when hardware limitations prevent a direct transfer of
603 * data between the @bio data memory area and the IO device. Use of a
604 * bounce buffer requires extra copying of data and decreases
607 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
609 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
614 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
615 ctf_integer(dev_t
, dev
, bio_dev(bio
))
617 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
619 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
620 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
621 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
622 blk_rwbs_ctf_integer(unsigned int, rwbs
,
623 lttng_bio_op(bio
), lttng_bio_rw(bio
),
624 bio
->bi_iter
.bi_size
)
625 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
626 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
627 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
628 blk_rwbs_ctf_integer(unsigned int, rwbs
,
629 lttng_bio_op(bio
), lttng_bio_rw(bio
),
631 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
632 ctf_integer(pid_t
, tid
, current
->pid
)
633 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
638 * block_bio_complete - completed all work on the block operation
639 * @q: queue holding the block operation
640 * @bio: block operation completed
641 * @error: io error value
643 * This tracepoint indicates there is no further work to do on this
644 * block IO operation @bio.
646 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
648 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
649 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
651 TP_ARGS(q
, bio
, error
),
653 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
659 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
660 ctf_integer(dev_t
, dev
, bio_dev(bio
))
662 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
664 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
665 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
666 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
667 ctf_integer(int, error
, error
)
668 blk_rwbs_ctf_integer(unsigned int, rwbs
,
669 lttng_bio_op(bio
), lttng_bio_rw(bio
),
670 bio
->bi_iter
.bi_size
)
671 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
672 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
673 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
674 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
675 ctf_integer(int, error
, error
)
677 ctf_integer(int, error
, 0)
679 blk_rwbs_ctf_integer(unsigned int, rwbs
,
680 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
681 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
685 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
686 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
688 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
693 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
694 ctf_integer(dev_t
, dev
, bio_dev(bio
))
696 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
698 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
699 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
700 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
701 blk_rwbs_ctf_integer(unsigned int, rwbs
,
702 lttng_bio_op(bio
), lttng_bio_rw(bio
),
703 bio
->bi_iter
.bi_size
)
704 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
705 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
706 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
707 blk_rwbs_ctf_integer(unsigned int, rwbs
,
708 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
709 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
710 ctf_integer(pid_t
, tid
, current
->pid
)
711 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
716 * block_bio_backmerge - merging block operation to the end of an existing operation
717 * @q: queue holding operation
718 * @bio: new block operation to merge
720 * Merging block request @bio to the end of an existing block request
723 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_backmerge
,
725 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
731 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
732 * @q: queue holding operation
733 * @bio: new block operation to merge
735 * Merging block IO operation @bio to the beginning of an existing block
736 * operation in queue @q.
738 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_frontmerge
,
740 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
746 * block_bio_queue - putting new block IO operation in queue
747 * @q: queue holding operation
748 * @bio: new block operation
750 * About to place the block IO operation @bio into queue @q.
752 LTTNG_TRACEPOINT_EVENT(block_bio_queue
,
754 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
759 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
760 ctf_integer(dev_t
, dev
, bio_dev(bio
))
762 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
764 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
765 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
766 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
767 blk_rwbs_ctf_integer(unsigned int, rwbs
,
768 lttng_bio_op(bio
), lttng_bio_rw(bio
),
769 bio
->bi_iter
.bi_size
)
770 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
771 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
772 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
773 blk_rwbs_ctf_integer(unsigned int, rwbs
,
774 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
775 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
776 ctf_integer(pid_t
, tid
, current
->pid
)
777 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
780 #else /* if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
781 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
783 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
788 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
789 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
790 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
791 blk_rwbs_ctf_integer(unsigned int, rwbs
,
792 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
793 ctf_integer(pid_t
, tid
, current
->pid
)
794 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
799 * block_bio_backmerge - merging block operation to the end of an existing operation
800 * @q: queue holding operation
801 * @bio: new block operation to merge
803 * Merging block request @bio to the end of an existing block request
806 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
808 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
814 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
815 * @q: queue holding operation
816 * @bio: new block operation to merge
818 * Merging block IO operation @bio to the beginning of an existing block
819 * operation in queue @q.
821 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
823 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
829 * block_bio_queue - putting new block IO operation in queue
830 * @q: queue holding operation
831 * @bio: new block operation
833 * About to place the block IO operation @bio into queue @q.
835 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
837 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
841 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
843 LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq
,
845 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
850 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
851 ctf_integer(dev_t
, dev
, bio_dev(bio
))
853 ctf_integer(dev_t
, dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
855 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
856 ctf_integer(sector_t
, sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
857 ctf_integer(unsigned int, nr_sector
,
858 bio
? bio_sectors(bio
) : 0)
859 blk_rwbs_ctf_integer(unsigned int, rwbs
,
860 bio
? lttng_bio_op(bio
) : 0,
861 bio
? lttng_bio_rw(bio
) : 0,
862 bio
? bio
->bi_iter
.bi_size
: 0)
863 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
864 ctf_integer(sector_t
, sector
, bio
? bio
->bi_sector
: 0)
865 ctf_integer(unsigned int, nr_sector
,
866 bio
? bio
->bi_size
>> 9 : 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_size
: 0)
871 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
872 ctf_integer(pid_t
, tid
, current
->pid
)
873 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
878 * block_getrq - get a free request entry in queue for block IO operations
879 * @q: queue for operations
880 * @bio: pending block IO operation
881 * @rw: low bit indicates a read (%0) or a write (%1)
883 * A request struct for queue @q has been allocated to handle the
884 * block IO operation @bio.
886 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_getrq
,
888 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
894 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
895 * @q: queue for operation
896 * @bio: pending block IO operation
897 * @rw: low bit indicates a read (%0) or a write (%1)
899 * In the case where a request struct cannot be provided for queue @q
900 * the process needs to wait for an request struct to become
901 * available. This tracepoint event is generated each time the
902 * process goes to sleep waiting for request struct become available.
904 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_sleeprq
,
906 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
912 * block_plug - keep operations requests in request queue
913 * @q: request queue to plug
915 * Plug the request queue @q. Do not allow block operation requests
916 * to be sent to the device driver. Instead, accumulate requests in
917 * the queue to improve throughput performance of the block device.
919 LTTNG_TRACEPOINT_EVENT(block_plug
,
921 TP_PROTO(struct request_queue
*q
),
926 ctf_integer(pid_t
, tid
, current
->pid
)
927 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
931 LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug
,
933 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
934 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
936 TP_ARGS(q
, depth
, explicit),
938 TP_PROTO(struct request_queue
*q
),
944 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
945 ctf_integer(int, nr_rq
, depth
)
947 ctf_integer(int, nr_rq
, q
->rq
.count
[READ
] + q
->rq
.count
[WRITE
])
949 ctf_integer(pid_t
, tid
, current
->pid
)
950 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
954 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
956 * block_unplug_timer - timed release of operations requests in queue to device driver
957 * @q: request queue to unplug
959 * Unplug the request queue @q because a timer expired and allow block
960 * operation requests to be sent to the device driver.
962 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_timer
,
964 TP_PROTO(struct request_queue
*q
),
971 * block_unplug - release of operations requests in request queue
972 * @q: request queue to unplug
973 * @depth: number of requests just added to the queue
974 * @explicit: whether this was an explicit unplug, or one from schedule()
976 * Unplug request queue @q because device driver is scheduled to work
977 * on elements in the request queue.
979 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
980 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug
,
982 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_io
,
985 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
986 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
988 TP_ARGS(q
, depth
, explicit)
990 TP_PROTO(struct request_queue
*q
),
997 * block_split - split a single bio struct into two bio structs
998 * @q: queue containing the bio
999 * @bio: block operation being split
1000 * @new_sector: The starting sector for the new bio
1002 * The bio request @bio in request queue @q needs to be split into two
1003 * bio requests. The newly created @bio request starts at
1004 * @new_sector. This split may be required due to hardware limitation
1005 * such as operation crossing device boundaries in a RAID system.
1007 LTTNG_TRACEPOINT_EVENT(block_split
,
1009 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1010 unsigned int new_sector
),
1012 TP_ARGS(q
, bio
, new_sector
),
1015 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
1016 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1018 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1020 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
1021 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1022 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1023 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1024 bio
->bi_iter
.bi_size
)
1025 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1026 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1027 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1028 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1029 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1030 ctf_integer(sector_t
, new_sector
, new_sector
)
1031 ctf_integer(pid_t
, tid
, current
->pid
)
1032 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1037 * block_bio_remap - map request for a logical device to the raw device
1038 * @q: queue holding the operation
1039 * @bio: revised operation
1040 * @dev: device for the operation
1041 * @from: original sector for the operation
1043 * An operation for a logical device has been mapped to the
1046 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
1047 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1049 LTTNG_TRACEPOINT_EVENT(block_remap
,
1052 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1055 TP_ARGS(q
, bio
, dev
, from
),
1058 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
1059 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1061 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1063 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
1064 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1065 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1066 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1067 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1068 bio
->bi_iter
.bi_size
)
1069 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1070 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1071 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1072 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1073 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1074 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1075 ctf_integer(dev_t
, old_dev
, dev
)
1076 ctf_integer(sector_t
, old_sector
, from
)
1080 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
1082 * block_rq_remap - map request for a block operation request
1083 * @q: queue holding the operation
1084 * @rq: block IO operation request
1085 * @dev: device for the operation
1086 * @from: original sector for the operation
1088 * The block operation request @rq in @q has been remapped. The block
1089 * operation request @rq holds the current information and @from hold
1090 * the original sector.
1092 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1094 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
1097 TP_ARGS(q
, rq
, dev
, from
),
1100 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1101 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1102 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1103 ctf_integer(dev_t
, old_dev
, dev
)
1104 ctf_integer(sector_t
, old_sector
, from
)
1105 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1106 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1111 #undef __print_rwbs_flags
1112 #undef blk_fill_rwbs
1114 #endif /* LTTNG_TRACE_BLOCK_H */
1116 /* This part must be outside protection */
1117 #include <probes/define_trace.h>
This page took 0.066198 seconds and 4 git commands to generate.