Fix: 3.9.0 block layer instrumentation build
[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(2,6,38))
317 TP_PROTO(struct request_queue *q, struct bio *bio, int error),
318
319 TP_ARGS(q, bio, error),
320 #else
321 TP_PROTO(struct request_queue *q, struct bio *bio),
322
323 TP_ARGS(q, bio),
324 #endif
325
326 TP_STRUCT__entry(
327 __field( dev_t, dev )
328 __field( sector_t, sector )
329 __field( unsigned, nr_sector )
330 __field( int, error )
331 __field( unsigned int, rwbs )
332 ),
333
334 TP_fast_assign(
335 tp_assign(dev, bio->bi_bdev->bd_dev)
336 tp_assign(sector, bio->bi_sector)
337 tp_assign(nr_sector, bio->bi_size >> 9)
338 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
339 tp_assign(error, error)
340 #else
341 tp_assign(error, 0)
342 #endif
343 blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size)
344 ),
345
346 TP_printk("%d,%d %s %llu + %u [%d]",
347 MAJOR(__entry->dev), MINOR(__entry->dev),
348 __print_rwbs_flags(__entry->rwbs),
349 (unsigned long long)__entry->sector,
350 __entry->nr_sector, __entry->error)
351 )
352
353 DECLARE_EVENT_CLASS(block_bio,
354
355 TP_PROTO(struct request_queue *q, struct bio *bio),
356
357 TP_ARGS(q, bio),
358
359 TP_STRUCT__entry(
360 __field( dev_t, dev )
361 __field( sector_t, sector )
362 __field( unsigned int, nr_sector )
363 __field( unsigned int, rwbs )
364 __array_text( char, comm, TASK_COMM_LEN )
365 ),
366
367 TP_fast_assign(
368 tp_assign(dev, bio->bi_bdev->bd_dev)
369 tp_assign(sector, bio->bi_sector)
370 tp_assign(nr_sector, bio->bi_size >> 9)
371 blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size)
372 tp_memcpy(comm, current->comm, TASK_COMM_LEN)
373 ),
374
375 TP_printk("%d,%d %s %llu + %u [%s]",
376 MAJOR(__entry->dev), MINOR(__entry->dev),
377 __print_rwbs_flags(__entry->rwbs),
378 (unsigned long long)__entry->sector,
379 __entry->nr_sector, __entry->comm)
380 )
381
382 /**
383 * block_bio_backmerge - merging block operation to the end of an existing operation
384 * @q: queue holding operation
385 * @bio: new block operation to merge
386 *
387 * Merging block request @bio to the end of an existing block request
388 * in queue @q.
389 */
390 DEFINE_EVENT(block_bio, block_bio_backmerge,
391
392 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
393 TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
394
395 TP_ARGS(q, rq, bio)
396 #else
397 TP_PROTO(struct request_queue *q, struct bio *bio),
398
399 TP_ARGS(q, bio)
400 #endif
401 )
402
403 /**
404 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
405 * @q: queue holding operation
406 * @bio: new block operation to merge
407 *
408 * Merging block IO operation @bio to the beginning of an existing block
409 * operation in queue @q.
410 */
411 DEFINE_EVENT(block_bio, block_bio_frontmerge,
412
413 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
414 TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
415
416 TP_ARGS(q, rq, bio)
417 #else
418 TP_PROTO(struct request_queue *q, struct bio *bio),
419
420 TP_ARGS(q, bio)
421 #endif
422 )
423
424 /**
425 * block_bio_queue - putting new block IO operation in queue
426 * @q: queue holding operation
427 * @bio: new block operation
428 *
429 * About to place the block IO operation @bio into queue @q.
430 */
431 DEFINE_EVENT(block_bio, block_bio_queue,
432
433 TP_PROTO(struct request_queue *q, struct bio *bio),
434
435 TP_ARGS(q, bio)
436 )
437
438 DECLARE_EVENT_CLASS(block_get_rq,
439
440 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
441
442 TP_ARGS(q, bio, rw),
443
444 TP_STRUCT__entry(
445 __field( dev_t, dev )
446 __field( sector_t, sector )
447 __field( unsigned int, nr_sector )
448 __field( unsigned int, rwbs )
449 __array_text( char, comm, TASK_COMM_LEN )
450 ),
451
452 TP_fast_assign(
453 tp_assign(dev, bio ? bio->bi_bdev->bd_dev : 0)
454 tp_assign(sector, bio ? bio->bi_sector : 0)
455 tp_assign(nr_sector, bio ? bio->bi_size >> 9 : 0)
456 blk_fill_rwbs(rwbs, bio ? bio->bi_rw : 0,
457 bio ? bio->bi_size >> 9 : 0)
458 tp_memcpy(comm, current->comm, TASK_COMM_LEN)
459 ),
460
461 TP_printk("%d,%d %s %llu + %u [%s]",
462 MAJOR(__entry->dev), MINOR(__entry->dev),
463 __print_rwbs_flags(__entry->rwbs),
464 (unsigned long long)__entry->sector,
465 __entry->nr_sector, __entry->comm)
466 )
467
468 /**
469 * block_getrq - get a free request entry in queue for block IO operations
470 * @q: queue for operations
471 * @bio: pending block IO operation
472 * @rw: low bit indicates a read (%0) or a write (%1)
473 *
474 * A request struct for queue @q has been allocated to handle the
475 * block IO operation @bio.
476 */
477 DEFINE_EVENT(block_get_rq, block_getrq,
478
479 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
480
481 TP_ARGS(q, bio, rw)
482 )
483
484 /**
485 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
486 * @q: queue for operation
487 * @bio: pending block IO operation
488 * @rw: low bit indicates a read (%0) or a write (%1)
489 *
490 * In the case where a request struct cannot be provided for queue @q
491 * the process needs to wait for an request struct to become
492 * available. This tracepoint event is generated each time the
493 * process goes to sleep waiting for request struct become available.
494 */
495 DEFINE_EVENT(block_get_rq, block_sleeprq,
496
497 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
498
499 TP_ARGS(q, bio, rw)
500 )
501
502 /**
503 * block_plug - keep operations requests in request queue
504 * @q: request queue to plug
505 *
506 * Plug the request queue @q. Do not allow block operation requests
507 * to be sent to the device driver. Instead, accumulate requests in
508 * the queue to improve throughput performance of the block device.
509 */
510 TRACE_EVENT(block_plug,
511
512 TP_PROTO(struct request_queue *q),
513
514 TP_ARGS(q),
515
516 TP_STRUCT__entry(
517 __array_text( char, comm, TASK_COMM_LEN )
518 ),
519
520 TP_fast_assign(
521 tp_memcpy(comm, current->comm, TASK_COMM_LEN)
522 ),
523
524 TP_printk("[%s]", __entry->comm)
525 )
526
527 DECLARE_EVENT_CLASS(block_unplug,
528
529 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
530 TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit),
531
532 TP_ARGS(q, depth, explicit),
533 #else
534 TP_PROTO(struct request_queue *q),
535
536 TP_ARGS(q),
537 #endif
538
539 TP_STRUCT__entry(
540 __field( int, nr_rq )
541 __array_text( char, comm, TASK_COMM_LEN )
542 ),
543
544 TP_fast_assign(
545 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
546 tp_assign(nr_rq, depth)
547 #else
548 tp_assign(nr_rq, q->rq.count[READ] + q->rq.count[WRITE])
549 #endif
550 tp_memcpy(comm, current->comm, TASK_COMM_LEN)
551 ),
552
553 TP_printk("[%s] %d", __entry->comm, __entry->nr_rq)
554 )
555
556 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
557 /**
558 * block_unplug_timer - timed release of operations requests in queue to device driver
559 * @q: request queue to unplug
560 *
561 * Unplug the request queue @q because a timer expired and allow block
562 * operation requests to be sent to the device driver.
563 */
564 DEFINE_EVENT(block_unplug, block_unplug_timer,
565
566 TP_PROTO(struct request_queue *q),
567
568 TP_ARGS(q)
569 )
570 #endif
571
572 /**
573 * block_unplug - release of operations requests in request queue
574 * @q: request queue to unplug
575 * @depth: number of requests just added to the queue
576 * @explicit: whether this was an explicit unplug, or one from schedule()
577 *
578 * Unplug request queue @q because device driver is scheduled to work
579 * on elements in the request queue.
580 */
581 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
582 DEFINE_EVENT(block_unplug, block_unplug,
583 #else
584 DEFINE_EVENT(block_unplug, block_unplug_io,
585 #endif
586
587 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
588 TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit),
589
590 TP_ARGS(q, depth, explicit)
591 #else
592 TP_PROTO(struct request_queue *q),
593
594 TP_ARGS(q)
595 #endif
596 )
597
598 /**
599 * block_split - split a single bio struct into two bio structs
600 * @q: queue containing the bio
601 * @bio: block operation being split
602 * @new_sector: The starting sector for the new bio
603 *
604 * The bio request @bio in request queue @q needs to be split into two
605 * bio requests. The newly created @bio request starts at
606 * @new_sector. This split may be required due to hardware limitation
607 * such as operation crossing device boundaries in a RAID system.
608 */
609 TRACE_EVENT(block_split,
610
611 TP_PROTO(struct request_queue *q, struct bio *bio,
612 unsigned int new_sector),
613
614 TP_ARGS(q, bio, new_sector),
615
616 TP_STRUCT__entry(
617 __field( dev_t, dev )
618 __field( sector_t, sector )
619 __field( sector_t, new_sector )
620 __field( unsigned int, rwbs )
621 __array_text( char, comm, TASK_COMM_LEN )
622 ),
623
624 TP_fast_assign(
625 tp_assign(dev, bio->bi_bdev->bd_dev)
626 tp_assign(sector, bio->bi_sector)
627 tp_assign(new_sector, new_sector)
628 blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size)
629 tp_memcpy(comm, current->comm, TASK_COMM_LEN)
630 ),
631
632 TP_printk("%d,%d %s %llu / %llu [%s]",
633 MAJOR(__entry->dev), MINOR(__entry->dev),
634 __print_rwbs_flags(__entry->rwbs),
635 (unsigned long long)__entry->sector,
636 (unsigned long long)__entry->new_sector,
637 __entry->comm)
638 )
639
640 /**
641 * block_bio_remap - map request for a logical device to the raw device
642 * @q: queue holding the operation
643 * @bio: revised operation
644 * @dev: device for the operation
645 * @from: original sector for the operation
646 *
647 * An operation for a logical device has been mapped to the
648 * raw block device.
649 */
650 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
651 TRACE_EVENT(block_bio_remap,
652 #else
653 TRACE_EVENT(block_remap,
654 #endif
655
656 TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev,
657 sector_t from),
658
659 TP_ARGS(q, bio, dev, from),
660
661 TP_STRUCT__entry(
662 __field( dev_t, dev )
663 __field( sector_t, sector )
664 __field( unsigned int, nr_sector )
665 __field( dev_t, old_dev )
666 __field( sector_t, old_sector )
667 __field( unsigned int, rwbs )
668 ),
669
670 TP_fast_assign(
671 tp_assign(dev, bio->bi_bdev->bd_dev)
672 tp_assign(sector, bio->bi_sector)
673 tp_assign(nr_sector, bio->bi_size >> 9)
674 tp_assign(old_dev, dev)
675 tp_assign(old_sector, from)
676 blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size)
677 ),
678
679 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
680 MAJOR(__entry->dev), MINOR(__entry->dev),
681 __print_rwbs_flags(__entry->rwbs),
682 (unsigned long long)__entry->sector,
683 __entry->nr_sector,
684 MAJOR(__entry->old_dev), MINOR(__entry->old_dev),
685 (unsigned long long)__entry->old_sector)
686 )
687
688 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
689 /**
690 * block_rq_remap - map request for a block operation request
691 * @q: queue holding the operation
692 * @rq: block IO operation request
693 * @dev: device for the operation
694 * @from: original sector for the operation
695 *
696 * The block operation request @rq in @q has been remapped. The block
697 * operation request @rq holds the current information and @from hold
698 * the original sector.
699 */
700 TRACE_EVENT(block_rq_remap,
701
702 TP_PROTO(struct request_queue *q, struct request *rq, dev_t dev,
703 sector_t from),
704
705 TP_ARGS(q, rq, dev, from),
706
707 TP_STRUCT__entry(
708 __field( dev_t, dev )
709 __field( sector_t, sector )
710 __field( unsigned int, nr_sector )
711 __field( dev_t, old_dev )
712 __field( sector_t, old_sector )
713 __field( unsigned int, rwbs )
714 ),
715
716 TP_fast_assign(
717 tp_assign(dev, disk_devt(rq->rq_disk))
718 tp_assign(sector, blk_rq_pos(rq))
719 tp_assign(nr_sector, blk_rq_sectors(rq))
720 tp_assign(old_dev, dev)
721 tp_assign(old_sector, from)
722 blk_fill_rwbs(rwbs, rq->cmd_flags, blk_rq_bytes(rq))
723 ),
724
725 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
726 MAJOR(__entry->dev), MINOR(__entry->dev),
727 __print_rwbs_flags(__entry->rwbs),
728 (unsigned long long)__entry->sector,
729 __entry->nr_sector,
730 MAJOR(__entry->old_dev), MINOR(__entry->old_dev),
731 (unsigned long long)__entry->old_sector)
732 )
733 #endif
734
735 #undef __print_rwbs_flags
736 #undef blk_fill_rwbs
737
738 #endif /* _TRACE_BLOCK_H */
739
740 /* This part must be outside protection */
741 #include "../../../probes/define_trace.h"
742
This page took 0.044131 seconds and 4 git commands to generate.