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 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
615 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
616 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
617 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
618 blk_rwbs_ctf_integer(unsigned int, rwbs
,
619 lttng_bio_op(bio
), lttng_bio_rw(bio
),
620 bio
->bi_iter
.bi_size
)
621 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
622 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
623 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
624 blk_rwbs_ctf_integer(unsigned int, rwbs
,
625 lttng_bio_op(bio
), lttng_bio_rw(bio
),
627 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
628 ctf_integer(pid_t
, tid
, current
->pid
)
629 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
634 * block_bio_complete - completed all work on the block operation
635 * @q: queue holding the block operation
636 * @bio: block operation completed
637 * @error: io error value
639 * This tracepoint indicates there is no further work to do on this
640 * block IO operation @bio.
642 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
644 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
645 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
647 TP_ARGS(q
, bio
, error
),
649 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
655 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
656 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
657 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
658 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
659 ctf_integer(int, error
, error
)
660 blk_rwbs_ctf_integer(unsigned int, rwbs
,
661 lttng_bio_op(bio
), lttng_bio_rw(bio
),
662 bio
->bi_iter
.bi_size
)
663 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
664 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
665 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
666 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
667 ctf_integer(int, error
, error
)
669 ctf_integer(int, error
, 0)
671 blk_rwbs_ctf_integer(unsigned int, rwbs
,
672 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
673 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
677 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
678 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
680 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
685 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
686 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
687 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
688 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
689 blk_rwbs_ctf_integer(unsigned int, rwbs
,
690 lttng_bio_op(bio
), lttng_bio_rw(bio
),
691 bio
->bi_iter
.bi_size
)
692 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
693 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
694 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
695 blk_rwbs_ctf_integer(unsigned int, rwbs
,
696 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
697 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
698 ctf_integer(pid_t
, tid
, current
->pid
)
699 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
704 * block_bio_backmerge - merging block operation to the end of an existing operation
705 * @q: queue holding operation
706 * @bio: new block operation to merge
708 * Merging block request @bio to the end of an existing block request
711 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_backmerge
,
713 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
719 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
720 * @q: queue holding operation
721 * @bio: new block operation to merge
723 * Merging block IO operation @bio to the beginning of an existing block
724 * operation in queue @q.
726 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_frontmerge
,
728 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
734 * block_bio_queue - putting new block IO operation in queue
735 * @q: queue holding operation
736 * @bio: new block operation
738 * About to place the block IO operation @bio into queue @q.
740 LTTNG_TRACEPOINT_EVENT(block_bio_queue
,
742 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
747 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
748 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
749 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
750 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
751 blk_rwbs_ctf_integer(unsigned int, rwbs
,
752 lttng_bio_op(bio
), lttng_bio_rw(bio
),
753 bio
->bi_iter
.bi_size
)
754 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
755 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
756 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
757 blk_rwbs_ctf_integer(unsigned int, rwbs
,
758 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
759 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
760 ctf_integer(pid_t
, tid
, current
->pid
)
761 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
764 #else /* if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
765 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
767 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
772 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
773 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
774 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
775 blk_rwbs_ctf_integer(unsigned int, rwbs
,
776 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
777 ctf_integer(pid_t
, tid
, current
->pid
)
778 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
783 * block_bio_backmerge - merging block operation to the end of an existing operation
784 * @q: queue holding operation
785 * @bio: new block operation to merge
787 * Merging block request @bio to the end of an existing block request
790 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
792 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
798 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
799 * @q: queue holding operation
800 * @bio: new block operation to merge
802 * Merging block IO operation @bio to the beginning of an existing block
803 * operation in queue @q.
805 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
807 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
813 * block_bio_queue - putting new block IO operation in queue
814 * @q: queue holding operation
815 * @bio: new block operation
817 * About to place the block IO operation @bio into queue @q.
819 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
821 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
825 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
827 LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq
,
829 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
834 ctf_integer(dev_t
, dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
835 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
836 ctf_integer(sector_t
, sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
837 ctf_integer(unsigned int, nr_sector
,
838 bio
? bio_sectors(bio
) : 0)
839 blk_rwbs_ctf_integer(unsigned int, rwbs
,
840 bio
? lttng_bio_op(bio
) : 0,
841 bio
? lttng_bio_rw(bio
) : 0,
842 bio
? bio
->bi_iter
.bi_size
: 0)
843 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
844 ctf_integer(sector_t
, sector
, bio
? bio
->bi_sector
: 0)
845 ctf_integer(unsigned int, nr_sector
,
846 bio
? bio
->bi_size
>> 9 : 0)
847 blk_rwbs_ctf_integer(unsigned int, rwbs
,
848 bio
? lttng_bio_op(bio
) : 0,
849 bio
? lttng_bio_rw(bio
) : 0,
850 bio
? bio
->bi_size
: 0)
851 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
852 ctf_integer(pid_t
, tid
, current
->pid
)
853 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
858 * block_getrq - get a free request entry in queue for block IO operations
859 * @q: queue for operations
860 * @bio: pending block IO operation
861 * @rw: low bit indicates a read (%0) or a write (%1)
863 * A request struct for queue @q has been allocated to handle the
864 * block IO operation @bio.
866 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_getrq
,
868 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
874 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
875 * @q: queue for operation
876 * @bio: pending block IO operation
877 * @rw: low bit indicates a read (%0) or a write (%1)
879 * In the case where a request struct cannot be provided for queue @q
880 * the process needs to wait for an request struct to become
881 * available. This tracepoint event is generated each time the
882 * process goes to sleep waiting for request struct become available.
884 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_sleeprq
,
886 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
892 * block_plug - keep operations requests in request queue
893 * @q: request queue to plug
895 * Plug the request queue @q. Do not allow block operation requests
896 * to be sent to the device driver. Instead, accumulate requests in
897 * the queue to improve throughput performance of the block device.
899 LTTNG_TRACEPOINT_EVENT(block_plug
,
901 TP_PROTO(struct request_queue
*q
),
906 ctf_integer(pid_t
, tid
, current
->pid
)
907 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
911 LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug
,
913 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
914 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
916 TP_ARGS(q
, depth
, explicit),
918 TP_PROTO(struct request_queue
*q
),
924 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
925 ctf_integer(int, nr_rq
, depth
)
927 ctf_integer(int, nr_rq
, q
->rq
.count
[READ
] + q
->rq
.count
[WRITE
])
929 ctf_integer(pid_t
, tid
, current
->pid
)
930 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
934 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
936 * block_unplug_timer - timed release of operations requests in queue to device driver
937 * @q: request queue to unplug
939 * Unplug the request queue @q because a timer expired and allow block
940 * operation requests to be sent to the device driver.
942 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_timer
,
944 TP_PROTO(struct request_queue
*q
),
951 * block_unplug - release of operations requests in request queue
952 * @q: request queue to unplug
953 * @depth: number of requests just added to the queue
954 * @explicit: whether this was an explicit unplug, or one from schedule()
956 * Unplug request queue @q because device driver is scheduled to work
957 * on elements in the request queue.
959 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
960 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug
,
962 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_io
,
965 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
966 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
968 TP_ARGS(q
, depth
, explicit)
970 TP_PROTO(struct request_queue
*q
),
977 * block_split - split a single bio struct into two bio structs
978 * @q: queue containing the bio
979 * @bio: block operation being split
980 * @new_sector: The starting sector for the new bio
982 * The bio request @bio in request queue @q needs to be split into two
983 * bio requests. The newly created @bio request starts at
984 * @new_sector. This split may be required due to hardware limitation
985 * such as operation crossing device boundaries in a RAID system.
987 LTTNG_TRACEPOINT_EVENT(block_split
,
989 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
990 unsigned int new_sector
),
992 TP_ARGS(q
, bio
, new_sector
),
995 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
996 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
997 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
998 blk_rwbs_ctf_integer(unsigned int, rwbs
,
999 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1000 bio
->bi_iter
.bi_size
)
1001 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1002 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1003 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1004 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1005 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1006 ctf_integer(sector_t
, new_sector
, new_sector
)
1007 ctf_integer(pid_t
, tid
, current
->pid
)
1008 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1013 * block_bio_remap - map request for a logical device to the raw device
1014 * @q: queue holding the operation
1015 * @bio: revised operation
1016 * @dev: device for the operation
1017 * @from: original sector for the operation
1019 * An operation for a logical device has been mapped to the
1022 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
1023 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1025 LTTNG_TRACEPOINT_EVENT(block_remap
,
1028 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1031 TP_ARGS(q
, bio
, dev
, from
),
1034 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1035 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
1036 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1037 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1038 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1039 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1040 bio
->bi_iter
.bi_size
)
1041 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1042 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1043 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1044 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1045 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1046 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1047 ctf_integer(dev_t
, old_dev
, dev
)
1048 ctf_integer(sector_t
, old_sector
, from
)
1052 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
1054 * block_rq_remap - map request for a block operation request
1055 * @q: queue holding the operation
1056 * @rq: block IO operation request
1057 * @dev: device for the operation
1058 * @from: original sector for the operation
1060 * The block operation request @rq in @q has been remapped. The block
1061 * operation request @rq holds the current information and @from hold
1062 * the original sector.
1064 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1066 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
1069 TP_ARGS(q
, rq
, dev
, from
),
1072 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1073 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1074 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1075 ctf_integer(dev_t
, old_dev
, dev
)
1076 ctf_integer(sector_t
, old_sector
, from
)
1077 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1078 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1083 #undef __print_rwbs_flags
1084 #undef blk_fill_rwbs
1086 #endif /* LTTNG_TRACE_BLOCK_H */
1088 /* This part must be outside protection */
1089 #include <probes/define_trace.h>
This page took 0.061779 seconds and 4 git commands to generate.