80ea25cadd40076ece8484d356eae18703dd95d9
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_ */
37 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
38 #define lttng_bio_dev(bio) bio_dev(bio)
40 #define lttng_bio_dev(bio) ((bio)->bi_bdev ? (bio)->bi_bdev->bd_dev : 0)
43 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
45 #define lttng_req_op(rq) req_op(rq)
46 #define lttng_req_rw(rq) ((rq)->cmd_flags)
47 #define lttng_bio_op(bio) bio_op(bio)
48 #define lttng_bio_rw(bio) ((bio)->bi_opf)
50 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
51 ctf_integer(type, rwbs, \
52 (((op) == REQ_OP_WRITE || (op) == REQ_OP_WRITE_SAME) ? RWBS_FLAG_WRITE : \
53 ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
54 ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
55 ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
56 ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
58 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
59 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
60 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
61 | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
62 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
64 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
66 #define lttng_req_op(rq)
67 #define lttng_req_rw(rq) ((rq)->cmd_flags)
68 #define lttng_bio_op(bio)
69 #define lttng_bio_rw(bio) ((bio)->bi_rw)
71 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
72 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
73 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
74 ( (bytes) ? RWBS_FLAG_READ : \
76 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
77 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
78 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
79 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \
80 | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \
81 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
83 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
85 #define lttng_req_op(rq)
86 #define lttng_req_rw(rq) ((rq)->cmd_flags)
87 #define lttng_bio_op(bio)
88 #define lttng_bio_rw(bio) ((bio)->bi_rw)
90 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
91 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
92 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
93 ( (bytes) ? RWBS_FLAG_READ : \
95 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
96 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
97 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
98 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
100 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
102 #define lttng_req_op(rq)
103 #define lttng_req_rw(rq) ((rq)->cmd_flags)
104 #define lttng_bio_op(bio)
105 #define lttng_bio_rw(bio) ((bio)->bi_rw)
107 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
108 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
109 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
110 ( (bytes) ? RWBS_FLAG_READ : \
112 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
113 | ((rw) & REQ_HARDBARRIER ? RWBS_FLAG_BARRIER : 0) \
114 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
115 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
116 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
120 #define lttng_req_op(rq)
121 #define lttng_req_rw(rq) ((rq)->cmd_flags)
122 #define lttng_bio_op(bio)
123 #define lttng_bio_rw(bio) ((bio)->bi_rw)
125 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
126 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
127 ( (rw) & (1 << BIO_RW_DISCARD) ? RWBS_FLAG_DISCARD : \
128 ( (bytes) ? RWBS_FLAG_READ : \
130 | ((rw) & (1 << BIO_RW_AHEAD) ? RWBS_FLAG_RAHEAD : 0) \
131 | ((rw) & (1 << BIO_RW_SYNCIO) ? RWBS_FLAG_SYNC : 0) \
132 | ((rw) & (1 << BIO_RW_META) ? RWBS_FLAG_META : 0) \
133 | ((rw) & (1 << BIO_RW_BARRIER) ? RWBS_FLAG_BARRIER : 0))
137 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
138 LTTNG_TRACEPOINT_EVENT_CLASS(block_buffer
,
140 TP_PROTO(struct buffer_head
*bh
),
145 ctf_integer(dev_t
, dev
, bh
->b_bdev
->bd_dev
)
146 ctf_integer(sector_t
, sector
, bh
->b_blocknr
)
147 ctf_integer(size_t, size
, bh
->b_size
)
152 * block_touch_buffer - mark a buffer accessed
153 * @bh: buffer_head being touched
155 * Called from touch_buffer().
157 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_touch_buffer
,
159 TP_PROTO(struct buffer_head
*bh
),
165 * block_dirty_buffer - mark a buffer dirty
166 * @bh: buffer_head being dirtied
168 * Called from mark_buffer_dirty().
170 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_dirty_buffer
,
172 TP_PROTO(struct buffer_head
*bh
),
178 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
179 /* block_rq_with_error event class removed in kernel 4.12 */
180 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
181 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
183 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
189 unsigned int nr_sector
;
195 if (blk_rq_is_scsi(rq
)) {
196 struct scsi_request
*scsi_rq
= scsi_req(rq
);
197 tp_locvar
->sector
= 0;
198 tp_locvar
->nr_sector
= 0;
199 tp_locvar
->cmd
= scsi_rq
->cmd
;
200 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
202 tp_locvar
->sector
= blk_rq_pos(rq
);
203 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
204 tp_locvar
->cmd
= NULL
;
205 tp_locvar
->cmd_len
= 0;
210 ctf_integer(dev_t
, dev
,
211 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
212 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
213 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
214 ctf_integer(int, errors
, rq
->errors
)
215 blk_rwbs_ctf_integer(unsigned int, rwbs
,
216 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
217 ctf_sequence_hex(unsigned char, cmd
,
218 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
223 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
224 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
226 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
232 unsigned int nr_sector
;
239 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
240 tp_locvar
->sector
= 0;
241 tp_locvar
->nr_sector
= 0;
242 tp_locvar
->cmd
= rq
->cmd
;
243 tp_locvar
->cmd_len
= rq
->cmd_len
;
245 tp_locvar
->sector
= blk_rq_pos(rq
);
246 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
247 tp_locvar
->cmd
= NULL
;
248 tp_locvar
->cmd_len
= 0;
253 ctf_integer(dev_t
, dev
,
254 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
255 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
256 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
257 ctf_integer(int, errors
, rq
->errors
)
258 blk_rwbs_ctf_integer(unsigned int, rwbs
,
259 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
260 ctf_sequence_hex(unsigned char, cmd
,
261 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
266 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
268 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0))
270 * block_rq_abort - abort block operation request
271 * @q: queue containing the block operation request
272 * @rq: block IO operation request
274 * Called immediately after pending block IO operation request @rq in
275 * queue @q is aborted. The fields in the operation request @rq
276 * can be examined to determine which device and sectors the pending
277 * operation would access.
279 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_abort
,
281 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
288 * block_rq_requeue - place block IO request back on a queue
289 * @q: queue holding operation
290 * @rq: block IO operation request
292 * The block operation request @rq is being placed back into queue
293 * @q. For some reason the request was not completed and needs to be
294 * put back in the queue.
296 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
297 LTTNG_TRACEPOINT_EVENT(block_rq_requeue
,
299 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
304 ctf_integer(dev_t
, dev
,
305 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
306 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
307 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
308 blk_rwbs_ctf_integer(unsigned int, rwbs
,
309 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
313 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_requeue
,
315 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
322 * block_rq_complete - block IO operation completed by device driver
323 * @q: queue containing the block operation request
324 * @rq: block operations request
325 * @nr_bytes: number of completed bytes
327 * The block_rq_complete tracepoint event indicates that some portion
328 * of operation request has been completed by the device driver. If
329 * the @rq->bio is %NULL, then there is absolutely no additional work to
330 * do for the request. If @rq->bio is non-NULL then there is
331 * additional work required to complete the request.
333 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
334 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
336 TP_PROTO(struct request
*rq
, int error
, unsigned int nr_bytes
),
338 TP_ARGS(rq
, error
, nr_bytes
),
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, error
, error
)
346 blk_rwbs_ctf_integer(unsigned int, rwbs
,
347 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
350 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
351 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
353 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
354 unsigned int nr_bytes
),
356 TP_ARGS(q
, rq
, nr_bytes
),
364 if (blk_rq_is_scsi(rq
)) {
365 struct scsi_request
*scsi_rq
= scsi_req(rq
);
366 tp_locvar
->cmd
= scsi_rq
->cmd
;
367 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
369 tp_locvar
->cmd
= NULL
;
370 tp_locvar
->cmd_len
= 0;
375 ctf_integer(dev_t
, dev
,
376 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
377 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
378 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
379 ctf_integer(int, errors
, rq
->errors
)
380 blk_rwbs_ctf_integer(unsigned int, rwbs
,
381 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
382 ctf_sequence_hex(unsigned char, cmd
,
383 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
388 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,5) \
389 || LTTNG_KERNEL_RANGE(3,12,21, 3,13,0) \
390 || LTTNG_KERNEL_RANGE(3,10,41, 3,11,0) \
391 || LTTNG_KERNEL_RANGE(3,4,91, 3,5,0) \
392 || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0) \
393 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,28, 3,14,0,0) \
394 || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0))
396 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
398 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
399 unsigned int nr_bytes
),
401 TP_ARGS(q
, rq
, nr_bytes
),
409 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
410 tp_locvar
->cmd
= rq
->cmd
;
411 tp_locvar
->cmd_len
= rq
->cmd_len
;
413 tp_locvar
->cmd
= NULL
;
414 tp_locvar
->cmd_len
= 0;
419 ctf_integer(dev_t
, dev
,
420 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
421 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
422 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
423 ctf_integer(int, errors
, rq
->errors
)
424 blk_rwbs_ctf_integer(unsigned int, rwbs
,
425 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
426 ctf_sequence_hex(unsigned char, cmd
,
427 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
433 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
436 * block_rq_complete - block IO operation completed by device driver
437 * @q: queue containing the block operation request
438 * @rq: block operations request
440 * The block_rq_complete tracepoint event indicates that some portion
441 * of operation request has been completed by the device driver. If
442 * the @rq->bio is %NULL, then there is absolutely no additional work to
443 * do for the request. If @rq->bio is non-NULL then there is
444 * additional work required to complete the request.
446 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_complete
,
448 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
453 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
455 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
456 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
458 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
463 ctf_integer(dev_t
, dev
,
464 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
465 ctf_integer(sector_t
, sector
, blk_rq_trace_sector(rq
))
466 ctf_integer(unsigned int, nr_sector
, blk_rq_trace_nr_sectors(rq
))
467 ctf_integer(unsigned int, bytes
, blk_rq_bytes(rq
))
468 ctf_integer(pid_t
, tid
, current
->pid
)
469 blk_rwbs_ctf_integer(unsigned int, rwbs
,
470 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
471 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
474 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
475 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
477 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
483 unsigned int nr_sector
;
490 if (blk_rq_is_scsi(rq
)) {
491 struct scsi_request
*scsi_rq
= scsi_req(rq
);
492 tp_locvar
->sector
= 0;
493 tp_locvar
->nr_sector
= 0;
494 tp_locvar
->bytes
= scsi_rq
->resid_len
;
495 tp_locvar
->cmd
= scsi_rq
->cmd
;
496 tp_locvar
->cmd_len
= scsi_rq
->cmd_len
;
498 tp_locvar
->sector
= blk_rq_pos(rq
);
499 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
500 tp_locvar
->bytes
= 0;
501 tp_locvar
->cmd
= NULL
;
502 tp_locvar
->cmd_len
= 0;
507 ctf_integer(dev_t
, dev
,
508 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
509 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
510 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
511 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
512 ctf_integer(pid_t
, tid
, current
->pid
)
513 blk_rwbs_ctf_integer(unsigned int, rwbs
,
514 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
515 ctf_sequence_hex(unsigned char, cmd
,
516 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
517 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
522 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
523 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
525 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
531 unsigned int nr_sector
;
538 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
539 tp_locvar
->sector
= 0;
540 tp_locvar
->nr_sector
= 0;
541 tp_locvar
->bytes
= blk_rq_bytes(rq
);
542 tp_locvar
->cmd
= rq
->cmd
;
543 tp_locvar
->cmd_len
= rq
->cmd_len
;
545 tp_locvar
->sector
= blk_rq_pos(rq
);
546 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
547 tp_locvar
->bytes
= 0;
548 tp_locvar
->cmd
= NULL
;
549 tp_locvar
->cmd_len
= 0;
554 ctf_integer(dev_t
, dev
,
555 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
556 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
557 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
558 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
559 ctf_integer(pid_t
, tid
, current
->pid
)
560 blk_rwbs_ctf_integer(unsigned int, rwbs
,
561 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
562 ctf_sequence_hex(unsigned char, cmd
,
563 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
564 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
569 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
572 * block_rq_insert - insert block operation request into queue
574 * @rq: block IO operation request
576 * Called immediately before block operation request @rq is inserted
577 * into queue @q. The fields in the operation request @rq struct can
578 * be examined to determine which device and sectors the pending
579 * operation would access.
581 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
583 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
589 * block_rq_issue - issue pending block IO request operation to device driver
590 * @q: queue holding operation
591 * @rq: block IO operation operation request
593 * Called when block operation request @rq from queue @q is sent to a
594 * device driver for processing.
596 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
598 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
604 * block_bio_bounce - used bounce buffer when processing block operation
605 * @q: queue holding the block operation
606 * @bio: block operation
608 * A bounce buffer was used to handle the block operation @bio in @q.
609 * This occurs when hardware limitations prevent a direct transfer of
610 * data between the @bio data memory area and the IO device. Use of a
611 * bounce buffer requires extra copying of data and decreases
614 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
616 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
621 ctf_integer(dev_t
, dev
, lttng_bio_dev(bio
))
622 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
623 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
624 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
625 blk_rwbs_ctf_integer(unsigned int, rwbs
,
626 lttng_bio_op(bio
), lttng_bio_rw(bio
),
627 bio
->bi_iter
.bi_size
)
628 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
629 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
630 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
631 blk_rwbs_ctf_integer(unsigned int, rwbs
,
632 lttng_bio_op(bio
), lttng_bio_rw(bio
),
634 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
635 ctf_integer(pid_t
, tid
, current
->pid
)
636 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
641 * block_bio_complete - completed all work on the block operation
642 * @q: queue holding the block operation
643 * @bio: block operation completed
644 * @error: io error value
646 * This tracepoint indicates there is no further work to do on this
647 * block IO operation @bio.
649 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
651 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
652 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
654 TP_ARGS(q
, bio
, error
),
656 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
662 ctf_integer(dev_t
, dev
, lttng_bio_dev(bio
))
663 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
664 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
665 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
666 ctf_integer(int, error
, error
)
667 blk_rwbs_ctf_integer(unsigned int, rwbs
,
668 lttng_bio_op(bio
), lttng_bio_rw(bio
),
669 bio
->bi_iter
.bi_size
)
670 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
671 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
672 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
673 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
674 ctf_integer(int, error
, error
)
676 ctf_integer(int, error
, 0)
678 blk_rwbs_ctf_integer(unsigned int, rwbs
,
679 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
680 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
684 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
685 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
687 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
692 ctf_integer(dev_t
, dev
, lttng_bio_dev(bio
))
693 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
694 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
695 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
696 blk_rwbs_ctf_integer(unsigned int, rwbs
,
697 lttng_bio_op(bio
), lttng_bio_rw(bio
),
698 bio
->bi_iter
.bi_size
)
699 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
700 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
701 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
702 blk_rwbs_ctf_integer(unsigned int, rwbs
,
703 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
704 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
705 ctf_integer(pid_t
, tid
, current
->pid
)
706 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
711 * block_bio_backmerge - merging block operation to the end of an existing operation
712 * @q: queue holding operation
713 * @bio: new block operation to merge
715 * Merging block request @bio to the end of an existing block request
718 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_backmerge
,
720 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
726 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
727 * @q: queue holding operation
728 * @bio: new block operation to merge
730 * Merging block IO operation @bio to the beginning of an existing block
731 * operation in queue @q.
733 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_frontmerge
,
735 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
741 * block_bio_queue - putting new block IO operation in queue
742 * @q: queue holding operation
743 * @bio: new block operation
745 * About to place the block IO operation @bio into queue @q.
747 LTTNG_TRACEPOINT_EVENT(block_bio_queue
,
749 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
754 ctf_integer(dev_t
, dev
, lttng_bio_dev(bio
))
755 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
756 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
757 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
758 blk_rwbs_ctf_integer(unsigned int, rwbs
,
759 lttng_bio_op(bio
), lttng_bio_rw(bio
),
760 bio
->bi_iter
.bi_size
)
761 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
762 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
763 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
764 blk_rwbs_ctf_integer(unsigned int, rwbs
,
765 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
766 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
767 ctf_integer(pid_t
, tid
, current
->pid
)
768 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
771 #else /* if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
772 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
774 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
779 ctf_integer(dev_t
, dev
, lttng_bio_dev(bio
))
780 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
781 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
782 blk_rwbs_ctf_integer(unsigned int, rwbs
,
783 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
784 ctf_integer(pid_t
, tid
, current
->pid
)
785 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
790 * block_bio_backmerge - merging block operation to the end of an existing operation
791 * @q: queue holding operation
792 * @bio: new block operation to merge
794 * Merging block request @bio to the end of an existing block request
797 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
799 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
805 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
806 * @q: queue holding operation
807 * @bio: new block operation to merge
809 * Merging block IO operation @bio to the beginning of an existing block
810 * operation in queue @q.
812 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
814 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
820 * block_bio_queue - putting new block IO operation in queue
821 * @q: queue holding operation
822 * @bio: new block operation
824 * About to place the block IO operation @bio into queue @q.
826 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
828 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
832 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
834 LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq
,
836 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
841 ctf_integer(dev_t
, dev
, lttng_bio_dev(bio
))
842 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
843 ctf_integer(sector_t
, sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
844 ctf_integer(unsigned int, nr_sector
,
845 bio
? bio_sectors(bio
) : 0)
846 blk_rwbs_ctf_integer(unsigned int, rwbs
,
847 bio
? lttng_bio_op(bio
) : 0,
848 bio
? lttng_bio_rw(bio
) : 0,
849 bio
? bio
->bi_iter
.bi_size
: 0)
850 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
851 ctf_integer(sector_t
, sector
, bio
? bio
->bi_sector
: 0)
852 ctf_integer(unsigned int, nr_sector
,
853 bio
? bio
->bi_size
>> 9 : 0)
854 blk_rwbs_ctf_integer(unsigned int, rwbs
,
855 bio
? lttng_bio_op(bio
) : 0,
856 bio
? lttng_bio_rw(bio
) : 0,
857 bio
? bio
->bi_size
: 0)
858 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
859 ctf_integer(pid_t
, tid
, current
->pid
)
860 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
865 * block_getrq - get a free request entry in queue for block IO operations
866 * @q: queue for operations
867 * @bio: pending block IO operation
868 * @rw: low bit indicates a read (%0) or a write (%1)
870 * A request struct for queue @q has been allocated to handle the
871 * block IO operation @bio.
873 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_getrq
,
875 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
881 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
882 * @q: queue for operation
883 * @bio: pending block IO operation
884 * @rw: low bit indicates a read (%0) or a write (%1)
886 * In the case where a request struct cannot be provided for queue @q
887 * the process needs to wait for an request struct to become
888 * available. This tracepoint event is generated each time the
889 * process goes to sleep waiting for request struct become available.
891 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_sleeprq
,
893 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
899 * block_plug - keep operations requests in request queue
900 * @q: request queue to plug
902 * Plug the request queue @q. Do not allow block operation requests
903 * to be sent to the device driver. Instead, accumulate requests in
904 * the queue to improve throughput performance of the block device.
906 LTTNG_TRACEPOINT_EVENT(block_plug
,
908 TP_PROTO(struct request_queue
*q
),
913 ctf_integer(pid_t
, tid
, current
->pid
)
914 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
918 LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug
,
920 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
921 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
923 TP_ARGS(q
, depth
, explicit),
925 TP_PROTO(struct request_queue
*q
),
931 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
932 ctf_integer(int, nr_rq
, depth
)
934 ctf_integer(int, nr_rq
, q
->rq
.count
[READ
] + q
->rq
.count
[WRITE
])
936 ctf_integer(pid_t
, tid
, current
->pid
)
937 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
941 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
943 * block_unplug_timer - timed release of operations requests in queue to device driver
944 * @q: request queue to unplug
946 * Unplug the request queue @q because a timer expired and allow block
947 * operation requests to be sent to the device driver.
949 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_timer
,
951 TP_PROTO(struct request_queue
*q
),
958 * block_unplug - release of operations requests in request queue
959 * @q: request queue to unplug
960 * @depth: number of requests just added to the queue
961 * @explicit: whether this was an explicit unplug, or one from schedule()
963 * Unplug request queue @q because device driver is scheduled to work
964 * on elements in the request queue.
966 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
967 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug
,
969 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_io
,
972 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
973 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
975 TP_ARGS(q
, depth
, explicit)
977 TP_PROTO(struct request_queue
*q
),
984 * block_split - split a single bio struct into two bio structs
985 * @q: queue containing the bio
986 * @bio: block operation being split
987 * @new_sector: The starting sector for the new bio
989 * The bio request @bio in request queue @q needs to be split into two
990 * bio requests. The newly created @bio request starts at
991 * @new_sector. This split may be required due to hardware limitation
992 * such as operation crossing device boundaries in a RAID system.
994 LTTNG_TRACEPOINT_EVENT(block_split
,
996 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
997 unsigned int new_sector
),
999 TP_ARGS(q
, bio
, new_sector
),
1002 ctf_integer(dev_t
, dev
, lttng_bio_dev(bio
))
1003 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
1004 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1005 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1006 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1007 bio
->bi_iter
.bi_size
)
1008 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1009 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1010 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1011 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1012 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1013 ctf_integer(sector_t
, new_sector
, new_sector
)
1014 ctf_integer(pid_t
, tid
, current
->pid
)
1015 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1020 * block_bio_remap - map request for a logical device to the raw device
1021 * @q: queue holding the operation
1022 * @bio: revised operation
1023 * @dev: device for the operation
1024 * @from: original sector for the operation
1026 * An operation for a logical device has been mapped to the
1029 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
1030 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1032 LTTNG_TRACEPOINT_EVENT(block_remap
,
1035 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1038 TP_ARGS(q
, bio
, dev
, from
),
1041 ctf_integer(dev_t
, dev
, lttng_bio_dev(bio
))
1042 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
1043 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1044 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1045 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1046 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1047 bio
->bi_iter
.bi_size
)
1048 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1049 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1050 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1051 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1052 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1053 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1054 ctf_integer(dev_t
, old_dev
, dev
)
1055 ctf_integer(sector_t
, old_sector
, from
)
1059 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
1061 * block_rq_remap - map request for a block operation request
1062 * @q: queue holding the operation
1063 * @rq: block IO operation request
1064 * @dev: device for the operation
1065 * @from: original sector for the operation
1067 * The block operation request @rq in @q has been remapped. The block
1068 * operation request @rq holds the current information and @from hold
1069 * the original sector.
1071 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1073 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
1076 TP_ARGS(q
, rq
, dev
, from
),
1079 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1080 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1081 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1082 ctf_integer(dev_t
, old_dev
, dev
)
1083 ctf_integer(sector_t
, old_sector
, from
)
1084 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1085 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1090 #undef __print_rwbs_flags
1091 #undef blk_fill_rwbs
1093 #endif /* LTTNG_TRACE_BLOCK_H */
1095 /* This part must be outside protection */
1096 #include <probes/define_trace.h>
This page took 0.050224 seconds and 3 git commands to generate.