]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - include/trace/events/block.h
block: split out request-only flags into a new namespace
[mirror_ubuntu-artful-kernel.git] / include / trace / events / block.h
CommitLineData
d0b6e04a
LZ
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM block
3
55782138
LZ
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>
5305cb83 9#include <linux/buffer_head.h>
55782138
LZ
10#include <linux/tracepoint.h>
11
c09c47ca
NK
12#define RWBS_LEN 8
13
5305cb83
TH
14DECLARE_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 */
44DEFINE_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 */
57DEFINE_EVENT(block_buffer, block_dirty_buffer,
58
59 TP_PROTO(struct buffer_head *bh),
60
61 TP_ARGS(bh)
62);
63
77ca1e02 64DECLARE_EVENT_CLASS(block_rq_with_error,
55782138
LZ
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 )
c09c47ca 75 __array( char, rwbs, RWBS_LEN )
55782138
LZ
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;
33659ebb
CH
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);
55782138
LZ
85 __entry->errors = rq->errors;
86
1b9a9ab7
MC
87 blk_fill_rwbs(__entry->rwbs, req_op(rq), rq->cmd_flags,
88 blk_rq_bytes(rq));
55782138
LZ
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),
6556d1df
SR
95 (unsigned long long)__entry->sector,
96 __entry->nr_sector, __entry->errors)
55782138
LZ
97);
98
881245dc
WC
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 */
77ca1e02 109DEFINE_EVENT(block_rq_with_error, block_rq_abort,
55782138
LZ
110
111 TP_PROTO(struct request_queue *q, struct request *rq),
112
77ca1e02
LZ
113 TP_ARGS(q, rq)
114);
55782138 115
881245dc
WC
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 */
77ca1e02 125DEFINE_EVENT(block_rq_with_error, block_rq_requeue,
55782138 126
77ca1e02 127 TP_PROTO(struct request_queue *q, struct request *rq),
55782138 128
77ca1e02
LZ
129 TP_ARGS(q, rq)
130);
55782138 131
881245dc
WC
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
af5040da 136 * @nr_bytes: number of completed bytes
881245dc
WC
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 */
af5040da 144TRACE_EVENT(block_rq_complete,
77ca1e02 145
af5040da
RP
146 TP_PROTO(struct request_queue *q, struct request *rq,
147 unsigned int nr_bytes),
77ca1e02 148
af5040da
RP
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
1b9a9ab7 166 blk_fill_rwbs(__entry->rwbs, req_op(rq), rq->cmd_flags, nr_bytes);
af5040da
RP
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)
55782138
LZ
175);
176
77ca1e02 177DECLARE_EVENT_CLASS(block_rq,
55782138
LZ
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 )
c09c47ca 188 __array( char, rwbs, RWBS_LEN )
77ca1e02 189 __array( char, comm, TASK_COMM_LEN )
55782138
LZ
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;
33659ebb
CH
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;
55782138 201
1b9a9ab7
MC
202 blk_fill_rwbs(__entry->rwbs, req_op(rq), rq->cmd_flags,
203 blk_rq_bytes(rq));
55782138
LZ
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),
6556d1df
SR
211 (unsigned long long)__entry->sector,
212 __entry->nr_sector, __entry->comm)
55782138
LZ
213);
214
881245dc
WC
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 */
77ca1e02 225DEFINE_EVENT(block_rq, block_rq_insert,
55782138
LZ
226
227 TP_PROTO(struct request_queue *q, struct request *rq),
228
77ca1e02 229 TP_ARGS(q, rq)
55782138
LZ
230);
231
881245dc
WC
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 */
77ca1e02 240DEFINE_EVENT(block_rq, block_rq_issue,
55782138
LZ
241
242 TP_PROTO(struct request_queue *q, struct request *rq),
243
77ca1e02 244 TP_ARGS(q, rq)
55782138 245);
fe63b94a 246
881245dc
WC
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 */
55782138
LZ
258TRACE_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 )
c09c47ca 268 __array( char, rwbs, RWBS_LEN )
55782138
LZ
269 __array( char, comm, TASK_COMM_LEN )
270 ),
271
272 TP_fast_assign(
fe63b94a
CE
273 __entry->dev = bio->bi_bdev ?
274 bio->bi_bdev->bd_dev : 0;
4f024f37 275 __entry->sector = bio->bi_iter.bi_sector;
aa8b57aa 276 __entry->nr_sector = bio_sectors(bio);
1eff9d32 277 blk_fill_rwbs(__entry->rwbs, bio_op(bio), bio->bi_opf,
1b9a9ab7 278 bio->bi_iter.bi_size);
55782138
LZ
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,
6556d1df
SR
284 (unsigned long long)__entry->sector,
285 __entry->nr_sector, __entry->comm)
55782138
LZ
286);
287
881245dc
WC
288/**
289 * block_bio_complete - completed all work on the block operation
0a82a8d1 290 * @q: queue holding the block operation
881245dc 291 * @bio: block operation completed
b7908c10 292 * @error: io error value
881245dc
WC
293 *
294 * This tracepoint indicates there is no further work to do on this
295 * block IO operation @bio.
296 */
55782138
LZ
297TRACE_EVENT(block_bio_complete,
298
0a82a8d1 299 TP_PROTO(struct request_queue *q, struct bio *bio, int error),
55782138 300
0a82a8d1 301 TP_ARGS(q, bio, error),
55782138
LZ
302
303 TP_STRUCT__entry(
304 __field( dev_t, dev )
305 __field( sector_t, sector )
306 __field( unsigned, nr_sector )
307 __field( int, error )
c09c47ca 308 __array( char, rwbs, RWBS_LEN)
55782138
LZ
309 ),
310
311 TP_fast_assign(
0a82a8d1 312 __entry->dev = bio->bi_bdev->bd_dev;
4f024f37 313 __entry->sector = bio->bi_iter.bi_sector;
aa8b57aa 314 __entry->nr_sector = bio_sectors(bio);
b7908c10 315 __entry->error = error;
1eff9d32 316 blk_fill_rwbs(__entry->rwbs, bio_op(bio), bio->bi_opf,
1b9a9ab7 317 bio->bi_iter.bi_size);
55782138
LZ
318 ),
319
320 TP_printk("%d,%d %s %llu + %u [%d]",
321 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
6556d1df
SR
322 (unsigned long long)__entry->sector,
323 __entry->nr_sector, __entry->error)
55782138
LZ
324);
325
8c1cf6bb 326DECLARE_EVENT_CLASS(block_bio_merge,
55782138 327
8c1cf6bb 328 TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
55782138 329
8c1cf6bb 330 TP_ARGS(q, rq, bio),
55782138
LZ
331
332 TP_STRUCT__entry(
333 __field( dev_t, dev )
334 __field( sector_t, sector )
335 __field( unsigned int, nr_sector )
c09c47ca 336 __array( char, rwbs, RWBS_LEN )
55782138
LZ
337 __array( char, comm, TASK_COMM_LEN )
338 ),
339
340 TP_fast_assign(
341 __entry->dev = bio->bi_bdev->bd_dev;
4f024f37 342 __entry->sector = bio->bi_iter.bi_sector;
aa8b57aa 343 __entry->nr_sector = bio_sectors(bio);
1eff9d32 344 blk_fill_rwbs(__entry->rwbs, bio_op(bio), bio->bi_opf,
1b9a9ab7 345 bio->bi_iter.bi_size);
55782138
LZ
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,
6556d1df
SR
351 (unsigned long long)__entry->sector,
352 __entry->nr_sector, __entry->comm)
55782138
LZ
353);
354
881245dc
WC
355/**
356 * block_bio_backmerge - merging block operation to the end of an existing operation
357 * @q: queue holding operation
8c1cf6bb 358 * @rq: request bio is being merged into
881245dc
WC
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 */
8c1cf6bb 364DEFINE_EVENT(block_bio_merge, block_bio_backmerge,
55782138 365
8c1cf6bb 366 TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
55782138 367
8c1cf6bb 368 TP_ARGS(q, rq, bio)
55782138
LZ
369);
370
881245dc
WC
371/**
372 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
373 * @q: queue holding operation
8c1cf6bb 374 * @rq: request bio is being merged into
881245dc
WC
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 */
8c1cf6bb 380DEFINE_EVENT(block_bio_merge, block_bio_frontmerge,
55782138 381
8c1cf6bb 382 TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
55782138 383
8c1cf6bb 384 TP_ARGS(q, rq, bio)
77ca1e02 385);
55782138 386
881245dc
WC
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 */
8c1cf6bb 394TRACE_EVENT(block_bio_queue,
55782138 395
77ca1e02 396 TP_PROTO(struct request_queue *q, struct bio *bio),
55782138 397
8c1cf6bb
TH
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;
4f024f37 410 __entry->sector = bio->bi_iter.bi_sector;
aa8b57aa 411 __entry->nr_sector = bio_sectors(bio);
1eff9d32 412 blk_fill_rwbs(__entry->rwbs, bio_op(bio), bio->bi_opf,
1b9a9ab7 413 bio->bi_iter.bi_size);
8c1cf6bb
TH
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)
55782138
LZ
421);
422
77ca1e02 423DECLARE_EVENT_CLASS(block_get_rq,
55782138
LZ
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 )
c09c47ca 433 __array( char, rwbs, RWBS_LEN )
55782138
LZ
434 __array( char, comm, TASK_COMM_LEN )
435 ),
436
437 TP_fast_assign(
438 __entry->dev = bio ? bio->bi_bdev->bd_dev : 0;
4f024f37 439 __entry->sector = bio ? bio->bi_iter.bi_sector : 0;
aa8b57aa 440 __entry->nr_sector = bio ? bio_sectors(bio) : 0;
1b9a9ab7 441 blk_fill_rwbs(__entry->rwbs, bio ? bio_op(bio) : 0,
1eff9d32 442 bio ? bio->bi_opf : 0, __entry->nr_sector);
55782138
LZ
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,
6556d1df
SR
448 (unsigned long long)__entry->sector,
449 __entry->nr_sector, __entry->comm)
55782138
LZ
450);
451
881245dc
WC
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 */
77ca1e02 461DEFINE_EVENT(block_get_rq, block_getrq,
55782138
LZ
462
463 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
464
77ca1e02
LZ
465 TP_ARGS(q, bio, rw)
466);
55782138 467
881245dc
WC
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 */
77ca1e02 479DEFINE_EVENT(block_get_rq, block_sleeprq,
55782138 480
77ca1e02 481 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
55782138 482
77ca1e02 483 TP_ARGS(q, bio, rw)
55782138
LZ
484);
485
881245dc
WC
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 */
55782138
LZ
494TRACE_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
77ca1e02 511DECLARE_EVENT_CLASS(block_unplug,
55782138 512
49cac01e 513 TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit),
55782138 514
49cac01e 515 TP_ARGS(q, depth, explicit),
55782138
LZ
516
517 TP_STRUCT__entry(
518 __field( int, nr_rq )
519 __array( char, comm, TASK_COMM_LEN )
520 ),
521
522 TP_fast_assign(
94b5eb28 523 __entry->nr_rq = depth;
55782138
LZ
524 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
525 ),
526
527 TP_printk("[%s] %d", __entry->comm, __entry->nr_rq)
528);
529
881245dc 530/**
49cac01e 531 * block_unplug - release of operations requests in request queue
881245dc 532 * @q: request queue to unplug
94b5eb28 533 * @depth: number of requests just added to the queue
49cac01e 534 * @explicit: whether this was an explicit unplug, or one from schedule()
881245dc
WC
535 *
536 * Unplug request queue @q because device driver is scheduled to work
537 * on elements in the request queue.
538 */
49cac01e 539DEFINE_EVENT(block_unplug, block_unplug,
55782138 540
49cac01e 541 TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit),
55782138 542
49cac01e 543 TP_ARGS(q, depth, explicit)
55782138
LZ
544);
545
881245dc
WC
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 */
55782138
LZ
557TRACE_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 )
c09c47ca 568 __array( char, rwbs, RWBS_LEN )
55782138
LZ
569 __array( char, comm, TASK_COMM_LEN )
570 ),
571
572 TP_fast_assign(
573 __entry->dev = bio->bi_bdev->bd_dev;
4f024f37 574 __entry->sector = bio->bi_iter.bi_sector;
55782138 575 __entry->new_sector = new_sector;
1eff9d32 576 blk_fill_rwbs(__entry->rwbs, bio_op(bio), bio->bi_opf,
1b9a9ab7 577 bio->bi_iter.bi_size);
55782138
LZ
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,
6556d1df
SR
583 (unsigned long long)__entry->sector,
584 (unsigned long long)__entry->new_sector,
585 __entry->comm)
55782138
LZ
586);
587
881245dc 588/**
d07335e5 589 * block_bio_remap - map request for a logical device to the raw device
881245dc
WC
590 * @q: queue holding the operation
591 * @bio: revised operation
592 * @dev: device for the operation
593 * @from: original sector for the operation
594 *
d07335e5 595 * An operation for a logical device has been mapped to the
881245dc
WC
596 * raw block device.
597 */
d07335e5 598TRACE_EVENT(block_bio_remap,
55782138
LZ
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 )
c09c47ca 611 __array( char, rwbs, RWBS_LEN)
55782138
LZ
612 ),
613
614 TP_fast_assign(
615 __entry->dev = bio->bi_bdev->bd_dev;
4f024f37 616 __entry->sector = bio->bi_iter.bi_sector;
aa8b57aa 617 __entry->nr_sector = bio_sectors(bio);
55782138
LZ
618 __entry->old_dev = dev;
619 __entry->old_sector = from;
1eff9d32 620 blk_fill_rwbs(__entry->rwbs, bio_op(bio), bio->bi_opf,
1b9a9ab7 621 bio->bi_iter.bi_size);
55782138
LZ
622 ),
623
624 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
625 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
6556d1df
SR
626 (unsigned long long)__entry->sector,
627 __entry->nr_sector,
55782138 628 MAJOR(__entry->old_dev), MINOR(__entry->old_dev),
6556d1df 629 (unsigned long long)__entry->old_sector)
55782138
LZ
630);
631
881245dc
WC
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 */
b0da3f0d
JN
643TRACE_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 )
75afb352 656 __field( unsigned int, nr_bios )
c09c47ca 657 __array( char, rwbs, RWBS_LEN)
b0da3f0d
JN
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;
75afb352 666 __entry->nr_bios = blk_rq_count_bios(rq);
1b9a9ab7
MC
667 blk_fill_rwbs(__entry->rwbs, req_op(rq), rq->cmd_flags,
668 blk_rq_bytes(rq));
b0da3f0d
JN
669 ),
670
75afb352 671 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu %u",
b0da3f0d
JN
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),
75afb352 676 (unsigned long long)__entry->old_sector, __entry->nr_bios)
b0da3f0d
JN
677);
678
55782138
LZ
679#endif /* _TRACE_BLOCK_H */
680
681/* This part must be outside protection */
682#include <trace/define_trace.h>
683