block: update instrumentation to 3.9 rc kernel
[lttng-modules.git] / instrumentation / events / lttng-module / block.h
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM block
3
4 #if !defined(_TRACE_BLOCK_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_BLOCK_H
6
7 #include <linux/blktrace_api.h>
8 #include <linux/blkdev.h>
9 #include <linux/tracepoint.h>
10 #include <linux/trace_seq.h>
11 #include <linux/version.h>
12
13 #define RWBS_LEN 8
14
15 #ifndef _TRACE_BLOCK_DEF_
16 #define _TRACE_BLOCK_DEF_
17
18 #define __blk_dump_cmd(cmd, len) "<unknown>"
19
20 enum {
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 };
32
33 #endif /* _TRACE_BLOCK_DEF_ */
34
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" })
47
48 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
49
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 : \
54 ( 0 )))) \
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))
61
62 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
63
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 : \
68 ( 0 )))) \
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))
73
74 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
75
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 : \
80 ( 0 )))) \
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))
86
87 #else
88
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 : \
93 ( 0 )))) \
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))
98
99 #endif
100
101 DECLARE_EVENT_CLASS(block_rq_with_error,
102
103 TP_PROTO(struct request_queue *q, struct request *rq),
104
105 TP_ARGS(q, rq),
106
107 TP_STRUCT__entry(
108 __field( dev_t, dev )
109 __field( sector_t, sector )
110 __field( unsigned int, nr_sector )
111 __field( int, errors )
112 __field( unsigned int, rwbs )
113 __dynamic_array_hex( unsigned char, cmd,
114 (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
115 rq->cmd_len : 0)
116 ),
117
118 TP_fast_assign(
119 tp_assign(dev, rq->rq_disk ? disk_devt(rq->rq_disk) : 0)
120 tp_assign(sector, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
121 0 : blk_rq_pos(rq))
122 tp_assign(nr_sector, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
123 0 : blk_rq_sectors(rq))
124 tp_assign(errors, rq->errors)
125 blk_fill_rwbs(rwbs, rq->cmd_flags, blk_rq_bytes(rq))
126 tp_memcpy_dyn(cmd, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
127 rq->cmd : NULL);
128 ),
129
130 TP_printk("%d,%d %s (%s) %llu + %u [%d]",
131 MAJOR(__entry->dev), MINOR(__entry->dev),
132 __print_rwbs_flags(__entry->rwbs),
133 __blk_dump_cmd(__get_dynamic_array(cmd),
134 __get_dynamic_array_len(cmd)),
135 (unsigned long long)__entry->sector,
136 __entry->nr_sector, __entry->errors)
137 )
138
139 /**
140 * block_rq_abort - abort block operation request
141 * @q: queue containing the block operation request
142 * @rq: block IO operation request
143 *
144 * Called immediately after pending block IO operation request @rq in
145 * queue @q is aborted. The fields in the operation request @rq
146 * can be examined to determine which device and sectors the pending
147 * operation would access.
148 */
149 DEFINE_EVENT(block_rq_with_error, block_rq_abort,
150
151 TP_PROTO(struct request_queue *q, struct request *rq),
152
153 TP_ARGS(q, rq)
154 )
155
156 /**
157 * block_rq_requeue - place block IO request back on a queue
158 * @q: queue holding operation
159 * @rq: block IO operation request
160 *
161 * The block operation request @rq is being placed back into queue
162 * @q. For some reason the request was not completed and needs to be
163 * put back in the queue.
164 */
165 DEFINE_EVENT(block_rq_with_error, block_rq_requeue,
166
167 TP_PROTO(struct request_queue *q, struct request *rq),
168
169 TP_ARGS(q, rq)
170 )
171
172 /**
173 * block_rq_complete - block IO operation completed by device driver
174 * @q: queue containing the block operation request
175 * @rq: block operations request
176 *
177 * The block_rq_complete tracepoint event indicates that some portion
178 * of operation request has been completed by the device driver. If
179 * the @rq->bio is %NULL, then there is absolutely no additional work to
180 * do for the request. If @rq->bio is non-NULL then there is
181 * additional work required to complete the request.
182 */
183 DEFINE_EVENT(block_rq_with_error, block_rq_complete,
184
185 TP_PROTO(struct request_queue *q, struct request *rq),
186
187 TP_ARGS(q, rq)
188 )
189
190 DECLARE_EVENT_CLASS(block_rq,
191
192 TP_PROTO(struct request_queue *q, struct request *rq),
193
194 TP_ARGS(q, rq),
195
196 TP_STRUCT__entry(
197 __field( dev_t, dev )
198 __field( sector_t, sector )
199 __field( unsigned int, nr_sector )
200 __field( unsigned int, bytes )
201 __field( unsigned int, rwbs )
202 __array_text( char, comm, TASK_COMM_LEN )
203 __dynamic_array_hex( unsigned char, cmd,
204 (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
205 rq->cmd_len : 0)
206 ),
207
208 TP_fast_assign(
209 tp_assign(dev, rq->rq_disk ? disk_devt(rq->rq_disk) : 0)
210 tp_assign(sector, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
211 0 : blk_rq_pos(rq))
212 tp_assign(nr_sector, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
213 0 : blk_rq_sectors(rq))
214 tp_assign(bytes, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
215 blk_rq_bytes(rq) : 0)
216 blk_fill_rwbs(rwbs, rq->cmd_flags, blk_rq_bytes(rq))
217 tp_memcpy_dyn(cmd, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
218 rq->cmd : NULL);
219 tp_memcpy(comm, current->comm, TASK_COMM_LEN)
220 ),
221
222 TP_printk("%d,%d %s %u (%s) %llu + %u [%s]",
223 MAJOR(__entry->dev), MINOR(__entry->dev),
224 __print_rwbs_flags(__entry->rwbs),
225 __entry->bytes,
226 __blk_dump_cmd(__get_dynamic_array(cmd),
227 __get_dynamic_array_len(cmd)),
228 (unsigned long long)__entry->sector,
229 __entry->nr_sector, __entry->comm)
230 )
231
232 /**
233 * block_rq_insert - insert block operation request into queue
234 * @q: target queue
235 * @rq: block IO operation request
236 *
237 * Called immediately before block operation request @rq is inserted
238 * into queue @q. The fields in the operation request @rq struct can
239 * be examined to determine which device and sectors the pending
240 * operation would access.
241 */
242 DEFINE_EVENT(block_rq, block_rq_insert,
243
244 TP_PROTO(struct request_queue *q, struct request *rq),
245
246 TP_ARGS(q, rq)
247 )
248
249 /**
250 * block_rq_issue - issue pending block IO request operation to device driver
251 * @q: queue holding operation
252 * @rq: block IO operation operation request
253 *
254 * Called when block operation request @rq from queue @q is sent to a
255 * device driver for processing.
256 */
257 DEFINE_EVENT(block_rq, block_rq_issue,
258
259 TP_PROTO(struct request_queue *q, struct request *rq),
260
261 TP_ARGS(q, rq)
262 )
263
264 /**
265 * block_bio_bounce - used bounce buffer when processing block operation
266 * @q: queue holding the block operation
267 * @bio: block operation
268 *
269 * A bounce buffer was used to handle the block operation @bio in @q.
270 * This occurs when hardware limitations prevent a direct transfer of
271 * data between the @bio data memory area and the IO device. Use of a
272 * bounce buffer requires extra copying of data and decreases
273 * performance.
274 */
275 TRACE_EVENT(block_bio_bounce,
276
277 TP_PROTO(struct request_queue *q, struct bio *bio),
278
279 TP_ARGS(q, bio),
280
281 TP_STRUCT__entry(
282 __field( dev_t, dev )
283 __field( sector_t, sector )
284 __field( unsigned int, nr_sector )
285 __field( unsigned int, rwbs )
286 __array_text( char, comm, TASK_COMM_LEN )
287 ),
288
289 TP_fast_assign(
290 tp_assign(dev, bio->bi_bdev ?
291 bio->bi_bdev->bd_dev : 0)
292 tp_assign(sector, bio->bi_sector)
293 tp_assign(nr_sector, bio->bi_size >> 9)
294 blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size)
295 tp_memcpy(comm, current->comm, TASK_COMM_LEN)
296 ),
297
298 TP_printk("%d,%d %s %llu + %u [%s]",
299 MAJOR(__entry->dev), MINOR(__entry->dev),
300 __print_rwbs_flags(__entry->rwbs),
301 (unsigned long long)__entry->sector,
302 __entry->nr_sector, __entry->comm)
303 )
304
305 /**
306 * block_bio_complete - completed all work on the block operation
307 * @q: queue holding the block operation
308 * @bio: block operation completed
309 * @error: io error value
310 *
311 * This tracepoint indicates there is no further work to do on this
312 * block IO operation @bio.
313 */
314 TRACE_EVENT(block_bio_complete,
315
316 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
317 TP_PROTO(struct bio *bio, int error),
318
319 TP_ARGS(bio, error),
320 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
321 TP_PROTO(struct request_queue *q, struct bio *bio, int error),
322
323 TP_ARGS(q, bio, error),
324 #else
325 TP_PROTO(struct request_queue *q, struct bio *bio),
326
327 TP_ARGS(q, bio),
328 #endif
329
330 TP_STRUCT__entry(
331 __field( dev_t, dev )
332 __field( sector_t, sector )
333 __field( unsigned, nr_sector )
334 __field( int, error )
335 __field( unsigned int, rwbs )
336 ),
337
338 TP_fast_assign(
339 tp_assign(dev, bio->bi_bdev->bd_dev)
340 tp_assign(sector, bio->bi_sector)
341 tp_assign(nr_sector, bio->bi_size >> 9)
342 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
343 tp_assign(error, error)
344 #else
345 tp_assign(error, 0)
346 #endif
347 blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size)
348 ),
349
350 TP_printk("%d,%d %s %llu + %u [%d]",
351 MAJOR(__entry->dev), MINOR(__entry->dev),
352 __print_rwbs_flags(__entry->rwbs),
353 (unsigned long long)__entry->sector,
354 __entry->nr_sector, __entry->error)
355 )
356
357 DECLARE_EVENT_CLASS(block_bio,
358
359 TP_PROTO(struct request_queue *q, struct bio *bio),
360
361 TP_ARGS(q, bio),
362
363 TP_STRUCT__entry(
364 __field( dev_t, dev )
365 __field( sector_t, sector )
366 __field( unsigned int, nr_sector )
367 __field( unsigned int, rwbs )
368 __array_text( char, comm, TASK_COMM_LEN )
369 ),
370
371 TP_fast_assign(
372 tp_assign(dev, bio->bi_bdev->bd_dev)
373 tp_assign(sector, bio->bi_sector)
374 tp_assign(nr_sector, bio->bi_size >> 9)
375 blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size)
376 tp_memcpy(comm, current->comm, TASK_COMM_LEN)
377 ),
378
379 TP_printk("%d,%d %s %llu + %u [%s]",
380 MAJOR(__entry->dev), MINOR(__entry->dev),
381 __print_rwbs_flags(__entry->rwbs),
382 (unsigned long long)__entry->sector,
383 __entry->nr_sector, __entry->comm)
384 )
385
386 /**
387 * block_bio_backmerge - merging block operation to the end of an existing operation
388 * @q: queue holding operation
389 * @bio: new block operation to merge
390 *
391 * Merging block request @bio to the end of an existing block request
392 * in queue @q.
393 */
394 DEFINE_EVENT(block_bio, block_bio_backmerge,
395
396 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
397 TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
398
399 TP_ARGS(q, rq, bio)
400 #else
401 TP_PROTO(struct request_queue *q, struct bio *bio),
402
403 TP_ARGS(q, bio)
404 #endif
405 )
406
407 /**
408 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
409 * @q: queue holding operation
410 * @bio: new block operation to merge
411 *
412 * Merging block IO operation @bio to the beginning of an existing block
413 * operation in queue @q.
414 */
415 DEFINE_EVENT(block_bio, block_bio_frontmerge,
416
417 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
418 TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
419
420 TP_ARGS(q, rq, bio)
421 #else
422 TP_PROTO(struct request_queue *q, struct bio *bio),
423
424 TP_ARGS(q, bio)
425 #endif
426 )
427
428 /**
429 * block_bio_queue - putting new block IO operation in queue
430 * @q: queue holding operation
431 * @bio: new block operation
432 *
433 * About to place the block IO operation @bio into queue @q.
434 */
435 DEFINE_EVENT(block_bio, block_bio_queue,
436
437 TP_PROTO(struct request_queue *q, struct bio *bio),
438
439 TP_ARGS(q, bio)
440 )
441
442 DECLARE_EVENT_CLASS(block_get_rq,
443
444 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
445
446 TP_ARGS(q, bio, rw),
447
448 TP_STRUCT__entry(
449 __field( dev_t, dev )
450 __field( sector_t, sector )
451 __field( unsigned int, nr_sector )
452 __field( unsigned int, rwbs )
453 __array_text( char, comm, TASK_COMM_LEN )
454 ),
455
456 TP_fast_assign(
457 tp_assign(dev, bio ? bio->bi_bdev->bd_dev : 0)
458 tp_assign(sector, bio ? bio->bi_sector : 0)
459 tp_assign(nr_sector, bio ? bio->bi_size >> 9 : 0)
460 blk_fill_rwbs(rwbs, bio ? bio->bi_rw : 0,
461 bio ? bio->bi_size >> 9 : 0)
462 tp_memcpy(comm, current->comm, TASK_COMM_LEN)
463 ),
464
465 TP_printk("%d,%d %s %llu + %u [%s]",
466 MAJOR(__entry->dev), MINOR(__entry->dev),
467 __print_rwbs_flags(__entry->rwbs),
468 (unsigned long long)__entry->sector,
469 __entry->nr_sector, __entry->comm)
470 )
471
472 /**
473 * block_getrq - get a free request entry in queue for block IO operations
474 * @q: queue for operations
475 * @bio: pending block IO operation
476 * @rw: low bit indicates a read (%0) or a write (%1)
477 *
478 * A request struct for queue @q has been allocated to handle the
479 * block IO operation @bio.
480 */
481 DEFINE_EVENT(block_get_rq, block_getrq,
482
483 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
484
485 TP_ARGS(q, bio, rw)
486 )
487
488 /**
489 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
490 * @q: queue for operation
491 * @bio: pending block IO operation
492 * @rw: low bit indicates a read (%0) or a write (%1)
493 *
494 * In the case where a request struct cannot be provided for queue @q
495 * the process needs to wait for an request struct to become
496 * available. This tracepoint event is generated each time the
497 * process goes to sleep waiting for request struct become available.
498 */
499 DEFINE_EVENT(block_get_rq, block_sleeprq,
500
501 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
502
503 TP_ARGS(q, bio, rw)
504 )
505
506 /**
507 * block_plug - keep operations requests in request queue
508 * @q: request queue to plug
509 *
510 * Plug the request queue @q. Do not allow block operation requests
511 * to be sent to the device driver. Instead, accumulate requests in
512 * the queue to improve throughput performance of the block device.
513 */
514 TRACE_EVENT(block_plug,
515
516 TP_PROTO(struct request_queue *q),
517
518 TP_ARGS(q),
519
520 TP_STRUCT__entry(
521 __array_text( char, comm, TASK_COMM_LEN )
522 ),
523
524 TP_fast_assign(
525 tp_memcpy(comm, current->comm, TASK_COMM_LEN)
526 ),
527
528 TP_printk("[%s]", __entry->comm)
529 )
530
531 DECLARE_EVENT_CLASS(block_unplug,
532
533 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
534 TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit),
535
536 TP_ARGS(q, depth, explicit),
537 #else
538 TP_PROTO(struct request_queue *q),
539
540 TP_ARGS(q),
541 #endif
542
543 TP_STRUCT__entry(
544 __field( int, nr_rq )
545 __array_text( char, comm, TASK_COMM_LEN )
546 ),
547
548 TP_fast_assign(
549 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
550 tp_assign(nr_rq, depth)
551 #else
552 tp_assign(nr_rq, q->rq.count[READ] + q->rq.count[WRITE])
553 #endif
554 tp_memcpy(comm, current->comm, TASK_COMM_LEN)
555 ),
556
557 TP_printk("[%s] %d", __entry->comm, __entry->nr_rq)
558 )
559
560 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
561 /**
562 * block_unplug_timer - timed release of operations requests in queue to device driver
563 * @q: request queue to unplug
564 *
565 * Unplug the request queue @q because a timer expired and allow block
566 * operation requests to be sent to the device driver.
567 */
568 DEFINE_EVENT(block_unplug, block_unplug_timer,
569
570 TP_PROTO(struct request_queue *q),
571
572 TP_ARGS(q)
573 )
574 #endif
575
576 /**
577 * block_unplug - release of operations requests in request queue
578 * @q: request queue to unplug
579 * @depth: number of requests just added to the queue
580 * @explicit: whether this was an explicit unplug, or one from schedule()
581 *
582 * Unplug request queue @q because device driver is scheduled to work
583 * on elements in the request queue.
584 */
585 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
586 DEFINE_EVENT(block_unplug, block_unplug,
587 #else
588 DEFINE_EVENT(block_unplug, block_unplug_io,
589 #endif
590
591 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
592 TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit),
593
594 TP_ARGS(q, depth, explicit)
595 #else
596 TP_PROTO(struct request_queue *q),
597
598 TP_ARGS(q)
599 #endif
600 )
601
602 /**
603 * block_split - split a single bio struct into two bio structs
604 * @q: queue containing the bio
605 * @bio: block operation being split
606 * @new_sector: The starting sector for the new bio
607 *
608 * The bio request @bio in request queue @q needs to be split into two
609 * bio requests. The newly created @bio request starts at
610 * @new_sector. This split may be required due to hardware limitation
611 * such as operation crossing device boundaries in a RAID system.
612 */
613 TRACE_EVENT(block_split,
614
615 TP_PROTO(struct request_queue *q, struct bio *bio,
616 unsigned int new_sector),
617
618 TP_ARGS(q, bio, new_sector),
619
620 TP_STRUCT__entry(
621 __field( dev_t, dev )
622 __field( sector_t, sector )
623 __field( sector_t, new_sector )
624 __field( unsigned int, rwbs )
625 __array_text( char, comm, TASK_COMM_LEN )
626 ),
627
628 TP_fast_assign(
629 tp_assign(dev, bio->bi_bdev->bd_dev)
630 tp_assign(sector, bio->bi_sector)
631 tp_assign(new_sector, new_sector)
632 blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size)
633 tp_memcpy(comm, current->comm, TASK_COMM_LEN)
634 ),
635
636 TP_printk("%d,%d %s %llu / %llu [%s]",
637 MAJOR(__entry->dev), MINOR(__entry->dev),
638 __print_rwbs_flags(__entry->rwbs),
639 (unsigned long long)__entry->sector,
640 (unsigned long long)__entry->new_sector,
641 __entry->comm)
642 )
643
644 /**
645 * block_bio_remap - map request for a logical device to the raw device
646 * @q: queue holding the operation
647 * @bio: revised operation
648 * @dev: device for the operation
649 * @from: original sector for the operation
650 *
651 * An operation for a logical device has been mapped to the
652 * raw block device.
653 */
654 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
655 TRACE_EVENT(block_bio_remap,
656 #else
657 TRACE_EVENT(block_remap,
658 #endif
659
660 TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev,
661 sector_t from),
662
663 TP_ARGS(q, bio, dev, from),
664
665 TP_STRUCT__entry(
666 __field( dev_t, dev )
667 __field( sector_t, sector )
668 __field( unsigned int, nr_sector )
669 __field( dev_t, old_dev )
670 __field( sector_t, old_sector )
671 __field( unsigned int, rwbs )
672 ),
673
674 TP_fast_assign(
675 tp_assign(dev, bio->bi_bdev->bd_dev)
676 tp_assign(sector, bio->bi_sector)
677 tp_assign(nr_sector, bio->bi_size >> 9)
678 tp_assign(old_dev, dev)
679 tp_assign(old_sector, from)
680 blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size)
681 ),
682
683 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
684 MAJOR(__entry->dev), MINOR(__entry->dev),
685 __print_rwbs_flags(__entry->rwbs),
686 (unsigned long long)__entry->sector,
687 __entry->nr_sector,
688 MAJOR(__entry->old_dev), MINOR(__entry->old_dev),
689 (unsigned long long)__entry->old_sector)
690 )
691
692 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
693 /**
694 * block_rq_remap - map request for a block operation request
695 * @q: queue holding the operation
696 * @rq: block IO operation request
697 * @dev: device for the operation
698 * @from: original sector for the operation
699 *
700 * The block operation request @rq in @q has been remapped. The block
701 * operation request @rq holds the current information and @from hold
702 * the original sector.
703 */
704 TRACE_EVENT(block_rq_remap,
705
706 TP_PROTO(struct request_queue *q, struct request *rq, dev_t dev,
707 sector_t from),
708
709 TP_ARGS(q, rq, dev, from),
710
711 TP_STRUCT__entry(
712 __field( dev_t, dev )
713 __field( sector_t, sector )
714 __field( unsigned int, nr_sector )
715 __field( dev_t, old_dev )
716 __field( sector_t, old_sector )
717 __field( unsigned int, rwbs )
718 ),
719
720 TP_fast_assign(
721 tp_assign(dev, disk_devt(rq->rq_disk))
722 tp_assign(sector, blk_rq_pos(rq))
723 tp_assign(nr_sector, blk_rq_sectors(rq))
724 tp_assign(old_dev, dev)
725 tp_assign(old_sector, from)
726 blk_fill_rwbs(rwbs, rq->cmd_flags, blk_rq_bytes(rq))
727 ),
728
729 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
730 MAJOR(__entry->dev), MINOR(__entry->dev),
731 __print_rwbs_flags(__entry->rwbs),
732 (unsigned long long)__entry->sector,
733 __entry->nr_sector,
734 MAJOR(__entry->old_dev), MINOR(__entry->old_dev),
735 (unsigned long long)__entry->old_sector)
736 )
737 #endif
738
739 #undef __print_rwbs_flags
740 #undef blk_fill_rwbs
741
742 #endif /* _TRACE_BLOCK_H */
743
744 /* This part must be outside protection */
745 #include "../../../probes/define_trace.h"
746
This page took 0.058123 seconds and 4 git commands to generate.