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