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 #ifndef _TRACE_BLOCK_DEF_
14 #define _TRACE_BLOCK_DEF_
17 RWBS_FLAG_WRITE
= (1 << 0),
18 RWBS_FLAG_DISCARD
= (1 << 1),
19 RWBS_FLAG_READ
= (1 << 2),
20 RWBS_FLAG_RAHEAD
= (1 << 3),
21 RWBS_FLAG_BARRIER
= (1 << 4),
22 RWBS_FLAG_SYNC
= (1 << 5),
23 RWBS_FLAG_META
= (1 << 6),
24 RWBS_FLAG_SECURE
= (1 << 7),
25 RWBS_FLAG_FLUSH
= (1 << 8),
26 RWBS_FLAG_FUA
= (1 << 9),
27 RWBS_FLAG_PREFLUSH
= (1 << 10),
30 #endif /* _TRACE_BLOCK_DEF_ */
32 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
34 #define lttng_req_op(rq) req_op(rq)
35 #define lttng_req_rw(rq) ((rq)->cmd_flags)
36 #define lttng_bio_op(bio) bio_op(bio)
37 #define lttng_bio_rw(bio) ((bio)->bi_opf)
39 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
40 ctf_integer(type, rwbs, \
41 (((op) == REQ_OP_WRITE || (op) == REQ_OP_WRITE_SAME) ? RWBS_FLAG_WRITE : \
42 ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
43 ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
44 ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
45 ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
47 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
48 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
49 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
50 | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
51 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
53 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
55 #define lttng_req_op(rq)
56 #define lttng_req_rw(rq) ((rq)->cmd_flags)
57 #define lttng_bio_op(bio)
58 #define lttng_bio_rw(bio) ((bio)->bi_rw)
60 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
61 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
62 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
63 ( (bytes) ? RWBS_FLAG_READ : \
65 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
66 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
67 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
68 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \
69 | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \
70 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
72 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
74 #define lttng_req_op(rq)
75 #define lttng_req_rw(rq) ((rq)->cmd_flags)
76 #define lttng_bio_op(bio)
77 #define lttng_bio_rw(bio) ((bio)->bi_rw)
79 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
80 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
81 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
82 ( (bytes) ? RWBS_FLAG_READ : \
84 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
85 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
86 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
87 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
89 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
91 #define lttng_req_op(rq)
92 #define lttng_req_rw(rq) ((rq)->cmd_flags)
93 #define lttng_bio_op(bio)
94 #define lttng_bio_rw(bio) ((bio)->bi_rw)
96 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
97 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
98 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
99 ( (bytes) ? RWBS_FLAG_READ : \
101 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
102 | ((rw) & REQ_HARDBARRIER ? RWBS_FLAG_BARRIER : 0) \
103 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
104 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
105 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
109 #define lttng_req_op(rq)
110 #define lttng_req_rw(rq) ((rq)->cmd_flags)
111 #define lttng_bio_op(bio)
112 #define lttng_bio_rw(bio) ((bio)->bi_rw)
114 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
115 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
116 ( (rw) & (1 << BIO_RW_DISCARD) ? RWBS_FLAG_DISCARD : \
117 ( (bytes) ? RWBS_FLAG_READ : \
119 | ((rw) & (1 << BIO_RW_AHEAD) ? RWBS_FLAG_RAHEAD : 0) \
120 | ((rw) & (1 << BIO_RW_SYNCIO) ? RWBS_FLAG_SYNC : 0) \
121 | ((rw) & (1 << BIO_RW_META) ? RWBS_FLAG_META : 0) \
122 | ((rw) & (1 << BIO_RW_BARRIER) ? RWBS_FLAG_BARRIER : 0))
126 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
127 LTTNG_TRACEPOINT_EVENT_CLASS(block_buffer
,
129 TP_PROTO(struct buffer_head
*bh
),
134 ctf_integer(dev_t
, dev
, bh
->b_bdev
->bd_dev
)
135 ctf_integer(sector_t
, sector
, bh
->b_blocknr
)
136 ctf_integer(size_t, size
, bh
->b_size
)
141 * block_touch_buffer - mark a buffer accessed
142 * @bh: buffer_head being touched
144 * Called from touch_buffer().
146 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_touch_buffer
,
148 TP_PROTO(struct buffer_head
*bh
),
154 * block_dirty_buffer - mark a buffer dirty
155 * @bh: buffer_head being dirtied
157 * Called from mark_buffer_dirty().
159 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_dirty_buffer
,
161 TP_PROTO(struct buffer_head
*bh
),
167 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
169 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
175 unsigned int nr_sector
;
181 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
182 tp_locvar
->sector
= 0;
183 tp_locvar
->nr_sector
= 0;
184 tp_locvar
->cmd
= rq
->cmd
;
185 tp_locvar
->cmd_len
= rq
->cmd_len
;
187 tp_locvar
->sector
= blk_rq_pos(rq
);
188 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
189 tp_locvar
->cmd
= NULL
;
190 tp_locvar
->cmd_len
= 0;
195 ctf_integer(dev_t
, dev
,
196 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
197 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
198 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
199 ctf_integer(int, errors
, rq
->errors
)
200 blk_rwbs_ctf_integer(unsigned int, rwbs
,
201 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
202 ctf_sequence_hex(unsigned char, cmd
,
203 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
210 * block_rq_abort - abort block operation request
211 * @q: queue containing the block operation request
212 * @rq: block IO operation request
214 * Called immediately after pending block IO operation request @rq in
215 * queue @q is aborted. The fields in the operation request @rq
216 * can be examined to determine which device and sectors the pending
217 * operation would access.
219 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_abort
,
221 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
227 * block_rq_requeue - place block IO request back on a queue
228 * @q: queue holding operation
229 * @rq: block IO operation request
231 * The block operation request @rq is being placed back into queue
232 * @q. For some reason the request was not completed and needs to be
233 * put back in the queue.
235 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_requeue
,
237 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
242 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,5) \
243 || LTTNG_KERNEL_RANGE(3,12,21, 3,13,0) \
244 || LTTNG_KERNEL_RANGE(3,10,41, 3,11,0) \
245 || LTTNG_KERNEL_RANGE(3,4,91, 3,5,0) \
246 || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0) \
247 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,28, 3,14,0,0) \
248 || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0))
251 * block_rq_complete - block IO operation completed by device driver
252 * @q: queue containing the block operation request
253 * @rq: block operations request
254 * @nr_bytes: number of completed bytes
256 * The block_rq_complete tracepoint event indicates that some portion
257 * of operation request has been completed by the device driver. If
258 * the @rq->bio is %NULL, then there is absolutely no additional work to
259 * do for the request. If @rq->bio is non-NULL then there is
260 * additional work required to complete the request.
262 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
264 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
265 unsigned int nr_bytes
),
267 TP_ARGS(q
, rq
, nr_bytes
),
275 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
276 tp_locvar
->cmd
= rq
->cmd
;
277 tp_locvar
->cmd_len
= rq
->cmd_len
;
279 tp_locvar
->cmd
= NULL
;
280 tp_locvar
->cmd_len
= 0;
285 ctf_integer(dev_t
, dev
,
286 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
287 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
288 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
289 ctf_integer(int, errors
, rq
->errors
)
290 blk_rwbs_ctf_integer(unsigned int, rwbs
,
291 lttng_req_op(rq
), lttng_req_rw(rq
), nr_bytes
)
292 ctf_sequence_hex(unsigned char, cmd
,
293 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
299 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
302 * block_rq_complete - block IO operation completed by device driver
303 * @q: queue containing the block operation request
304 * @rq: block operations request
306 * The block_rq_complete tracepoint event indicates that some portion
307 * of operation request has been completed by the device driver. If
308 * the @rq->bio is %NULL, then there is absolutely no additional work to
309 * do for the request. If @rq->bio is non-NULL then there is
310 * additional work required to complete the request.
312 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_complete
,
314 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
319 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
321 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
323 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
329 unsigned int nr_sector
;
336 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
337 tp_locvar
->sector
= 0;
338 tp_locvar
->nr_sector
= 0;
339 tp_locvar
->bytes
= blk_rq_bytes(rq
);
340 tp_locvar
->cmd
= rq
->cmd
;
341 tp_locvar
->cmd_len
= rq
->cmd_len
;
343 tp_locvar
->sector
= blk_rq_pos(rq
);
344 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
345 tp_locvar
->bytes
= 0;
346 tp_locvar
->cmd
= NULL
;
347 tp_locvar
->cmd_len
= 0;
352 ctf_integer(dev_t
, dev
,
353 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
354 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
355 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
356 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
357 ctf_integer(pid_t
, tid
, current
->pid
)
358 blk_rwbs_ctf_integer(unsigned int, rwbs
,
359 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
360 ctf_sequence_hex(unsigned char, cmd
,
361 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
362 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
369 * block_rq_insert - insert block operation request into queue
371 * @rq: block IO operation request
373 * Called immediately before block operation request @rq is inserted
374 * into queue @q. The fields in the operation request @rq struct can
375 * be examined to determine which device and sectors the pending
376 * operation would access.
378 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
380 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
386 * block_rq_issue - issue pending block IO request operation to device driver
387 * @q: queue holding operation
388 * @rq: block IO operation operation request
390 * Called when block operation request @rq from queue @q is sent to a
391 * device driver for processing.
393 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
395 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
401 * block_bio_bounce - used bounce buffer when processing block operation
402 * @q: queue holding the block operation
403 * @bio: block operation
405 * A bounce buffer was used to handle the block operation @bio in @q.
406 * This occurs when hardware limitations prevent a direct transfer of
407 * data between the @bio data memory area and the IO device. Use of a
408 * bounce buffer requires extra copying of data and decreases
411 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
413 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
418 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
419 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
420 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
421 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
422 blk_rwbs_ctf_integer(unsigned int, rwbs
,
423 lttng_bio_op(bio
), lttng_bio_rw(bio
),
424 bio
->bi_iter
.bi_size
)
425 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
426 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
427 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
428 blk_rwbs_ctf_integer(unsigned int, rwbs
,
429 lttng_bio_op(bio
), lttng_bio_rw(bio
),
431 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
432 ctf_integer(pid_t
, tid
, current
->pid
)
433 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
438 * block_bio_complete - completed all work on the block operation
439 * @q: queue holding the block operation
440 * @bio: block operation completed
441 * @error: io error value
443 * This tracepoint indicates there is no further work to do on this
444 * block IO operation @bio.
446 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
448 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
449 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
451 TP_ARGS(q
, bio
, error
),
453 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
459 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
460 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
461 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
462 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
463 ctf_integer(int, error
, error
)
464 blk_rwbs_ctf_integer(unsigned int, rwbs
,
465 lttng_bio_op(bio
), lttng_bio_rw(bio
),
466 bio
->bi_iter
.bi_size
)
467 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
468 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
469 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
470 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
471 ctf_integer(int, error
, error
)
473 ctf_integer(int, error
, 0)
475 blk_rwbs_ctf_integer(unsigned int, rwbs
,
476 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
477 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
481 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
482 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
484 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
489 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
490 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
491 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
492 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
493 blk_rwbs_ctf_integer(unsigned int, rwbs
,
494 lttng_bio_op(bio
), lttng_bio_rw(bio
),
495 bio
->bi_iter
.bi_size
)
496 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
497 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
498 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
499 blk_rwbs_ctf_integer(unsigned int, rwbs
,
500 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
501 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
502 ctf_integer(pid_t
, tid
, current
->pid
)
503 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
508 * block_bio_backmerge - merging block operation to the end of an existing operation
509 * @q: queue holding operation
510 * @bio: new block operation to merge
512 * Merging block request @bio to the end of an existing block request
515 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_backmerge
,
517 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
523 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
524 * @q: queue holding operation
525 * @bio: new block operation to merge
527 * Merging block IO operation @bio to the beginning of an existing block
528 * operation in queue @q.
530 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_frontmerge
,
532 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
538 * block_bio_queue - putting new block IO operation in queue
539 * @q: queue holding operation
540 * @bio: new block operation
542 * About to place the block IO operation @bio into queue @q.
544 LTTNG_TRACEPOINT_EVENT(block_bio_queue
,
546 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
551 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
552 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
553 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
554 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
555 blk_rwbs_ctf_integer(unsigned int, rwbs
,
556 lttng_bio_op(bio
), lttng_bio_rw(bio
),
557 bio
->bi_iter
.bi_size
)
558 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
559 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
560 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
561 blk_rwbs_ctf_integer(unsigned int, rwbs
,
562 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
563 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
564 ctf_integer(pid_t
, tid
, current
->pid
)
565 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
568 #else /* if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
569 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
571 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
576 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
577 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
578 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
579 blk_rwbs_ctf_integer(unsigned int, rwbs
,
580 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
581 ctf_integer(pid_t
, tid
, current
->pid
)
582 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
587 * block_bio_backmerge - merging block operation to the end of an existing operation
588 * @q: queue holding operation
589 * @bio: new block operation to merge
591 * Merging block request @bio to the end of an existing block request
594 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
596 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
602 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
603 * @q: queue holding operation
604 * @bio: new block operation to merge
606 * Merging block IO operation @bio to the beginning of an existing block
607 * operation in queue @q.
609 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
611 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
617 * block_bio_queue - putting new block IO operation in queue
618 * @q: queue holding operation
619 * @bio: new block operation
621 * About to place the block IO operation @bio into queue @q.
623 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
625 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
629 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
631 LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq
,
633 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
638 ctf_integer(dev_t
, dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
639 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
640 ctf_integer(sector_t
, sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
641 ctf_integer(unsigned int, nr_sector
,
642 bio
? bio_sectors(bio
) : 0)
643 blk_rwbs_ctf_integer(unsigned int, rwbs
,
644 bio
? lttng_bio_op(bio
) : 0,
645 bio
? lttng_bio_rw(bio
) : 0,
646 bio
? bio
->bi_iter
.bi_size
: 0)
647 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
648 ctf_integer(sector_t
, sector
, bio
? bio
->bi_sector
: 0)
649 ctf_integer(unsigned int, nr_sector
,
650 bio
? bio
->bi_size
>> 9 : 0)
651 blk_rwbs_ctf_integer(unsigned int, rwbs
,
652 bio
? lttng_bio_op(bio
) : 0,
653 bio
? lttng_bio_rw(bio
) : 0,
654 bio
? bio
->bi_size
: 0)
655 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
656 ctf_integer(pid_t
, tid
, current
->pid
)
657 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
662 * block_getrq - get a free request entry in queue for block IO operations
663 * @q: queue for operations
664 * @bio: pending block IO operation
665 * @rw: low bit indicates a read (%0) or a write (%1)
667 * A request struct for queue @q has been allocated to handle the
668 * block IO operation @bio.
670 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_getrq
,
672 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
678 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
679 * @q: queue for operation
680 * @bio: pending block IO operation
681 * @rw: low bit indicates a read (%0) or a write (%1)
683 * In the case where a request struct cannot be provided for queue @q
684 * the process needs to wait for an request struct to become
685 * available. This tracepoint event is generated each time the
686 * process goes to sleep waiting for request struct become available.
688 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_sleeprq
,
690 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
696 * block_plug - keep operations requests in request queue
697 * @q: request queue to plug
699 * Plug the request queue @q. Do not allow block operation requests
700 * to be sent to the device driver. Instead, accumulate requests in
701 * the queue to improve throughput performance of the block device.
703 LTTNG_TRACEPOINT_EVENT(block_plug
,
705 TP_PROTO(struct request_queue
*q
),
710 ctf_integer(pid_t
, tid
, current
->pid
)
711 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
715 LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug
,
717 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
718 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
720 TP_ARGS(q
, depth
, explicit),
722 TP_PROTO(struct request_queue
*q
),
728 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
729 ctf_integer(int, nr_rq
, depth
)
731 ctf_integer(int, nr_rq
, q
->rq
.count
[READ
] + q
->rq
.count
[WRITE
])
733 ctf_integer(pid_t
, tid
, current
->pid
)
734 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
738 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
740 * block_unplug_timer - timed release of operations requests in queue to device driver
741 * @q: request queue to unplug
743 * Unplug the request queue @q because a timer expired and allow block
744 * operation requests to be sent to the device driver.
746 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_timer
,
748 TP_PROTO(struct request_queue
*q
),
755 * block_unplug - release of operations requests in request queue
756 * @q: request queue to unplug
757 * @depth: number of requests just added to the queue
758 * @explicit: whether this was an explicit unplug, or one from schedule()
760 * Unplug request queue @q because device driver is scheduled to work
761 * on elements in the request queue.
763 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
764 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug
,
766 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_io
,
769 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
770 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
772 TP_ARGS(q
, depth
, explicit)
774 TP_PROTO(struct request_queue
*q
),
781 * block_split - split a single bio struct into two bio structs
782 * @q: queue containing the bio
783 * @bio: block operation being split
784 * @new_sector: The starting sector for the new bio
786 * The bio request @bio in request queue @q needs to be split into two
787 * bio requests. The newly created @bio request starts at
788 * @new_sector. This split may be required due to hardware limitation
789 * such as operation crossing device boundaries in a RAID system.
791 LTTNG_TRACEPOINT_EVENT(block_split
,
793 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
794 unsigned int new_sector
),
796 TP_ARGS(q
, bio
, new_sector
),
799 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
800 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
801 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
802 blk_rwbs_ctf_integer(unsigned int, rwbs
,
803 lttng_bio_op(bio
), lttng_bio_rw(bio
),
804 bio
->bi_iter
.bi_size
)
805 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
806 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
807 blk_rwbs_ctf_integer(unsigned int, rwbs
,
808 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
809 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
810 ctf_integer(sector_t
, new_sector
, new_sector
)
811 ctf_integer(pid_t
, tid
, current
->pid
)
812 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
817 * block_bio_remap - map request for a logical device to the raw device
818 * @q: queue holding the operation
819 * @bio: revised operation
820 * @dev: device for the operation
821 * @from: original sector for the operation
823 * An operation for a logical device has been mapped to the
826 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
827 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
829 LTTNG_TRACEPOINT_EVENT(block_remap
,
832 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
835 TP_ARGS(q
, bio
, dev
, from
),
838 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
839 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
840 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
841 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
842 blk_rwbs_ctf_integer(unsigned int, rwbs
,
843 lttng_bio_op(bio
), lttng_bio_rw(bio
),
844 bio
->bi_iter
.bi_size
)
845 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
846 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
847 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
848 blk_rwbs_ctf_integer(unsigned int, rwbs
,
849 lttng_bio_op(bio
), lttng_bio_rw(bio
), bio
->bi_size
)
850 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
851 ctf_integer(dev_t
, old_dev
, dev
)
852 ctf_integer(sector_t
, old_sector
, from
)
856 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
858 * block_rq_remap - map request for a block operation request
859 * @q: queue holding the operation
860 * @rq: block IO operation request
861 * @dev: device for the operation
862 * @from: original sector for the operation
864 * The block operation request @rq in @q has been remapped. The block
865 * operation request @rq holds the current information and @from hold
866 * the original sector.
868 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
870 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
873 TP_ARGS(q
, rq
, dev
, from
),
876 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
877 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
878 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
879 ctf_integer(dev_t
, old_dev
, dev
)
880 ctf_integer(sector_t
, old_sector
, from
)
881 blk_rwbs_ctf_integer(unsigned int, rwbs
,
882 lttng_req_op(rq
), lttng_req_rw(rq
), blk_rq_bytes(rq
))
887 #undef __print_rwbs_flags
890 #endif /* LTTNG_TRACE_BLOCK_H */
892 /* This part must be outside protection */
893 #include <probes/define_trace.h>
This page took 0.050386 seconds and 4 git commands to generate.