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