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>
15 #ifndef _TRACE_BLOCK_DEF_
16 #define _TRACE_BLOCK_DEF_
18 #define __blk_dump_cmd(cmd, len) "<unknown>"
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),
33 #endif /* _TRACE_BLOCK_DEF_ */
35 #define __print_rwbs_flags(rwbs) \
36 __print_flags(rwbs, "", \
37 { RWBS_FLAG_FLUSH, "F" }, \
38 { RWBS_FLAG_WRITE, "W" }, \
39 { RWBS_FLAG_DISCARD, "D" }, \
40 { RWBS_FLAG_READ, "R" }, \
41 { RWBS_FLAG_FUA, "F" }, \
42 { RWBS_FLAG_RAHEAD, "A" }, \
43 { RWBS_FLAG_BARRIER, "B" }, \
44 { RWBS_FLAG_SYNC, "S" }, \
45 { RWBS_FLAG_META, "M" }, \
46 { RWBS_FLAG_SECURE, "E" })
48 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
50 #define blk_fill_rwbs(rwbs, rw, bytes) \
51 tp_assign(rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
52 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
53 ( (bytes) ? RWBS_FLAG_READ : \
55 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
56 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
57 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
58 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \
59 | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \
60 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
62 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
64 #define blk_fill_rwbs(rwbs, rw, bytes) \
65 tp_assign(rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
66 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
67 ( (bytes) ? RWBS_FLAG_READ : \
69 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
70 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
71 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
72 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
74 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
76 #define blk_fill_rwbs(rwbs, rw, bytes) \
77 tp_assign(rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
78 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
79 ( (bytes) ? RWBS_FLAG_READ : \
81 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
82 | ((rw) & REQ_HARDBARRIER ? RWBS_FLAG_BARRIER : 0) \
83 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
84 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
85 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
89 #define blk_fill_rwbs(rwbs, rw, bytes) \
90 tp_assign(rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
91 ( (rw) & (1 << BIO_RW_DISCARD) ? RWBS_FLAG_DISCARD : \
92 ( (bytes) ? RWBS_FLAG_READ : \
94 | ((rw) & (1 << BIO_RW_AHEAD) ? RWBS_FLAG_RAHEAD : 0) \
95 | ((rw) & (1 << BIO_RW_SYNCIO) ? RWBS_FLAG_SYNC : 0) \
96 | ((rw) & (1 << BIO_RW_META) ? RWBS_FLAG_META : 0) \
97 | ((rw) & (1 << BIO_RW_BARRIER) ? RWBS_FLAG_BARRIER : 0))
101 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
102 LTTNG_TRACEPOINT_EVENT_CLASS(block_buffer
,
104 TP_PROTO(struct buffer_head
*bh
),
109 __field( dev_t
, dev
)
110 __field( sector_t
, sector
)
111 __field( size_t, size
)
115 tp_assign(dev
, bh
->b_bdev
->bd_dev
)
116 tp_assign(sector
, bh
->b_blocknr
)
117 tp_assign(size
, bh
->b_size
)
120 TP_printk("%d,%d sector=%llu size=%zu",
121 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
122 (unsigned long long)__entry
->sector
, __entry
->size
127 * block_touch_buffer - mark a buffer accessed
128 * @bh: buffer_head being touched
130 * Called from touch_buffer().
132 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_touch_buffer
,
134 TP_PROTO(struct buffer_head
*bh
),
140 * block_dirty_buffer - mark a buffer dirty
141 * @bh: buffer_head being dirtied
143 * Called from mark_buffer_dirty().
145 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer
, block_dirty_buffer
,
147 TP_PROTO(struct buffer_head
*bh
),
153 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq_with_error
,
155 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
160 __field( dev_t
, dev
)
161 __field( sector_t
, sector
)
162 __field( unsigned int, nr_sector
)
163 __field( int, errors
)
164 __field( unsigned int, rwbs
)
165 __dynamic_array_hex( unsigned char, cmd
,
166 (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
171 tp_assign(dev
, rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
172 tp_assign(sector
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
174 tp_assign(nr_sector
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
175 0 : blk_rq_sectors(rq
))
176 tp_assign(errors
, rq
->errors
)
177 blk_fill_rwbs(rwbs
, rq
->cmd_flags
, blk_rq_bytes(rq
))
178 tp_memcpy_dyn(cmd
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
182 TP_printk("%d,%d %s (%s) %llu + %u [%d]",
183 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
184 __print_rwbs_flags(__entry
->rwbs
),
185 __blk_dump_cmd(__get_dynamic_array(cmd
),
186 __get_dynamic_array_len(cmd
)),
187 (unsigned long long)__entry
->sector
,
188 __entry
->nr_sector
, __entry
->errors
)
192 * block_rq_abort - abort block operation request
193 * @q: queue containing the block operation request
194 * @rq: block IO operation request
196 * Called immediately after pending block IO operation request @rq in
197 * queue @q is aborted. The fields in the operation request @rq
198 * can be examined to determine which device and sectors the pending
199 * operation would access.
201 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_abort
,
203 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
209 * block_rq_requeue - place block IO request back on a queue
210 * @q: queue holding operation
211 * @rq: block IO operation request
213 * The block operation request @rq is being placed back into queue
214 * @q. For some reason the request was not completed and needs to be
215 * put back in the queue.
217 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_requeue
,
219 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
224 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,5) \
225 || LTTNG_KERNEL_RANGE(3,12,21, 3,13,0) \
226 || LTTNG_KERNEL_RANGE(3,10,41, 3,11,0) \
227 || LTTNG_KERNEL_RANGE(3,4,91, 3,5,0) \
228 || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0) \
229 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,31, 3,14,0,0))
232 * block_rq_complete - block IO operation completed by device driver
233 * @q: queue containing the block operation request
234 * @rq: block operations request
235 * @nr_bytes: number of completed bytes
237 * The block_rq_complete tracepoint event indicates that some portion
238 * of operation request has been completed by the device driver. If
239 * the @rq->bio is %NULL, then there is absolutely no additional work to
240 * do for the request. If @rq->bio is non-NULL then there is
241 * additional work required to complete the request.
243 LTTNG_TRACEPOINT_EVENT(block_rq_complete
,
245 TP_PROTO(struct request_queue
*q
, struct request
*rq
,
246 unsigned int nr_bytes
),
248 TP_ARGS(q
, rq
, nr_bytes
),
251 __field( dev_t
, dev
)
252 __field( sector_t
, sector
)
253 __field( unsigned int, nr_sector
)
254 __field( int, errors
)
255 __field( unsigned int, rwbs
)
256 __dynamic_array_hex( unsigned char, cmd
,
257 (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
262 tp_assign(dev
, rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
263 tp_assign(sector
, blk_rq_pos(rq
))
264 tp_assign(nr_sector
, nr_bytes
>> 9)
265 tp_assign(errors
, rq
->errors
)
266 blk_fill_rwbs(rwbs
, rq
->cmd_flags
, nr_bytes
)
267 tp_memcpy_dyn(cmd
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
271 TP_printk("%d,%d %s (%s) %llu + %u [%d]",
272 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
273 __entry
->rwbs
, __get_str(cmd
),
274 (unsigned long long)__entry
->sector
,
275 __entry
->nr_sector
, __entry
->errors
)
278 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
281 * block_rq_complete - block IO operation completed by device driver
282 * @q: queue containing the block operation request
283 * @rq: block operations request
285 * The block_rq_complete tracepoint event indicates that some portion
286 * of operation request has been completed by the device driver. If
287 * the @rq->bio is %NULL, then there is absolutely no additional work to
288 * do for the request. If @rq->bio is non-NULL then there is
289 * additional work required to complete the request.
291 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error
, block_rq_complete
,
293 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
298 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
300 LTTNG_TRACEPOINT_EVENT_CLASS(block_rq
,
302 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
307 __field( dev_t
, dev
)
308 __field( sector_t
, sector
)
309 __field( unsigned int, nr_sector
)
310 __field( unsigned int, bytes
)
311 __field( unsigned int, rwbs
)
312 __field( pid_t
, tid
)
313 __array_text( char, comm
, TASK_COMM_LEN
)
314 __dynamic_array_hex( unsigned char, cmd
,
315 (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
320 tp_assign(dev
, rq
->rq_disk
? disk_devt(rq
->rq_disk
) : 0)
321 tp_assign(sector
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
323 tp_assign(nr_sector
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
324 0 : blk_rq_sectors(rq
))
325 tp_assign(bytes
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
326 blk_rq_bytes(rq
) : 0)
327 blk_fill_rwbs(rwbs
, rq
->cmd_flags
, blk_rq_bytes(rq
))
328 tp_memcpy_dyn(cmd
, (rq
->cmd_type
== REQ_TYPE_BLOCK_PC
) ?
330 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
331 tp_assign(tid
, current
->pid
)
334 TP_printk("%d,%d %s %u (%s) %llu + %u [%s] %d",
335 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
336 __print_rwbs_flags(__entry
->rwbs
),
338 __blk_dump_cmd(__get_dynamic_array(cmd
),
339 __get_dynamic_array_len(cmd
)),
340 (unsigned long long)__entry
->sector
,
341 __entry
->nr_sector
, __entry
->comm
, __entry
->tid
)
345 * block_rq_insert - insert block operation request into queue
347 * @rq: block IO operation request
349 * Called immediately before block operation request @rq is inserted
350 * into queue @q. The fields in the operation request @rq struct can
351 * be examined to determine which device and sectors the pending
352 * operation would access.
354 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_insert
,
356 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
362 * block_rq_issue - issue pending block IO request operation to device driver
363 * @q: queue holding operation
364 * @rq: block IO operation operation request
366 * Called when block operation request @rq from queue @q is sent to a
367 * device driver for processing.
369 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq
, block_rq_issue
,
371 TP_PROTO(struct request_queue
*q
, struct request
*rq
),
377 * block_bio_bounce - used bounce buffer when processing block operation
378 * @q: queue holding the block operation
379 * @bio: block operation
381 * A bounce buffer was used to handle the block operation @bio in @q.
382 * This occurs when hardware limitations prevent a direct transfer of
383 * data between the @bio data memory area and the IO device. Use of a
384 * bounce buffer requires extra copying of data and decreases
387 LTTNG_TRACEPOINT_EVENT(block_bio_bounce
,
389 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
394 __field( dev_t
, dev
)
395 __field( sector_t
, sector
)
396 __field( unsigned int, nr_sector
)
397 __field( unsigned int, rwbs
)
398 __field( pid_t
, tid
)
399 __array_text( char, comm
, TASK_COMM_LEN
)
403 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
404 tp_assign(dev
, bio
->bi_bdev
?
405 bio
->bi_bdev
->bd_dev
: 0)
406 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
407 tp_assign(nr_sector
, bio_sectors(bio
))
408 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
409 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
410 tp_assign(tid
, current
->pid
)
411 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
412 tp_assign(dev
, bio
->bi_bdev
?
413 bio
->bi_bdev
->bd_dev
: 0)
414 tp_assign(sector
, bio
->bi_sector
)
415 tp_assign(nr_sector
, bio
->bi_size
>> 9)
416 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
417 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
418 tp_assign(tid
, current
->pid
)
419 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
422 TP_printk("%d,%d %s %llu + %u [%s] %d",
423 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
424 __print_rwbs_flags(__entry
->rwbs
),
425 (unsigned long long)__entry
->sector
,
426 __entry
->nr_sector
, __entry
->comm
, __entry
->tid
)
430 * block_bio_complete - completed all work on the block operation
431 * @q: queue holding the block operation
432 * @bio: block operation completed
433 * @error: io error value
435 * This tracepoint indicates there is no further work to do on this
436 * block IO operation @bio.
438 LTTNG_TRACEPOINT_EVENT(block_bio_complete
,
440 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
441 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int error
),
443 TP_ARGS(q
, bio
, error
),
445 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
451 __field( dev_t
, dev
)
452 __field( sector_t
, sector
)
453 __field( unsigned, nr_sector
)
454 __field( int, error
)
455 __field( unsigned int, rwbs
)
459 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
460 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
461 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
462 tp_assign(nr_sector
, bio_sectors(bio
))
463 tp_assign(error
, error
)
464 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
465 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
466 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
467 tp_assign(sector
, bio
->bi_sector
)
468 tp_assign(nr_sector
, bio
->bi_size
>> 9)
469 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
470 tp_assign(error
, error
)
474 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
475 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
478 TP_printk("%d,%d %s %llu + %u [%d]",
479 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
480 __print_rwbs_flags(__entry
->rwbs
),
481 (unsigned long long)__entry
->sector
,
482 __entry
->nr_sector
, __entry
->error
)
485 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
486 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge
,
488 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
493 __field( dev_t
, dev
)
494 __field( sector_t
, sector
)
495 __field( unsigned int, nr_sector
)
496 __field( unsigned int, rwbs
)
497 __field( pid_t
, tid
)
498 __array_text( char, comm
, TASK_COMM_LEN
)
502 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
503 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
504 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
505 tp_assign(nr_sector
, bio_sectors(bio
))
506 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
507 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
508 tp_assign(tid
, current
->pid
)
509 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
510 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
511 tp_assign(sector
, bio
->bi_sector
)
512 tp_assign(nr_sector
, bio
->bi_size
>> 9)
513 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
514 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
515 tp_assign(tid
, current
->pid
)
516 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
519 TP_printk("%d,%d %s %llu + %u [%s] %d",
520 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
521 __print_rwbs_flags(__entry
->rwbs
),
522 (unsigned long long)__entry
->sector
,
523 __entry
->nr_sector
, __entry
->comm
, __entry
->tid
)
527 * block_bio_backmerge - merging block operation to the end of an existing operation
528 * @q: queue holding operation
529 * @bio: new block operation to merge
531 * Merging block request @bio to the end of an existing block request
534 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_backmerge
,
536 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
542 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
543 * @q: queue holding operation
544 * @bio: new block operation to merge
546 * Merging block IO operation @bio to the beginning of an existing block
547 * operation in queue @q.
549 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge
, block_bio_frontmerge
,
551 TP_PROTO(struct request_queue
*q
, struct request
*rq
, struct bio
*bio
),
557 * block_bio_queue - putting new block IO operation in queue
558 * @q: queue holding operation
559 * @bio: new block operation
561 * About to place the block IO operation @bio into queue @q.
563 LTTNG_TRACEPOINT_EVENT(block_bio_queue
,
565 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
570 __field( dev_t
, dev
)
571 __field( sector_t
, sector
)
572 __field( unsigned int, nr_sector
)
573 __field( unsigned int, rwbs
)
574 __field( pid_t
, tid
)
575 __array_text( char, comm
, TASK_COMM_LEN
)
579 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
580 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
581 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
582 tp_assign(nr_sector
, bio_sectors(bio
))
583 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
584 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
585 tp_assign(tid
, current
->pid
)
586 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
587 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
588 tp_assign(sector
, bio
->bi_sector
)
589 tp_assign(nr_sector
, bio
->bi_size
>> 9)
590 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
591 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
592 tp_assign(tid
, current
->pid
)
593 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
596 TP_printk("%d,%d %s %llu + %u [%s] %d",
597 MAJOR(__entry
->dev
), MINOR(__entry
->dev
), __entry
->rwbs
,
598 (unsigned long long)__entry
->sector
,
599 __entry
->nr_sector
, __entry
->comm
, __entry
->tid
)
602 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio
,
604 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
609 __field( dev_t
, dev
)
610 __field( sector_t
, sector
)
611 __field( unsigned int, nr_sector
)
612 __field( unsigned int, rwbs
)
613 __field( pid_t
, tid
)
614 __array_text( char, comm
, TASK_COMM_LEN
)
618 tp_assign(dev
, bio
->bi_bdev
? bio
->bi_bdev
->bd_dev
: 0)
619 tp_assign(sector
, bio
->bi_sector
)
620 tp_assign(nr_sector
, bio
->bi_size
>> 9)
621 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
622 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
623 tp_assign(tid
, current
->pid
)
626 TP_printk("%d,%d %s %llu + %u [%s] %d",
627 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
628 __print_rwbs_flags(__entry
->rwbs
),
629 (unsigned long long)__entry
->sector
,
630 __entry
->nr_sector
, __entry
->comm
, __entry
->tid
)
634 * block_bio_backmerge - merging block operation to the end of an existing operation
635 * @q: queue holding operation
636 * @bio: new block operation to merge
638 * Merging block request @bio to the end of an existing block request
641 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_backmerge
,
643 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
649 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
650 * @q: queue holding operation
651 * @bio: new block operation to merge
653 * Merging block IO operation @bio to the beginning of an existing block
654 * operation in queue @q.
656 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_frontmerge
,
658 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
664 * block_bio_queue - putting new block IO operation in queue
665 * @q: queue holding operation
666 * @bio: new block operation
668 * About to place the block IO operation @bio into queue @q.
670 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio
, block_bio_queue
,
672 TP_PROTO(struct request_queue
*q
, struct bio
*bio
),
678 LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq
,
680 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
685 __field( dev_t
, dev
)
686 __field( sector_t
, sector
)
687 __field( unsigned int, nr_sector
)
688 __field( unsigned int, rwbs
)
689 __field( pid_t
, tid
)
690 __array_text( char, comm
, TASK_COMM_LEN
)
694 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
695 tp_assign(dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
696 tp_assign(sector
, bio
? bio
->bi_iter
.bi_sector
: 0)
697 tp_assign(nr_sector
, bio
? bio_sectors(bio
) : 0)
698 blk_fill_rwbs(rwbs
, bio
? bio
->bi_rw
: 0,
699 bio
? bio_sectors(bio
) : 0)
700 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
701 tp_assign(tid
, current
->pid
)
702 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
703 tp_assign(dev
, bio
? bio
->bi_bdev
->bd_dev
: 0)
704 tp_assign(sector
, bio
? bio
->bi_sector
: 0)
705 tp_assign(nr_sector
, bio
? bio
->bi_size
>> 9 : 0)
706 blk_fill_rwbs(rwbs
, bio
? bio
->bi_rw
: 0,
707 bio
? bio
->bi_size
>> 9 : 0)
708 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
709 tp_assign(tid
, current
->pid
)
710 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
713 TP_printk("%d,%d %s %llu + %u [%s] %d",
714 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
715 __print_rwbs_flags(__entry
->rwbs
),
716 (unsigned long long)__entry
->sector
,
717 __entry
->nr_sector
, __entry
->comm
, __entry
->tid
)
721 * block_getrq - get a free request entry in queue for block IO operations
722 * @q: queue for operations
723 * @bio: pending block IO operation
724 * @rw: low bit indicates a read (%0) or a write (%1)
726 * A request struct for queue @q has been allocated to handle the
727 * block IO operation @bio.
729 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_getrq
,
731 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
737 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
738 * @q: queue for operation
739 * @bio: pending block IO operation
740 * @rw: low bit indicates a read (%0) or a write (%1)
742 * In the case where a request struct cannot be provided for queue @q
743 * the process needs to wait for an request struct to become
744 * available. This tracepoint event is generated each time the
745 * process goes to sleep waiting for request struct become available.
747 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq
, block_sleeprq
,
749 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, int rw
),
755 * block_plug - keep operations requests in request queue
756 * @q: request queue to plug
758 * Plug the request queue @q. Do not allow block operation requests
759 * to be sent to the device driver. Instead, accumulate requests in
760 * the queue to improve throughput performance of the block device.
762 LTTNG_TRACEPOINT_EVENT(block_plug
,
764 TP_PROTO(struct request_queue
*q
),
769 __field( pid_t
, tid
)
770 __array_text( char, comm
, TASK_COMM_LEN
)
774 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
775 tp_assign(tid
, current
->pid
)
778 TP_printk("[%s] %d", __entry
->comm
, __entry
->tid
)
781 LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug
,
783 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
784 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
786 TP_ARGS(q
, depth
, explicit),
788 TP_PROTO(struct request_queue
*q
),
794 __field( int, nr_rq
)
795 __field( pid_t
, tid
)
796 __array_text( char, comm
, TASK_COMM_LEN
)
800 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
801 tp_assign(nr_rq
, depth
)
803 tp_assign(nr_rq
, q
->rq
.count
[READ
] + q
->rq
.count
[WRITE
])
805 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
806 tp_assign(tid
, current
->pid
)
809 TP_printk("[%s] %d %d", __entry
->comm
, , __entry
->tid
,
813 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
815 * block_unplug_timer - timed release of operations requests in queue to device driver
816 * @q: request queue to unplug
818 * Unplug the request queue @q because a timer expired and allow block
819 * operation requests to be sent to the device driver.
821 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_timer
,
823 TP_PROTO(struct request_queue
*q
),
830 * block_unplug - release of operations requests in request queue
831 * @q: request queue to unplug
832 * @depth: number of requests just added to the queue
833 * @explicit: whether this was an explicit unplug, or one from schedule()
835 * Unplug request queue @q because device driver is scheduled to work
836 * on elements in the request queue.
838 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
839 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug
,
841 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug
, block_unplug_io
,
844 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
845 TP_PROTO(struct request_queue
*q
, unsigned int depth
, bool explicit),
847 TP_ARGS(q
, depth
, explicit)
849 TP_PROTO(struct request_queue
*q
),
856 * block_split - split a single bio struct into two bio structs
857 * @q: queue containing the bio
858 * @bio: block operation being split
859 * @new_sector: The starting sector for the new bio
861 * The bio request @bio in request queue @q needs to be split into two
862 * bio requests. The newly created @bio request starts at
863 * @new_sector. This split may be required due to hardware limitation
864 * such as operation crossing device boundaries in a RAID system.
866 LTTNG_TRACEPOINT_EVENT(block_split
,
868 TP_PROTO(struct request_queue
*q
, struct bio
*bio
,
869 unsigned int new_sector
),
871 TP_ARGS(q
, bio
, new_sector
),
874 __field( dev_t
, dev
)
875 __field( sector_t
, sector
)
876 __field( sector_t
, new_sector
)
877 __field( unsigned int, rwbs
)
878 __field( pid_t
, tid
)
879 __array_text( char, comm
, TASK_COMM_LEN
)
883 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
884 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
885 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
886 tp_assign(new_sector
, new_sector
)
887 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
888 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
889 tp_assign(tid
, current
->pid
)
890 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
891 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
892 tp_assign(sector
, bio
->bi_sector
)
893 tp_assign(new_sector
, new_sector
)
894 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
895 tp_memcpy(comm
, current
->comm
, TASK_COMM_LEN
)
896 tp_assign(tid
, current
->pid
)
897 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
900 TP_printk("%d,%d %s %llu / %llu [%s] %d",
901 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
902 __print_rwbs_flags(__entry
->rwbs
),
903 (unsigned long long)__entry
->sector
,
904 (unsigned long long)__entry
->new_sector
,
905 __entry
->comm
, __entry
->tid
)
909 * block_bio_remap - map request for a logical device to the raw device
910 * @q: queue holding the operation
911 * @bio: revised operation
912 * @dev: device for the operation
913 * @from: original sector for the operation
915 * An operation for a logical device has been mapped to the
918 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
919 LTTNG_TRACEPOINT_EVENT(block_bio_remap
,
921 LTTNG_TRACEPOINT_EVENT(block_remap
,
924 TP_PROTO(struct request_queue
*q
, struct bio
*bio
, dev_t dev
,
927 TP_ARGS(q
, bio
, dev
, from
),
930 __field( dev_t
, dev
)
931 __field( sector_t
, sector
)
932 __field( unsigned int, nr_sector
)
933 __field( dev_t
, old_dev
)
934 __field( sector_t
, old_sector
)
935 __field( unsigned int, rwbs
)
939 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
940 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
941 tp_assign(sector
, bio
->bi_iter
.bi_sector
)
942 tp_assign(nr_sector
, bio_sectors(bio
))
943 tp_assign(old_dev
, dev
)
944 tp_assign(old_sector
, from
)
945 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_iter
.bi_size
)
946 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
947 tp_assign(dev
, bio
->bi_bdev
->bd_dev
)
948 tp_assign(sector
, bio
->bi_sector
)
949 tp_assign(nr_sector
, bio
->bi_size
>> 9)
950 tp_assign(old_dev
, dev
)
951 tp_assign(old_sector
, from
)
952 blk_fill_rwbs(rwbs
, bio
->bi_rw
, bio
->bi_size
)
953 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
956 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
957 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
958 __print_rwbs_flags(__entry
->rwbs
),
959 (unsigned long long)__entry
->sector
,
961 MAJOR(__entry
->old_dev
), MINOR(__entry
->old_dev
),
962 (unsigned long long)__entry
->old_sector
)
965 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
967 * block_rq_remap - map request for a block operation request
968 * @q: queue holding the operation
969 * @rq: block IO operation request
970 * @dev: device for the operation
971 * @from: original sector for the operation
973 * The block operation request @rq in @q has been remapped. The block
974 * operation request @rq holds the current information and @from hold
975 * the original sector.
977 LTTNG_TRACEPOINT_EVENT(block_rq_remap
,
979 TP_PROTO(struct request_queue
*q
, struct request
*rq
, dev_t dev
,
982 TP_ARGS(q
, rq
, dev
, from
),
985 __field( dev_t
, dev
)
986 __field( sector_t
, sector
)
987 __field( unsigned int, nr_sector
)
988 __field( dev_t
, old_dev
)
989 __field( sector_t
, old_sector
)
990 __field( unsigned int, rwbs
)
994 tp_assign(dev
, disk_devt(rq
->rq_disk
))
995 tp_assign(sector
, blk_rq_pos(rq
))
996 tp_assign(nr_sector
, blk_rq_sectors(rq
))
997 tp_assign(old_dev
, dev
)
998 tp_assign(old_sector
, from
)
999 blk_fill_rwbs(rwbs
, rq
->cmd_flags
, blk_rq_bytes(rq
))
1002 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
1003 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
1004 __print_rwbs_flags(__entry
->rwbs
),
1005 (unsigned long long)__entry
->sector
,
1007 MAJOR(__entry
->old_dev
), MINOR(__entry
->old_dev
),
1008 (unsigned long long)__entry
->old_sector
)
1012 #undef __print_rwbs_flags
1013 #undef blk_fill_rwbs
1015 #endif /* LTTNG_TRACE_BLOCK_H */
1017 /* This part must be outside protection */
1018 #include "../../../probes/define_trace.h"
This page took 0.050778 seconds and 4 git commands to generate.