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),
29 #endif /* _TRACE_BLOCK_DEF_ */
31 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
33 #define blk_rwbs_ctf_integer(type, rwbs, rw, bytes) \
34 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
35 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
36 ( (bytes) ? RWBS_FLAG_READ : \
38 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
39 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
40 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
41 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \
42 | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \
43 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
45 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
47 #define blk_rwbs_ctf_integer(type, rwbs, rw, bytes) \
48 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
49 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
50 ( (bytes) ? RWBS_FLAG_READ : \
52 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
53 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
54 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
55 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
57 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
59 #define blk_rwbs_ctf_integer(type, rwbs, rw, bytes) \
60 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
61 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
62 ( (bytes) ? RWBS_FLAG_READ : \
64 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
65 | ((rw) & REQ_HARDBARRIER ? RWBS_FLAG_BARRIER : 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))
72 #define blk_rwbs_ctf_integer(type, rwbs, rw, bytes) \
73 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
74 ( (rw) & (1 << BIO_RW_DISCARD) ? RWBS_FLAG_DISCARD : \
75 ( (bytes) ? RWBS_FLAG_READ : \
77 | ((rw) & (1 << BIO_RW_AHEAD) ? RWBS_FLAG_RAHEAD : 0) \
78 | ((rw) & (1 << BIO_RW_SYNCIO) ? RWBS_FLAG_SYNC : 0) \
79 | ((rw) & (1 << BIO_RW_META) ? RWBS_FLAG_META : 0) \
80 | ((rw) & (1 << BIO_RW_BARRIER) ? RWBS_FLAG_BARRIER : 0))
84 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
85 LTTNG_TRACEPOINT_EVENT_CLASS(block_buffer
,
87 TP_PROTO(struct buffer_head
*bh
),
92 ctf_integer(dev_t
, dev
, bh
->b_bdev
->bd_dev
)
93 ctf_integer(sector_t
, sector
, bh
->b_blocknr
)
94 ctf_integer(size_t, size
, bh
->b_size
)
99 * block_touch_buffer - mark a buffer accessed
100 * @bh: buffer_head being touched
102 * Called from touch_buffer().
104 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_touch_buffer
,
106 TP_PROTO(struct buffer_head
*bh
),
112 * block_dirty_buffer - mark a buffer dirty
113 * @bh: buffer_head being dirtied
115 * Called from mark_buffer_dirty().
117 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_dirty_buffer
,
119 TP_PROTO(struct buffer_head
*bh
),
125 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error
,
127 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
133 unsigned int nr_sector
;
139 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
140 tp_locvar
->sector
= 0;
141 tp_locvar
->nr_sector
= 0;
142 tp_locvar
->cmd
= rq
->cmd
;
143 tp_locvar
->cmd_len
= rq
->cmd_len
;
145 tp_locvar
->sector
= blk_rq_pos(rq
);
146 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
147 tp_locvar
->cmd
= NULL
;
148 tp_locvar
->cmd_len
= 0;
153 ctf_integer(dev_t
, dev
,
154 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
155 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
156 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
157 ctf_integer(int, errors
, rq
->errors
)
158 blk_rwbs_ctf_integer(unsigned int, rwbs
,
159 rq
->cmd_flags
, blk_rq_bytes(rq
))
160 ctf_sequence_hex(unsigned char, cmd
,
161 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
166 * block_rq_abort - abort block operation request
167 * @q: queue containing the block operation request
168 * @rq: block IO operation request
170 * Called immediately after pending block IO operation request @rq in
171 * queue @q is aborted. The fields in the operation request @rq
172 * can be examined to determine which device and sectors the pending
173 * operation would access.
175 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_abort
,
177 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
183 * block_rq_requeue - place block IO request back on a queue
184 * @q: queue holding operation
185 * @rq: block IO operation request
187 * The block operation request @rq is being placed back into queue
188 * @q. For some reason the request was not completed and needs to be
189 * put back in the queue.
191 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_requeue
,
193 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
198 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,5) \
199 || LTTNG_KERNEL_RANGE(3,12,21, 3,13,0) \
200 || LTTNG_KERNEL_RANGE(3,10,41, 3,11,0) \
201 || LTTNG_KERNEL_RANGE(3,4,91, 3,5,0) \
202 || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0) \
203 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,31, 3,14,0,0))
206 * block_rq_complete - block IO operation completed by device driver
207 * @q: queue containing the block operation request
208 * @rq: block operations request
209 * @nr_bytes: number of completed bytes
211 * The block_rq_complete tracepoint event indicates that some portion
212 * of operation request has been completed by the device driver. If
213 * the @rq->bio is %NULL, then there is absolutely no additional work to
214 * do for the request. If @rq->bio is non-NULL then there is
215 * additional work required to complete the request.
217 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete
,
219 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
220 unsigned int nr_bytes
),
222 TP_ARGS(q
, rq
, nr_bytes
),
230 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
231 tp_locvar
->cmd
= rq
->cmd
;
232 tp_locvar
->cmd_len
= rq
->cmd_len
;
234 tp_locvar
->cmd
= NULL
;
235 tp_locvar
->cmd_len
= 0;
240 ctf_integer(dev_t
, dev
,
241 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
242 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
243 ctf_integer(unsigned int, nr_sector
, nr_bytes
>> 9)
244 ctf_integer(int, errors
, rq
->errors
)
245 blk_rwbs_ctf_integer(unsigned int, rwbs
,
246 rq
->cmd_flags
, nr_bytes
)
247 ctf_sequence_hex(unsigned char, cmd
,
248 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
252 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
255 * block_rq_complete - block IO operation completed by device driver
256 * @q: queue containing the block operation request
257 * @rq: block operations request
259 * The block_rq_complete tracepoint event indicates that some portion
260 * of operation request has been completed by the device driver. If
261 * the @rq->bio is %NULL, then there is absolutely no additional work to
262 * do for the request. If @rq->bio is non-NULL then there is
263 * additional work required to complete the request.
265 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_complete
,
267 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
272 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
274 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq
,
276 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
282 unsigned int nr_sector
;
289 if (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) {
290 tp_locvar
->sector
= 0;
291 tp_locvar
->nr_sector
= 0;
292 tp_locvar
->bytes
= blk_rq_bytes(rq
);
293 tp_locvar
->cmd
= rq
->cmd
;
294 tp_locvar
->cmd_len
= rq
->cmd_len
;
296 tp_locvar
->sector
= blk_rq_pos(rq
);
297 tp_locvar
->nr_sector
= blk_rq_sectors(rq
);
298 tp_locvar
->bytes
= 0;
299 tp_locvar
->cmd
= NULL
;
300 tp_locvar
->cmd_len
= 0;
305 ctf_integer(dev_t
, dev
,
306 rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
307 ctf_integer(sector_t
, sector
, tp_locvar
->sector
)
308 ctf_integer(unsigned int, nr_sector
, tp_locvar
->nr_sector
)
309 ctf_integer(unsigned int, bytes
, tp_locvar
->bytes
)
310 ctf_integer(pid_t
, tid
, current
->pid
)
311 blk_rwbs_ctf_integer(unsigned int, rwbs
,
312 rq
->cmd_flags
, blk_rq_bytes(rq
))
313 ctf_sequence_hex(unsigned char, cmd
,
314 tp_locvar
->cmd
, size_t, tp_locvar
->cmd_len
)
315 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
320 * block_rq_insert - insert block operation request into queue
322 * @rq: block IO operation request
324 * Called immediately before block operation request @rq is inserted
325 * into queue @q. The fields in the operation request @rq struct can
326 * be examined to determine which device and sectors the pending
327 * operation would access.
329 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
331 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
337 * block_rq_issue - issue pending block IO request operation to device driver
338 * @q: queue holding operation
339 * @rq: block IO operation operation request
341 * Called when block operation request @rq from queue @q is sent to a
342 * device driver for processing.
344 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
346 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
352 * block_bio_bounce - used bounce buffer when processing block operation
353 * @q: queue holding the block operation
354 * @bio: block operation
356 * A bounce buffer was used to handle the block operation @bio in @q.
357 * This occurs when hardware limitations prevent a direct transfer of
358 * data between the @bio data memory area and the IO device. Use of a
359 * bounce buffer requires extra copying of data and decreases
362 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
364 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
369 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
370 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
371 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
372 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
373 blk_rwbs_ctf_integer(unsigned int, rwbs
,
374 bio
->bi_rw
, bio
->bi_iter
.bi_size
)
375 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
376 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
377 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
378 blk_rwbs_ctf_integer(unsigned int, rwbs
,
379 bio
->bi_rw
, bio
->bi_size
)
380 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
381 ctf_integer(pid_t
, tid
, current
->pid
)
382 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
387 * block_bio_complete - completed all work on the block operation
388 * @q: queue holding the block operation
389 * @bio: block operation completed
390 * @error: io error value
392 * This tracepoint indicates there is no further work to do on this
393 * block IO operation @bio.
395 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
397 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
398 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
400 TP_ARGS(q
, bio
, error
),
402 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
408 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
409 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
410 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
411 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
412 ctf_integer(int, error
, error
)
413 blk_rwbs_ctf_integer(unsigned int, rwbs
,
414 bio
->bi_rw
, bio
->bi_iter
.bi_size
)
415 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
416 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
417 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
418 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
419 ctf_integer(int, error
, error
)
421 ctf_integer(int, error
, 0)
423 blk_rwbs_ctf_integer(unsigned int, rwbs
,
424 bio
->bi_rw
, bio
->bi_size
)
425 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
429 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
430 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
432 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
437 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
438 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
439 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
440 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
441 blk_rwbs_ctf_integer(unsigned int, rwbs
,
442 bio
->bi_rw
, bio
->bi_iter
.bi_size
)
443 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
444 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
445 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
446 blk_rwbs_ctf_integer(unsigned int, rwbs
,
447 bio
->bi_rw
, bio
->bi_size
)
448 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
449 ctf_integer(pid_t
, tid
, current
->pid
)
450 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
455 * block_bio_backmerge - merging block operation to the end of an existing operation
456 * @q: queue holding operation
457 * @bio: new block operation to merge
459 * Merging block request @bio to the end of an existing block request
462 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_backmerge
,
464 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
470 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
471 * @q: queue holding operation
472 * @bio: new block operation to merge
474 * Merging block IO operation @bio to the beginning of an existing block
475 * operation in queue @q.
477 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_frontmerge
,
479 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
485 * block_bio_queue - putting new block IO operation in queue
486 * @q: queue holding operation
487 * @bio: new block operation
489 * About to place the block IO operation @bio into queue @q.
491 LTTNG_TRACEPOINT_EVENT(block_bio_queue
,
493 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
498 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
499 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
500 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
501 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
502 blk_rwbs_ctf_integer(unsigned int, rwbs
,
503 bio
->bi_rw
, bio
->bi_iter
.bi_size
)
504 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
505 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
506 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
507 blk_rwbs_ctf_integer(unsigned int, rwbs
,
508 bio
->bi_rw
, bio
->bi_size
)
509 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
510 ctf_integer(pid_t
, tid
, current
->pid
)
511 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
514 #else /* if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
515 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
517 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
522 ctf_integer(dev_t
, dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
523 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
524 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
525 blk_rwbs_ctf_integer(unsigned int, rwbs
,
526 bio
->bi_rw
, bio
->bi_size
)
527 ctf_integer(pid_t
, tid
, current
->pid
)
528 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
533 * block_bio_backmerge - merging block operation to the end of an existing operation
534 * @q: queue holding operation
535 * @bio: new block operation to merge
537 * Merging block request @bio to the end of an existing block request
540 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
542 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
548 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
549 * @q: queue holding operation
550 * @bio: new block operation to merge
552 * Merging block IO operation @bio to the beginning of an existing block
553 * operation in queue @q.
555 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
557 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
563 * block_bio_queue - putting new block IO operation in queue
564 * @q: queue holding operation
565 * @bio: new block operation
567 * About to place the block IO operation @bio into queue @q.
569 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
571 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
575 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
577 LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq
,
579 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
584 ctf_integer(dev_t
, dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
585 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
586 ctf_integer(sector_t
, sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
587 ctf_integer(unsigned int, nr_sector
,
588 bio
? bio_sectors(bio
) : 0)
589 blk_rwbs_ctf_integer(unsigned int, rwbs
,
590 bio
? bio
->bi_rw
: 0,
591 bio
? bio
->bi_iter
.bi_size
: 0)
592 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
593 ctf_integer(sector_t
, sector
, bio
? bio
->bi_sector
: 0)
594 ctf_integer(unsigned int, nr_sector
,
595 bio
? bio
->bi_size
>> 9 : 0)
596 blk_rwbs_ctf_integer(unsigned int, rwbs
,
597 bio
? bio
->bi_rw
: 0,
598 bio
? bio
->bi_size
: 0)
599 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
600 ctf_integer(pid_t
, tid
, current
->pid
)
601 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
606 * block_getrq - get a free request entry in queue for block IO operations
607 * @q: queue for operations
608 * @bio: pending block IO operation
609 * @rw: low bit indicates a read (%0) or a write (%1)
611 * A request struct for queue @q has been allocated to handle the
612 * block IO operation @bio.
614 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_getrq
,
616 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
622 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
623 * @q: queue for operation
624 * @bio: pending block IO operation
625 * @rw: low bit indicates a read (%0) or a write (%1)
627 * In the case where a request struct cannot be provided for queue @q
628 * the process needs to wait for an request struct to become
629 * available. This tracepoint event is generated each time the
630 * process goes to sleep waiting for request struct become available.
632 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_sleeprq
,
634 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
640 * block_plug - keep operations requests in request queue
641 * @q: request queue to plug
643 * Plug the request queue @q. Do not allow block operation requests
644 * to be sent to the device driver. Instead, accumulate requests in
645 * the queue to improve throughput performance of the block device.
647 LTTNG_TRACEPOINT_EVENT(block_plug
,
649 TP_PROTO(struct request_queue
*q
),
654 ctf_integer(pid_t
, tid
, current
->pid
)
655 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
659 LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug
,
661 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
662 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
664 TP_ARGS(q
, depth
, explicit),
666 TP_PROTO(struct request_queue
*q
),
672 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
673 ctf_integer(int, nr_rq
, depth
)
675 ctf_integer(int, nr_rq
, q
->rq
.count
[READ
] + q
->rq
.count
[WRITE
])
677 ctf_integer(pid_t
, tid
, current
->pid
)
678 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
682 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
684 * block_unplug_timer - timed release of operations requests in queue to device driver
685 * @q: request queue to unplug
687 * Unplug the request queue @q because a timer expired and allow block
688 * operation requests to be sent to the device driver.
690 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_timer
,
692 TP_PROTO(struct request_queue
*q
),
699 * block_unplug - release of operations requests in request queue
700 * @q: request queue to unplug
701 * @depth: number of requests just added to the queue
702 * @explicit: whether this was an explicit unplug, or one from schedule()
704 * Unplug request queue @q because device driver is scheduled to work
705 * on elements in the request queue.
707 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
708 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug
,
710 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_io
,
713 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
714 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
716 TP_ARGS(q
, depth
, explicit)
718 TP_PROTO(struct request_queue
*q
),
725 * block_split - split a single bio struct into two bio structs
726 * @q: queue containing the bio
727 * @bio: block operation being split
728 * @new_sector: The starting sector for the new bio
730 * The bio request @bio in request queue @q needs to be split into two
731 * bio requests. The newly created @bio request starts at
732 * @new_sector. This split may be required due to hardware limitation
733 * such as operation crossing device boundaries in a RAID system.
735 LTTNG_TRACEPOINT_EVENT(block_split
,
737 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
738 unsigned int new_sector
),
740 TP_ARGS(q
, bio
, new_sector
),
743 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
744 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
745 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
746 blk_rwbs_ctf_integer(unsigned int, rwbs
,
747 bio
->bi_rw
, bio
->bi_iter
.bi_size
)
748 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
749 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
750 blk_rwbs_ctf_integer(unsigned int, rwbs
,
751 bio
->bi_rw
, bio
->bi_size
)
752 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
753 ctf_integer(sector_t
, new_sector
, new_sector
)
754 ctf_integer(pid_t
, tid
, current
->pid
)
755 ctf_array_text(char, comm
, current
->comm
, TASK_COMM_LEN
)
760 * block_bio_remap - map request for a logical device to the raw device
761 * @q: queue holding the operation
762 * @bio: revised operation
763 * @dev: device for the operation
764 * @from: original sector for the operation
766 * An operation for a logical device has been mapped to the
769 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
770 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
772 LTTNG_TRACEPOINT_EVENT(block_remap
,
775 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
778 TP_ARGS(q
, bio
, dev
, from
),
781 ctf_integer(dev_t
, dev
, bio
->bi_bdev
->bd_dev
)
782 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
783 ctf_integer(sector_t
, sector
, bio
->bi_iter
.bi_sector
)
784 ctf_integer(unsigned int, nr_sector
, bio_sectors(bio
))
785 blk_rwbs_ctf_integer(unsigned int, rwbs
,
786 bio
->bi_rw
, bio
->bi_iter
.bi_size
)
787 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
788 ctf_integer(sector_t
, sector
, bio
->bi_sector
)
789 ctf_integer(unsigned int, nr_sector
, bio
->bi_size
>> 9)
790 blk_rwbs_ctf_integer(unsigned int, rwbs
,
791 bio
->bi_rw
, bio
->bi_size
)
792 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
793 ctf_integer(dev_t
, old_dev
, dev
)
794 ctf_integer(sector_t
, old_sector
, from
)
798 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
800 * block_rq_remap - map request for a block operation request
801 * @q: queue holding the operation
802 * @rq: block IO operation request
803 * @dev: device for the operation
804 * @from: original sector for the operation
806 * The block operation request @rq in @q has been remapped. The block
807 * operation request @rq holds the current information and @from hold
808 * the original sector.
810 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
812 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
815 TP_ARGS(q
, rq
, dev
, from
),
818 ctf_integer(dev_t
, dev
, disk_devt(rq
->rq_disk
))
819 ctf_integer(sector_t
, sector
, blk_rq_pos(rq
))
820 ctf_integer(unsigned int, nr_sector
, blk_rq_sectors(rq
))
821 ctf_integer(dev_t
, old_dev
, dev
)
822 ctf_integer(sector_t
, old_sector
, from
)
823 blk_rwbs_ctf_integer(unsigned int, rwbs
,
824 rq
->cmd_flags
, blk_rq_bytes(rq
))
829 #undef __print_rwbs_flags
832 #endif /* LTTNG_TRACE_BLOCK_H */
834 /* This part must be outside protection */
835 #include "../../../probes/define_trace.h"
This page took 0.049158 seconds and 4 git commands to generate.