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) || \
37 LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
38 LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
39 LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
40 LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,4,103,7,0,0) || \
41 LTTNG_SLE_KERNEL_RANGE(4,4,114,94,0,0, 4,4,114,95,0,0) || \
42 LTTNG_SLE_KERNEL_RANGE(4,4,120,94,0,0, 4,4,120,95,0,0) || \
43 LTTNG_SLE_KERNEL_RANGE(4,4,126,94,0,0, 4,5,0,0,0,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 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
622 ctf_integer(dev_t
, dev
, bio_dev(bio
))
624 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
626 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
627 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
628 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
629 blk_rwbs_ctf_integer(unsigned int, rwbs
,
630 lttng_bio_op(bio
), lttng_bio_rw(bio
),
631 bio
->bi_iter
.bi_size
)
632 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
633 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
634 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
635 blk_rwbs_ctf_integer(unsigned int, rwbs
,
636 lttng_bio_op(bio
), lttng_bio_rw(bio
),
638 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
639 ctf_integer(pid_t
, tid
, current
->pid
)
640 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
645 * block_bio_complete - completed all work on the block operation
646 * @q: queue holding the block operation
647 * @bio: block operation completed
648 * @error: io error value
650 * This tracepoint indicates there is no further work to do on this
651 * block IO operation @bio.
653 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
655 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
656 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
658 TP_ARGS(q
, bio
, error
),
660 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
666 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
667 ctf_integer(dev_t
, dev
, bio_dev(bio
))
669 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
671 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
672 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
673 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
674 ctf_integer(int, error
, error
)
675 blk_rwbs_ctf_integer(unsigned int, rwbs
,
676 lttng_bio_op(bio
), lttng_bio_rw(bio
),
677 bio
->bi_iter
.bi_size
)
678 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
679 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
680 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
681 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
682 ctf_integer(int, error
, error
)
684 ctf_integer(int, error
, 0)
686 blk_rwbs_ctf_integer(unsigned int, rwbs
,
687 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
688 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
692 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
693 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
695 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
700 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
701 ctf_integer(dev_t
, dev
, bio_dev(bio
))
703 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
705 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
706 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
707 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
708 blk_rwbs_ctf_integer(unsigned int, rwbs
,
709 lttng_bio_op(bio
), lttng_bio_rw(bio
),
710 bio
->bi_iter
.bi_size
)
711 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
712 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
713 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
714 blk_rwbs_ctf_integer(unsigned int, rwbs
,
715 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
716 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
717 ctf_integer(pid_t
, tid
, current
->pid
)
718 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
723 * block_bio_backmerge - merging block operation to the end of an existing operation
724 * @q: queue holding operation
725 * @bio: new block operation to merge
727 * Merging block request @bio to the end of an existing block request
730 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_backmerge
,
732 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
738 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
739 * @q: queue holding operation
740 * @bio: new block operation to merge
742 * Merging block IO operation @bio to the beginning of an existing block
743 * operation in queue @q.
745 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_frontmerge
,
747 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
753 * block_bio_queue - putting new block IO operation in queue
754 * @q: queue holding operation
755 * @bio: new block operation
757 * About to place the block IO operation @bio into queue @q.
759 LTTNG_TRACEPOINT_EVENT(block_bio_queue
,
761 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
766 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
767 ctf_integer(dev_t
, dev
, bio_dev(bio
))
769 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
771 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
772 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
773 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
774 blk_rwbs_ctf_integer(unsigned int, rwbs
,
775 lttng_bio_op(bio
), lttng_bio_rw(bio
),
776 bio
->bi_iter
.bi_size
)
777 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
778 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
779 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
780 blk_rwbs_ctf_integer(unsigned int, rwbs
,
781 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
782 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
783 ctf_integer(pid_t
, tid
, current
->pid
)
784 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
787 #else /* if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
788 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
790 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
795 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
796 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
797 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
798 blk_rwbs_ctf_integer(unsigned int, rwbs
,
799 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
800 ctf_integer(pid_t
, tid
, current
->pid
)
801 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
806 * block_bio_backmerge - merging block operation to the end of an existing operation
807 * @q: queue holding operation
808 * @bio: new block operation to merge
810 * Merging block request @bio to the end of an existing block request
813 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
815 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
821 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
822 * @q: queue holding operation
823 * @bio: new block operation to merge
825 * Merging block IO operation @bio to the beginning of an existing block
826 * operation in queue @q.
828 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
830 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
836 * block_bio_queue - putting new block IO operation in queue
837 * @q: queue holding operation
838 * @bio: new block operation
840 * About to place the block IO operation @bio into queue @q.
842 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
844 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
848 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
850 LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq
,
852 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
857 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
858 ctf_integer(dev_t
, dev
, bio
? bio_dev(bio
) : 0)
860 ctf_integer(dev_t
, dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
862 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
863 ctf_integer(sector_t
, sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
864 ctf_integer(unsigned int, nr_sector
,
865 bio
? bio_sectors(bio
) : 0)
866 blk_rwbs_ctf_integer(unsigned int, rwbs
,
867 bio
? lttng_bio_op(bio
) : 0,
868 bio
? lttng_bio_rw(bio
) : 0,
869 bio
? bio
->bi_iter
.bi_size
: 0)
870 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
871 ctf_integer(sector_t
, sector
, bio
? bio
->bi_sector
: 0)
872 ctf_integer(unsigned int, nr_sector
,
873 bio
? bio
->bi_size
>> 9 : 0)
874 blk_rwbs_ctf_integer(unsigned int, rwbs
,
875 bio
? lttng_bio_op(bio
) : 0,
876 bio
? lttng_bio_rw(bio
) : 0,
877 bio
? bio
->bi_size
: 0)
878 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
879 ctf_integer(pid_t
, tid
, current
->pid
)
880 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
885 * block_getrq - get a free request entry in queue for block IO operations
886 * @q: queue for operations
887 * @bio: pending block IO operation (can be %NULL)
888 * @rw: low bit indicates a read (%0) or a write (%1)
890 * A request struct for queue @q has been allocated to handle the
891 * block IO operation @bio.
893 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_getrq
,
895 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
901 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
902 * @q: queue for operation
903 * @bio: pending block IO operation (can be %NULL)
904 * @rw: low bit indicates a read (%0) or a write (%1)
906 * In the case where a request struct cannot be provided for queue @q
907 * the process needs to wait for an request struct to become
908 * available. This tracepoint event is generated each time the
909 * process goes to sleep waiting for request struct become available.
911 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_sleeprq
,
913 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
919 * block_plug - keep operations requests in request queue
920 * @q: request queue to plug
922 * Plug the request queue @q. Do not allow block operation requests
923 * to be sent to the device driver. Instead, accumulate requests in
924 * the queue to improve throughput performance of the block device.
926 LTTNG_TRACEPOINT_EVENT(block_plug
,
928 TP_PROTO(struct request_queue
*q
),
933 ctf_integer(pid_t
, tid
, current
->pid
)
934 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
938 LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug
,
940 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
941 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
943 TP_ARGS(q
, depth
, explicit),
945 TP_PROTO(struct request_queue
*q
),
951 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
952 ctf_integer(int, nr_rq
, depth
)
954 ctf_integer(int, nr_rq
, q
->rq
.count
[READ
] + q
->rq
.count
[WRITE
])
956 ctf_integer(pid_t
, tid
, current
->pid
)
957 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
961 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
963 * block_unplug_timer - timed release of operations requests in queue to device driver
964 * @q: request queue to unplug
966 * Unplug the request queue @q because a timer expired and allow block
967 * operation requests to be sent to the device driver.
969 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_timer
,
971 TP_PROTO(struct request_queue
*q
),
978 * block_unplug - release of operations requests in request queue
979 * @q: request queue to unplug
980 * @depth: number of requests just added to the queue
981 * @explicit: whether this was an explicit unplug, or one from schedule()
983 * Unplug request queue @q because device driver is scheduled to work
984 * on elements in the request queue.
986 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
987 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug
,
989 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_io
,
992 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
993 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
995 TP_ARGS(q
, depth
, explicit)
997 TP_PROTO(struct request_queue
*q
),
1004 * block_split - split a single bio struct into two bio structs
1005 * @q: queue containing the bio
1006 * @bio: block operation being split
1007 * @new_sector: The starting sector for the new bio
1009 * The bio request @bio in request queue @q needs to be split into two
1010 * bio requests. The newly created @bio request starts at
1011 * @new_sector. This split may be required due to hardware limitation
1012 * such as operation crossing device boundaries in a RAID system.
1014 LTTNG_TRACEPOINT_EVENT(block_split
,
1016 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
1017 unsigned int new_sector
),
1019 TP_ARGS(q
, bio
, new_sector
),
1022 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
1023 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1025 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1027 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
1028 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1029 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1030 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1031 bio
->bi_iter
.bi_size
)
1032 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1033 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1034 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1035 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1036 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1037 ctf_integer(sector_t
, new_sector
, new_sector
)
1038 ctf_integer(pid_t
, tid
, current
->pid
)
1039 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
1044 * block_bio_remap - map request for a logical device to the raw device
1045 * @q: queue holding the operation
1046 * @bio: revised operation
1047 * @dev: device for the operation
1048 * @from: original sector for the operation
1050 * An operation for a logical device has been mapped to the
1053 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
1054 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
1056 LTTNG_TRACEPOINT_EVENT(block_remap
,
1059 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
1062 TP_ARGS(q
, bio
, dev
, from
),
1065 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
1066 ctf_integer(dev_t
, dev
, bio_dev(bio
))
1068 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
1070 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
1071 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
1072 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
1073 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1074 lttng_bio_op(bio
), lttng_bio_rw(bio
),
1075 bio
->bi_iter
.bi_size
)
1076 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1077 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
1078 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
1079 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1080 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
1081 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
1082 ctf_integer(dev_t
, old_dev
, dev
)
1083 ctf_integer(sector_t
, old_sector
, from
)
1087 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
1089 * block_rq_remap - map request for a block operation request
1090 * @q: queue holding the operation
1091 * @rq: block IO operation request
1092 * @dev: device for the operation
1093 * @from: original sector for the operation
1095 * The block operation request @rq in @q has been remapped. The block
1096 * operation request @rq holds the current information and @from hold
1097 * the original sector.
1099 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
1101 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
1104 TP_ARGS(q
, rq
, dev
, from
),
1107 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
1108 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
1109 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
1110 ctf_integer(dev_t
, old_dev
, dev
)
1111 ctf_integer(sector_t
, old_sector
, from
)
1112 blk_rwbs_ctf_integer(unsigned int, rwbs
,
1113 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
1118 #undef __print_rwbs_flags
1119 #undef blk_fill_rwbs
1121 #endif /* LTTNG_TRACE_BLOCK_H */
1123 /* This part must be outside protection */
1124 #include <probes/define_trace.h>
This page took 0.063634 seconds and 4 git commands to generate.