blob: d8ce278515c3c256957acc443910795d8b8e0f16 [file] [log] [blame]
Li Zefand0b6e042009-07-13 10:33:21 +08001#undef TRACE_SYSTEM
2#define TRACE_SYSTEM block
3
Li Zefan55782132009-06-09 13:43:05 +08004#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
Li Zefan77ca1e02009-11-26 15:06:14 +080011DECLARE_EVENT_CLASS(block_rq_with_error,
Li Zefan55782132009-06-09 13:43:05 +080012
13 TP_PROTO(struct request_queue *q, struct request *rq),
14
15 TP_ARGS(q, rq),
16
17 TP_STRUCT__entry(
18 __field( dev_t, dev )
19 __field( sector_t, sector )
20 __field( unsigned int, nr_sector )
21 __field( int, errors )
22 __array( char, rwbs, 6 )
23 __dynamic_array( char, cmd, blk_cmd_buf_len(rq) )
24 ),
25
26 TP_fast_assign(
27 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
Christoph Hellwig33659eb2010-08-07 18:17:56 +020028 __entry->sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
29 0 : blk_rq_pos(rq);
30 __entry->nr_sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
31 0 : blk_rq_sectors(rq);
Li Zefan55782132009-06-09 13:43:05 +080032 __entry->errors = rq->errors;
33
34 blk_fill_rwbs_rq(__entry->rwbs, rq);
35 blk_dump_cmd(__get_str(cmd), rq);
36 ),
37
38 TP_printk("%d,%d %s (%s) %llu + %u [%d]",
39 MAJOR(__entry->dev), MINOR(__entry->dev),
40 __entry->rwbs, __get_str(cmd),
Steven Rostedt6556d1d2009-06-09 14:04:26 -040041 (unsigned long long)__entry->sector,
42 __entry->nr_sector, __entry->errors)
Li Zefan55782132009-06-09 13:43:05 +080043);
44
William Cohen881245d2010-03-09 09:26:04 +010045/**
46 * block_rq_abort - abort block operation request
47 * @q: queue containing the block operation request
48 * @rq: block IO operation request
49 *
50 * Called immediately after pending block IO operation request @rq in
51 * queue @q is aborted. The fields in the operation request @rq
52 * can be examined to determine which device and sectors the pending
53 * operation would access.
54 */
Li Zefan77ca1e02009-11-26 15:06:14 +080055DEFINE_EVENT(block_rq_with_error, block_rq_abort,
56
57 TP_PROTO(struct request_queue *q, struct request *rq),
58
59 TP_ARGS(q, rq)
60);
61
William Cohen881245d2010-03-09 09:26:04 +010062/**
63 * block_rq_requeue - place block IO request back on a queue
64 * @q: queue holding operation
65 * @rq: block IO operation request
66 *
67 * The block operation request @rq is being placed back into queue
68 * @q. For some reason the request was not completed and needs to be
69 * put back in the queue.
70 */
Li Zefan77ca1e02009-11-26 15:06:14 +080071DEFINE_EVENT(block_rq_with_error, block_rq_requeue,
72
73 TP_PROTO(struct request_queue *q, struct request *rq),
74
75 TP_ARGS(q, rq)
76);
77
William Cohen881245d2010-03-09 09:26:04 +010078/**
79 * block_rq_complete - block IO operation completed by device driver
80 * @q: queue containing the block operation request
81 * @rq: block operations request
82 *
83 * The block_rq_complete tracepoint event indicates that some portion
84 * of operation request has been completed by the device driver. If
85 * the @rq->bio is %NULL, then there is absolutely no additional work to
86 * do for the request. If @rq->bio is non-NULL then there is
87 * additional work required to complete the request.
88 */
Li Zefan77ca1e02009-11-26 15:06:14 +080089DEFINE_EVENT(block_rq_with_error, block_rq_complete,
90
91 TP_PROTO(struct request_queue *q, struct request *rq),
92
93 TP_ARGS(q, rq)
94);
95
96DECLARE_EVENT_CLASS(block_rq,
Li Zefan55782132009-06-09 13:43:05 +080097
98 TP_PROTO(struct request_queue *q, struct request *rq),
99
100 TP_ARGS(q, rq),
101
102 TP_STRUCT__entry(
103 __field( dev_t, dev )
104 __field( sector_t, sector )
105 __field( unsigned int, nr_sector )
106 __field( unsigned int, bytes )
107 __array( char, rwbs, 6 )
108 __array( char, comm, TASK_COMM_LEN )
109 __dynamic_array( char, cmd, blk_cmd_buf_len(rq) )
110 ),
111
112 TP_fast_assign(
113 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
Christoph Hellwig33659eb2010-08-07 18:17:56 +0200114 __entry->sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
115 0 : blk_rq_pos(rq);
116 __entry->nr_sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
117 0 : blk_rq_sectors(rq);
118 __entry->bytes = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
119 blk_rq_bytes(rq) : 0;
Li Zefan55782132009-06-09 13:43:05 +0800120
121 blk_fill_rwbs_rq(__entry->rwbs, rq);
122 blk_dump_cmd(__get_str(cmd), rq);
123 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
124 ),
125
126 TP_printk("%d,%d %s %u (%s) %llu + %u [%s]",
127 MAJOR(__entry->dev), MINOR(__entry->dev),
128 __entry->rwbs, __entry->bytes, __get_str(cmd),
Steven Rostedt6556d1d2009-06-09 14:04:26 -0400129 (unsigned long long)__entry->sector,
130 __entry->nr_sector, __entry->comm)
Li Zefan55782132009-06-09 13:43:05 +0800131);
132
William Cohen881245d2010-03-09 09:26:04 +0100133/**
134 * block_rq_insert - insert block operation request into queue
135 * @q: target queue
136 * @rq: block IO operation request
137 *
138 * Called immediately before block operation request @rq is inserted
139 * into queue @q. The fields in the operation request @rq struct can
140 * be examined to determine which device and sectors the pending
141 * operation would access.
142 */
Li Zefan77ca1e02009-11-26 15:06:14 +0800143DEFINE_EVENT(block_rq, block_rq_insert,
Li Zefan55782132009-06-09 13:43:05 +0800144
145 TP_PROTO(struct request_queue *q, struct request *rq),
146
Li Zefan77ca1e02009-11-26 15:06:14 +0800147 TP_ARGS(q, rq)
Li Zefan55782132009-06-09 13:43:05 +0800148);
149
William Cohen881245d2010-03-09 09:26:04 +0100150/**
151 * block_rq_issue - issue pending block IO request operation to device driver
152 * @q: queue holding operation
153 * @rq: block IO operation operation request
154 *
155 * Called when block operation request @rq from queue @q is sent to a
156 * device driver for processing.
157 */
Li Zefan77ca1e02009-11-26 15:06:14 +0800158DEFINE_EVENT(block_rq, block_rq_issue,
Li Zefan55782132009-06-09 13:43:05 +0800159
160 TP_PROTO(struct request_queue *q, struct request *rq),
161
Li Zefan77ca1e02009-11-26 15:06:14 +0800162 TP_ARGS(q, rq)
Li Zefan55782132009-06-09 13:43:05 +0800163);
Carsten Emdefe63b942009-09-12 00:05:37 +0200164
William Cohen881245d2010-03-09 09:26:04 +0100165/**
166 * block_bio_bounce - used bounce buffer when processing block operation
167 * @q: queue holding the block operation
168 * @bio: block operation
169 *
170 * A bounce buffer was used to handle the block operation @bio in @q.
171 * This occurs when hardware limitations prevent a direct transfer of
172 * data between the @bio data memory area and the IO device. Use of a
173 * bounce buffer requires extra copying of data and decreases
174 * performance.
175 */
Li Zefan55782132009-06-09 13:43:05 +0800176TRACE_EVENT(block_bio_bounce,
177
178 TP_PROTO(struct request_queue *q, struct bio *bio),
179
180 TP_ARGS(q, bio),
181
182 TP_STRUCT__entry(
183 __field( dev_t, dev )
184 __field( sector_t, sector )
185 __field( unsigned int, nr_sector )
186 __array( char, rwbs, 6 )
187 __array( char, comm, TASK_COMM_LEN )
188 ),
189
190 TP_fast_assign(
Carsten Emdefe63b942009-09-12 00:05:37 +0200191 __entry->dev = bio->bi_bdev ?
192 bio->bi_bdev->bd_dev : 0;
Li Zefan55782132009-06-09 13:43:05 +0800193 __entry->sector = bio->bi_sector;
194 __entry->nr_sector = bio->bi_size >> 9;
195 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
196 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
197 ),
198
199 TP_printk("%d,%d %s %llu + %u [%s]",
200 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
Steven Rostedt6556d1d2009-06-09 14:04:26 -0400201 (unsigned long long)__entry->sector,
202 __entry->nr_sector, __entry->comm)
Li Zefan55782132009-06-09 13:43:05 +0800203);
204
William Cohen881245d2010-03-09 09:26:04 +0100205/**
206 * block_bio_complete - completed all work on the block operation
207 * @q: queue holding the block operation
208 * @bio: block operation completed
209 *
210 * This tracepoint indicates there is no further work to do on this
211 * block IO operation @bio.
212 */
Li Zefan55782132009-06-09 13:43:05 +0800213TRACE_EVENT(block_bio_complete,
214
215 TP_PROTO(struct request_queue *q, struct bio *bio),
216
217 TP_ARGS(q, bio),
218
219 TP_STRUCT__entry(
220 __field( dev_t, dev )
221 __field( sector_t, sector )
222 __field( unsigned, nr_sector )
223 __field( int, error )
224 __array( char, rwbs, 6 )
225 ),
226
227 TP_fast_assign(
228 __entry->dev = bio->bi_bdev->bd_dev;
229 __entry->sector = bio->bi_sector;
230 __entry->nr_sector = bio->bi_size >> 9;
231 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
232 ),
233
234 TP_printk("%d,%d %s %llu + %u [%d]",
235 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
Steven Rostedt6556d1d2009-06-09 14:04:26 -0400236 (unsigned long long)__entry->sector,
237 __entry->nr_sector, __entry->error)
Li Zefan55782132009-06-09 13:43:05 +0800238);
239
Li Zefan77ca1e02009-11-26 15:06:14 +0800240DECLARE_EVENT_CLASS(block_bio,
Li Zefan55782132009-06-09 13:43:05 +0800241
242 TP_PROTO(struct request_queue *q, struct bio *bio),
243
244 TP_ARGS(q, bio),
245
246 TP_STRUCT__entry(
247 __field( dev_t, dev )
248 __field( sector_t, sector )
249 __field( unsigned int, nr_sector )
250 __array( char, rwbs, 6 )
251 __array( char, comm, TASK_COMM_LEN )
252 ),
253
254 TP_fast_assign(
255 __entry->dev = bio->bi_bdev->bd_dev;
256 __entry->sector = bio->bi_sector;
257 __entry->nr_sector = bio->bi_size >> 9;
258 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
259 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
260 ),
261
262 TP_printk("%d,%d %s %llu + %u [%s]",
263 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
Steven Rostedt6556d1d2009-06-09 14:04:26 -0400264 (unsigned long long)__entry->sector,
265 __entry->nr_sector, __entry->comm)
Li Zefan55782132009-06-09 13:43:05 +0800266);
267
William Cohen881245d2010-03-09 09:26:04 +0100268/**
269 * block_bio_backmerge - merging block operation to the end of an existing operation
270 * @q: queue holding operation
271 * @bio: new block operation to merge
272 *
273 * Merging block request @bio to the end of an existing block request
274 * in queue @q.
275 */
Li Zefan77ca1e02009-11-26 15:06:14 +0800276DEFINE_EVENT(block_bio, block_bio_backmerge,
Li Zefan55782132009-06-09 13:43:05 +0800277
278 TP_PROTO(struct request_queue *q, struct bio *bio),
279
Li Zefan77ca1e02009-11-26 15:06:14 +0800280 TP_ARGS(q, bio)
Li Zefan55782132009-06-09 13:43:05 +0800281);
282
William Cohen881245d2010-03-09 09:26:04 +0100283/**
284 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
285 * @q: queue holding operation
286 * @bio: new block operation to merge
287 *
288 * Merging block IO operation @bio to the beginning of an existing block
289 * operation in queue @q.
290 */
Li Zefan77ca1e02009-11-26 15:06:14 +0800291DEFINE_EVENT(block_bio, block_bio_frontmerge,
Li Zefan55782132009-06-09 13:43:05 +0800292
293 TP_PROTO(struct request_queue *q, struct bio *bio),
294
Li Zefan77ca1e02009-11-26 15:06:14 +0800295 TP_ARGS(q, bio)
Li Zefan55782132009-06-09 13:43:05 +0800296);
297
William Cohen881245d2010-03-09 09:26:04 +0100298/**
299 * block_bio_queue - putting new block IO operation in queue
300 * @q: queue holding operation
301 * @bio: new block operation
302 *
303 * About to place the block IO operation @bio into queue @q.
304 */
Li Zefan77ca1e02009-11-26 15:06:14 +0800305DEFINE_EVENT(block_bio, block_bio_queue,
306
307 TP_PROTO(struct request_queue *q, struct bio *bio),
308
309 TP_ARGS(q, bio)
310);
311
312DECLARE_EVENT_CLASS(block_get_rq,
Li Zefan55782132009-06-09 13:43:05 +0800313
314 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
315
316 TP_ARGS(q, bio, rw),
317
318 TP_STRUCT__entry(
319 __field( dev_t, dev )
320 __field( sector_t, sector )
321 __field( unsigned int, nr_sector )
322 __array( char, rwbs, 6 )
323 __array( char, comm, TASK_COMM_LEN )
324 ),
325
326 TP_fast_assign(
327 __entry->dev = bio ? bio->bi_bdev->bd_dev : 0;
328 __entry->sector = bio ? bio->bi_sector : 0;
329 __entry->nr_sector = bio ? bio->bi_size >> 9 : 0;
330 blk_fill_rwbs(__entry->rwbs,
331 bio ? bio->bi_rw : 0, __entry->nr_sector);
332 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
333 ),
334
335 TP_printk("%d,%d %s %llu + %u [%s]",
336 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
Steven Rostedt6556d1d2009-06-09 14:04:26 -0400337 (unsigned long long)__entry->sector,
338 __entry->nr_sector, __entry->comm)
Li Zefan55782132009-06-09 13:43:05 +0800339);
340
William Cohen881245d2010-03-09 09:26:04 +0100341/**
342 * block_getrq - get a free request entry in queue for block IO operations
343 * @q: queue for operations
344 * @bio: pending block IO operation
345 * @rw: low bit indicates a read (%0) or a write (%1)
346 *
347 * A request struct for queue @q has been allocated to handle the
348 * block IO operation @bio.
349 */
Li Zefan77ca1e02009-11-26 15:06:14 +0800350DEFINE_EVENT(block_get_rq, block_getrq,
Li Zefan55782132009-06-09 13:43:05 +0800351
352 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
353
Li Zefan77ca1e02009-11-26 15:06:14 +0800354 TP_ARGS(q, bio, rw)
355);
Li Zefan55782132009-06-09 13:43:05 +0800356
William Cohen881245d2010-03-09 09:26:04 +0100357/**
358 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
359 * @q: queue for operation
360 * @bio: pending block IO operation
361 * @rw: low bit indicates a read (%0) or a write (%1)
362 *
363 * In the case where a request struct cannot be provided for queue @q
364 * the process needs to wait for an request struct to become
365 * available. This tracepoint event is generated each time the
366 * process goes to sleep waiting for request struct become available.
367 */
Li Zefan77ca1e02009-11-26 15:06:14 +0800368DEFINE_EVENT(block_get_rq, block_sleeprq,
Li Zefan55782132009-06-09 13:43:05 +0800369
Li Zefan77ca1e02009-11-26 15:06:14 +0800370 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
Li Zefan55782132009-06-09 13:43:05 +0800371
Li Zefan77ca1e02009-11-26 15:06:14 +0800372 TP_ARGS(q, bio, rw)
Li Zefan55782132009-06-09 13:43:05 +0800373);
374
William Cohen881245d2010-03-09 09:26:04 +0100375/**
376 * block_plug - keep operations requests in request queue
377 * @q: request queue to plug
378 *
379 * Plug the request queue @q. Do not allow block operation requests
380 * to be sent to the device driver. Instead, accumulate requests in
381 * the queue to improve throughput performance of the block device.
382 */
Li Zefan55782132009-06-09 13:43:05 +0800383TRACE_EVENT(block_plug,
384
385 TP_PROTO(struct request_queue *q),
386
387 TP_ARGS(q),
388
389 TP_STRUCT__entry(
390 __array( char, comm, TASK_COMM_LEN )
391 ),
392
393 TP_fast_assign(
394 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
395 ),
396
397 TP_printk("[%s]", __entry->comm)
398);
399
Li Zefan77ca1e02009-11-26 15:06:14 +0800400DECLARE_EVENT_CLASS(block_unplug,
Li Zefan55782132009-06-09 13:43:05 +0800401
402 TP_PROTO(struct request_queue *q),
403
404 TP_ARGS(q),
405
406 TP_STRUCT__entry(
407 __field( int, nr_rq )
408 __array( char, comm, TASK_COMM_LEN )
409 ),
410
411 TP_fast_assign(
412 __entry->nr_rq = q->rq.count[READ] + q->rq.count[WRITE];
413 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
414 ),
415
416 TP_printk("[%s] %d", __entry->comm, __entry->nr_rq)
417);
418
William Cohen881245d2010-03-09 09:26:04 +0100419/**
420 * block_unplug_timer - timed release of operations requests in queue to device driver
421 * @q: request queue to unplug
422 *
423 * Unplug the request queue @q because a timer expired and allow block
424 * operation requests to be sent to the device driver.
425 */
Li Zefan77ca1e02009-11-26 15:06:14 +0800426DEFINE_EVENT(block_unplug, block_unplug_timer,
Li Zefan55782132009-06-09 13:43:05 +0800427
428 TP_PROTO(struct request_queue *q),
429
Li Zefan77ca1e02009-11-26 15:06:14 +0800430 TP_ARGS(q)
431);
Li Zefan55782132009-06-09 13:43:05 +0800432
William Cohen881245d2010-03-09 09:26:04 +0100433/**
434 * block_unplug_io - release of operations requests in request queue
435 * @q: request queue to unplug
436 *
437 * Unplug request queue @q because device driver is scheduled to work
438 * on elements in the request queue.
439 */
Li Zefan77ca1e02009-11-26 15:06:14 +0800440DEFINE_EVENT(block_unplug, block_unplug_io,
Li Zefan55782132009-06-09 13:43:05 +0800441
Li Zefan77ca1e02009-11-26 15:06:14 +0800442 TP_PROTO(struct request_queue *q),
Li Zefan55782132009-06-09 13:43:05 +0800443
Li Zefan77ca1e02009-11-26 15:06:14 +0800444 TP_ARGS(q)
Li Zefan55782132009-06-09 13:43:05 +0800445);
446
William Cohen881245d2010-03-09 09:26:04 +0100447/**
448 * block_split - split a single bio struct into two bio structs
449 * @q: queue containing the bio
450 * @bio: block operation being split
451 * @new_sector: The starting sector for the new bio
452 *
453 * The bio request @bio in request queue @q needs to be split into two
454 * bio requests. The newly created @bio request starts at
455 * @new_sector. This split may be required due to hardware limitation
456 * such as operation crossing device boundaries in a RAID system.
457 */
Li Zefan55782132009-06-09 13:43:05 +0800458TRACE_EVENT(block_split,
459
460 TP_PROTO(struct request_queue *q, struct bio *bio,
461 unsigned int new_sector),
462
463 TP_ARGS(q, bio, new_sector),
464
465 TP_STRUCT__entry(
466 __field( dev_t, dev )
467 __field( sector_t, sector )
468 __field( sector_t, new_sector )
469 __array( char, rwbs, 6 )
470 __array( char, comm, TASK_COMM_LEN )
471 ),
472
473 TP_fast_assign(
474 __entry->dev = bio->bi_bdev->bd_dev;
475 __entry->sector = bio->bi_sector;
476 __entry->new_sector = new_sector;
477 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
478 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
479 ),
480
481 TP_printk("%d,%d %s %llu / %llu [%s]",
482 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
Steven Rostedt6556d1d2009-06-09 14:04:26 -0400483 (unsigned long long)__entry->sector,
484 (unsigned long long)__entry->new_sector,
485 __entry->comm)
Li Zefan55782132009-06-09 13:43:05 +0800486);
487
William Cohen881245d2010-03-09 09:26:04 +0100488/**
489 * block_remap - map request for a partition to the raw device
490 * @q: queue holding the operation
491 * @bio: revised operation
492 * @dev: device for the operation
493 * @from: original sector for the operation
494 *
495 * An operation for a partition on a block device has been mapped to the
496 * raw block device.
497 */
Li Zefan55782132009-06-09 13:43:05 +0800498TRACE_EVENT(block_remap,
499
500 TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev,
501 sector_t from),
502
503 TP_ARGS(q, bio, dev, from),
504
505 TP_STRUCT__entry(
506 __field( dev_t, dev )
507 __field( sector_t, sector )
508 __field( unsigned int, nr_sector )
509 __field( dev_t, old_dev )
510 __field( sector_t, old_sector )
511 __array( char, rwbs, 6 )
512 ),
513
514 TP_fast_assign(
515 __entry->dev = bio->bi_bdev->bd_dev;
516 __entry->sector = bio->bi_sector;
517 __entry->nr_sector = bio->bi_size >> 9;
518 __entry->old_dev = dev;
519 __entry->old_sector = from;
520 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
521 ),
522
523 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
524 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
Steven Rostedt6556d1d2009-06-09 14:04:26 -0400525 (unsigned long long)__entry->sector,
526 __entry->nr_sector,
Li Zefan55782132009-06-09 13:43:05 +0800527 MAJOR(__entry->old_dev), MINOR(__entry->old_dev),
Steven Rostedt6556d1d2009-06-09 14:04:26 -0400528 (unsigned long long)__entry->old_sector)
Li Zefan55782132009-06-09 13:43:05 +0800529);
530
William Cohen881245d2010-03-09 09:26:04 +0100531/**
532 * block_rq_remap - map request for a block operation request
533 * @q: queue holding the operation
534 * @rq: block IO operation request
535 * @dev: device for the operation
536 * @from: original sector for the operation
537 *
538 * The block operation request @rq in @q has been remapped. The block
539 * operation request @rq holds the current information and @from hold
540 * the original sector.
541 */
Jun'ichi Nomurab0da3f02009-10-01 21:16:13 +0200542TRACE_EVENT(block_rq_remap,
543
544 TP_PROTO(struct request_queue *q, struct request *rq, dev_t dev,
545 sector_t from),
546
547 TP_ARGS(q, rq, dev, from),
548
549 TP_STRUCT__entry(
550 __field( dev_t, dev )
551 __field( sector_t, sector )
552 __field( unsigned int, nr_sector )
553 __field( dev_t, old_dev )
554 __field( sector_t, old_sector )
555 __array( char, rwbs, 6 )
556 ),
557
558 TP_fast_assign(
559 __entry->dev = disk_devt(rq->rq_disk);
560 __entry->sector = blk_rq_pos(rq);
561 __entry->nr_sector = blk_rq_sectors(rq);
562 __entry->old_dev = dev;
563 __entry->old_sector = from;
564 blk_fill_rwbs_rq(__entry->rwbs, rq);
565 ),
566
567 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
568 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
569 (unsigned long long)__entry->sector,
570 __entry->nr_sector,
571 MAJOR(__entry->old_dev), MINOR(__entry->old_dev),
572 (unsigned long long)__entry->old_sector)
573);
574
Li Zefan55782132009-06-09 13:43:05 +0800575#endif /* _TRACE_BLOCK_H */
576
577/* This part must be outside protection */
578#include <trace/define_trace.h>
579