Commit | Line | Data |
---|---|---|
f62b389e MD |
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> | |
7c68b363 AG |
11 | #include <linux/version.h> |
12 | ||
13 | #define RWBS_LEN 8 | |
f62b389e MD |
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), | |
7c68b363 AG |
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), | |
f62b389e MD |
31 | }; |
32 | ||
33 | #endif /* _TRACE_BLOCK_DEF_ */ | |
34 | ||
35 | #define __print_rwbs_flags(rwbs) \ | |
36 | __print_flags(rwbs, "", \ | |
7c68b363 | 37 | { RWBS_FLAG_FLUSH, "F" }, \ |
f62b389e MD |
38 | { RWBS_FLAG_WRITE, "W" }, \ |
39 | { RWBS_FLAG_DISCARD, "D" }, \ | |
40 | { RWBS_FLAG_READ, "R" }, \ | |
7c68b363 | 41 | { RWBS_FLAG_FUA, "F" }, \ |
f62b389e | 42 | { RWBS_FLAG_RAHEAD, "A" }, \ |
7c68b363 | 43 | { RWBS_FLAG_BARRIER, "B" }, \ |
f62b389e MD |
44 | { RWBS_FLAG_SYNC, "S" }, \ |
45 | { RWBS_FLAG_META, "M" }, \ | |
46 | { RWBS_FLAG_SECURE, "E" }) | |
47 | ||
7c68b363 AG |
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 | ||
f62b389e MD |
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 | ||
7c68b363 AG |
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 | ||
217f66c6 MD |
101 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
102 | DECLARE_EVENT_CLASS(block_buffer, | |
103 | ||
104 | TP_PROTO(struct buffer_head *bh), | |
105 | ||
106 | TP_ARGS(bh), | |
107 | ||
108 | TP_STRUCT__entry ( | |
109 | __field( dev_t, dev ) | |
110 | __field( sector_t, sector ) | |
111 | __field( size_t, size ) | |
112 | ), | |
113 | ||
114 | TP_fast_assign( | |
115 | tp_assign(dev, bh->b_bdev->bd_dev) | |
116 | tp_assign(sector, bh->b_blocknr) | |
117 | tp_assign(size, bh->b_size) | |
118 | ), | |
119 | ||
120 | TP_printk("%d,%d sector=%llu size=%zu", | |
121 | MAJOR(__entry->dev), MINOR(__entry->dev), | |
122 | (unsigned long long)__entry->sector, __entry->size | |
123 | ) | |
124 | ) | |
125 | ||
126 | /** | |
127 | * block_touch_buffer - mark a buffer accessed | |
128 | * @bh: buffer_head being touched | |
129 | * | |
130 | * Called from touch_buffer(). | |
131 | */ | |
132 | DEFINE_EVENT(block_buffer, block_touch_buffer, | |
133 | ||
134 | TP_PROTO(struct buffer_head *bh), | |
135 | ||
136 | TP_ARGS(bh) | |
137 | ) | |
138 | ||
139 | /** | |
140 | * block_dirty_buffer - mark a buffer dirty | |
141 | * @bh: buffer_head being dirtied | |
142 | * | |
143 | * Called from mark_buffer_dirty(). | |
144 | */ | |
145 | DEFINE_EVENT(block_buffer, block_dirty_buffer, | |
146 | ||
147 | TP_PROTO(struct buffer_head *bh), | |
148 | ||
149 | TP_ARGS(bh) | |
150 | ) | |
151 | #endif | |
152 | ||
f62b389e MD |
153 | DECLARE_EVENT_CLASS(block_rq_with_error, |
154 | ||
155 | TP_PROTO(struct request_queue *q, struct request *rq), | |
156 | ||
157 | TP_ARGS(q, rq), | |
158 | ||
159 | TP_STRUCT__entry( | |
160 | __field( dev_t, dev ) | |
161 | __field( sector_t, sector ) | |
162 | __field( unsigned int, nr_sector ) | |
163 | __field( int, errors ) | |
164 | __field( unsigned int, rwbs ) | |
16830439 MD |
165 | __dynamic_array_hex( unsigned char, cmd, |
166 | (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? | |
167 | rq->cmd_len : 0) | |
f62b389e MD |
168 | ), |
169 | ||
170 | TP_fast_assign( | |
171 | tp_assign(dev, rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
172 | tp_assign(sector, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? | |
173 | 0 : blk_rq_pos(rq)) | |
174 | tp_assign(nr_sector, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? | |
175 | 0 : blk_rq_sectors(rq)) | |
176 | tp_assign(errors, rq->errors) | |
177 | blk_fill_rwbs(rwbs, rq->cmd_flags, blk_rq_bytes(rq)) | |
e17d7b27 | 178 | tp_memcpy_dyn(cmd, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? |
217f66c6 | 179 | rq->cmd : NULL) |
f62b389e MD |
180 | ), |
181 | ||
182 | TP_printk("%d,%d %s (%s) %llu + %u [%d]", | |
183 | MAJOR(__entry->dev), MINOR(__entry->dev), | |
184 | __print_rwbs_flags(__entry->rwbs), | |
185 | __blk_dump_cmd(__get_dynamic_array(cmd), | |
186 | __get_dynamic_array_len(cmd)), | |
187 | (unsigned long long)__entry->sector, | |
188 | __entry->nr_sector, __entry->errors) | |
189 | ) | |
190 | ||
191 | /** | |
192 | * block_rq_abort - abort block operation request | |
193 | * @q: queue containing the block operation request | |
194 | * @rq: block IO operation request | |
195 | * | |
196 | * Called immediately after pending block IO operation request @rq in | |
197 | * queue @q is aborted. The fields in the operation request @rq | |
198 | * can be examined to determine which device and sectors the pending | |
199 | * operation would access. | |
200 | */ | |
201 | DEFINE_EVENT(block_rq_with_error, block_rq_abort, | |
202 | ||
203 | TP_PROTO(struct request_queue *q, struct request *rq), | |
204 | ||
205 | TP_ARGS(q, rq) | |
206 | ) | |
207 | ||
208 | /** | |
209 | * block_rq_requeue - place block IO request back on a queue | |
210 | * @q: queue holding operation | |
211 | * @rq: block IO operation request | |
212 | * | |
213 | * The block operation request @rq is being placed back into queue | |
214 | * @q. For some reason the request was not completed and needs to be | |
215 | * put back in the queue. | |
216 | */ | |
217 | DEFINE_EVENT(block_rq_with_error, block_rq_requeue, | |
218 | ||
219 | TP_PROTO(struct request_queue *q, struct request *rq), | |
220 | ||
221 | TP_ARGS(q, rq) | |
222 | ) | |
223 | ||
1c53e689 MD |
224 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) |
225 | ||
226 | /** | |
227 | * block_rq_complete - block IO operation completed by device driver | |
228 | * @q: queue containing the block operation request | |
229 | * @rq: block operations request | |
230 | * @nr_bytes: number of completed bytes | |
231 | * | |
232 | * The block_rq_complete tracepoint event indicates that some portion | |
233 | * of operation request has been completed by the device driver. If | |
234 | * the @rq->bio is %NULL, then there is absolutely no additional work to | |
235 | * do for the request. If @rq->bio is non-NULL then there is | |
236 | * additional work required to complete the request. | |
237 | */ | |
238 | TRACE_EVENT(block_rq_complete, | |
239 | ||
240 | TP_PROTO(struct request_queue *q, struct request *rq, | |
241 | unsigned int nr_bytes), | |
242 | ||
243 | TP_ARGS(q, rq, nr_bytes), | |
244 | ||
245 | TP_STRUCT__entry( | |
246 | __field( dev_t, dev ) | |
247 | __field( sector_t, sector ) | |
248 | __field( unsigned int, nr_sector ) | |
249 | __field( int, errors ) | |
250 | __field( unsigned int, rwbs ) | |
251 | __dynamic_array_hex( unsigned char, cmd, | |
252 | (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? | |
253 | rq->cmd_len : 0) | |
254 | ), | |
255 | ||
256 | TP_fast_assign( | |
257 | tp_assign(dev, rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
258 | tp_assign(sector, blk_rq_pos(rq)) | |
259 | tp_assign(nr_sector, nr_bytes >> 9) | |
260 | tp_assign(errors, rq->errors) | |
261 | blk_fill_rwbs(rwbs, rq->cmd_flags, nr_bytes) | |
262 | tp_memcpy_dyn(cmd, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? | |
263 | rq->cmd : NULL) | |
264 | ), | |
265 | ||
266 | TP_printk("%d,%d %s (%s) %llu + %u [%d]", | |
267 | MAJOR(__entry->dev), MINOR(__entry->dev), | |
268 | __entry->rwbs, __get_str(cmd), | |
269 | (unsigned long long)__entry->sector, | |
270 | __entry->nr_sector, __entry->errors) | |
271 | ) | |
272 | ||
273 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */ | |
274 | ||
f62b389e MD |
275 | /** |
276 | * block_rq_complete - block IO operation completed by device driver | |
277 | * @q: queue containing the block operation request | |
278 | * @rq: block operations request | |
279 | * | |
280 | * The block_rq_complete tracepoint event indicates that some portion | |
281 | * of operation request has been completed by the device driver. If | |
282 | * the @rq->bio is %NULL, then there is absolutely no additional work to | |
283 | * do for the request. If @rq->bio is non-NULL then there is | |
284 | * additional work required to complete the request. | |
285 | */ | |
286 | DEFINE_EVENT(block_rq_with_error, block_rq_complete, | |
287 | ||
288 | TP_PROTO(struct request_queue *q, struct request *rq), | |
289 | ||
290 | TP_ARGS(q, rq) | |
291 | ) | |
292 | ||
1c53e689 MD |
293 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */ |
294 | ||
f62b389e MD |
295 | DECLARE_EVENT_CLASS(block_rq, |
296 | ||
297 | TP_PROTO(struct request_queue *q, struct request *rq), | |
298 | ||
299 | TP_ARGS(q, rq), | |
300 | ||
301 | TP_STRUCT__entry( | |
302 | __field( dev_t, dev ) | |
303 | __field( sector_t, sector ) | |
304 | __field( unsigned int, nr_sector ) | |
305 | __field( unsigned int, bytes ) | |
306 | __field( unsigned int, rwbs ) | |
64c796d8 | 307 | __array_text( char, comm, TASK_COMM_LEN ) |
16830439 MD |
308 | __dynamic_array_hex( unsigned char, cmd, |
309 | (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? | |
310 | rq->cmd_len : 0) | |
f62b389e MD |
311 | ), |
312 | ||
313 | TP_fast_assign( | |
314 | tp_assign(dev, rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
315 | tp_assign(sector, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? | |
316 | 0 : blk_rq_pos(rq)) | |
317 | tp_assign(nr_sector, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? | |
318 | 0 : blk_rq_sectors(rq)) | |
319 | tp_assign(bytes, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? | |
320 | blk_rq_bytes(rq) : 0) | |
321 | blk_fill_rwbs(rwbs, rq->cmd_flags, blk_rq_bytes(rq)) | |
e17d7b27 | 322 | tp_memcpy_dyn(cmd, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? |
217f66c6 | 323 | rq->cmd : NULL) |
f62b389e MD |
324 | tp_memcpy(comm, current->comm, TASK_COMM_LEN) |
325 | ), | |
326 | ||
327 | TP_printk("%d,%d %s %u (%s) %llu + %u [%s]", | |
328 | MAJOR(__entry->dev), MINOR(__entry->dev), | |
329 | __print_rwbs_flags(__entry->rwbs), | |
330 | __entry->bytes, | |
331 | __blk_dump_cmd(__get_dynamic_array(cmd), | |
332 | __get_dynamic_array_len(cmd)), | |
333 | (unsigned long long)__entry->sector, | |
334 | __entry->nr_sector, __entry->comm) | |
335 | ) | |
336 | ||
337 | /** | |
338 | * block_rq_insert - insert block operation request into queue | |
339 | * @q: target queue | |
340 | * @rq: block IO operation request | |
341 | * | |
342 | * Called immediately before block operation request @rq is inserted | |
343 | * into queue @q. The fields in the operation request @rq struct can | |
344 | * be examined to determine which device and sectors the pending | |
345 | * operation would access. | |
346 | */ | |
347 | DEFINE_EVENT(block_rq, block_rq_insert, | |
348 | ||
349 | TP_PROTO(struct request_queue *q, struct request *rq), | |
350 | ||
351 | TP_ARGS(q, rq) | |
352 | ) | |
353 | ||
354 | /** | |
355 | * block_rq_issue - issue pending block IO request operation to device driver | |
356 | * @q: queue holding operation | |
357 | * @rq: block IO operation operation request | |
358 | * | |
359 | * Called when block operation request @rq from queue @q is sent to a | |
360 | * device driver for processing. | |
361 | */ | |
362 | DEFINE_EVENT(block_rq, block_rq_issue, | |
363 | ||
364 | TP_PROTO(struct request_queue *q, struct request *rq), | |
365 | ||
366 | TP_ARGS(q, rq) | |
367 | ) | |
368 | ||
369 | /** | |
370 | * block_bio_bounce - used bounce buffer when processing block operation | |
371 | * @q: queue holding the block operation | |
372 | * @bio: block operation | |
373 | * | |
374 | * A bounce buffer was used to handle the block operation @bio in @q. | |
375 | * This occurs when hardware limitations prevent a direct transfer of | |
376 | * data between the @bio data memory area and the IO device. Use of a | |
377 | * bounce buffer requires extra copying of data and decreases | |
378 | * performance. | |
379 | */ | |
380 | TRACE_EVENT(block_bio_bounce, | |
381 | ||
382 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
383 | ||
384 | TP_ARGS(q, bio), | |
385 | ||
386 | TP_STRUCT__entry( | |
387 | __field( dev_t, dev ) | |
388 | __field( sector_t, sector ) | |
389 | __field( unsigned int, nr_sector ) | |
390 | __field( unsigned int, rwbs ) | |
64c796d8 | 391 | __array_text( char, comm, TASK_COMM_LEN ) |
f62b389e MD |
392 | ), |
393 | ||
394 | TP_fast_assign( | |
54c4c2e3 MD |
395 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
396 | tp_assign(dev, bio->bi_bdev ? | |
397 | bio->bi_bdev->bd_dev : 0) | |
398 | tp_assign(sector, bio->bi_iter.bi_sector) | |
399 | tp_assign(nr_sector, bio_sectors(bio)) | |
400 | blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_iter.bi_size) | |
401 | tp_memcpy(comm, current->comm, TASK_COMM_LEN) | |
402 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ | |
f62b389e MD |
403 | tp_assign(dev, bio->bi_bdev ? |
404 | bio->bi_bdev->bd_dev : 0) | |
405 | tp_assign(sector, bio->bi_sector) | |
406 | tp_assign(nr_sector, bio->bi_size >> 9) | |
407 | blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size) | |
408 | tp_memcpy(comm, current->comm, TASK_COMM_LEN) | |
54c4c2e3 | 409 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
f62b389e MD |
410 | ), |
411 | ||
412 | TP_printk("%d,%d %s %llu + %u [%s]", | |
413 | MAJOR(__entry->dev), MINOR(__entry->dev), | |
414 | __print_rwbs_flags(__entry->rwbs), | |
415 | (unsigned long long)__entry->sector, | |
416 | __entry->nr_sector, __entry->comm) | |
417 | ) | |
418 | ||
419 | /** | |
420 | * block_bio_complete - completed all work on the block operation | |
421 | * @q: queue holding the block operation | |
422 | * @bio: block operation completed | |
423 | * @error: io error value | |
424 | * | |
425 | * This tracepoint indicates there is no further work to do on this | |
426 | * block IO operation @bio. | |
427 | */ | |
428 | TRACE_EVENT(block_bio_complete, | |
429 | ||
1bc491fc | 430 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
f62b389e MD |
431 | TP_PROTO(struct request_queue *q, struct bio *bio, int error), |
432 | ||
433 | TP_ARGS(q, bio, error), | |
7c68b363 AG |
434 | #else |
435 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
436 | ||
437 | TP_ARGS(q, bio), | |
438 | #endif | |
f62b389e MD |
439 | |
440 | TP_STRUCT__entry( | |
441 | __field( dev_t, dev ) | |
442 | __field( sector_t, sector ) | |
443 | __field( unsigned, nr_sector ) | |
444 | __field( int, error ) | |
445 | __field( unsigned int, rwbs ) | |
446 | ), | |
447 | ||
448 | TP_fast_assign( | |
54c4c2e3 MD |
449 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
450 | tp_assign(dev, bio->bi_bdev->bd_dev) | |
451 | tp_assign(sector, bio->bi_iter.bi_sector) | |
452 | tp_assign(nr_sector, bio_sectors(bio)) | |
453 | tp_assign(error, error) | |
454 | blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_iter.bi_size) | |
455 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ | |
f62b389e MD |
456 | tp_assign(dev, bio->bi_bdev->bd_dev) |
457 | tp_assign(sector, bio->bi_sector) | |
458 | tp_assign(nr_sector, bio->bi_size >> 9) | |
7c68b363 | 459 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
f62b389e | 460 | tp_assign(error, error) |
7c68b363 AG |
461 | #else |
462 | tp_assign(error, 0) | |
463 | #endif | |
f62b389e | 464 | blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size) |
54c4c2e3 | 465 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
f62b389e MD |
466 | ), |
467 | ||
468 | TP_printk("%d,%d %s %llu + %u [%d]", | |
469 | MAJOR(__entry->dev), MINOR(__entry->dev), | |
470 | __print_rwbs_flags(__entry->rwbs), | |
471 | (unsigned long long)__entry->sector, | |
472 | __entry->nr_sector, __entry->error) | |
473 | ) | |
474 | ||
217f66c6 MD |
475 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
476 | DECLARE_EVENT_CLASS(block_bio_merge, | |
477 | ||
478 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), | |
479 | ||
480 | TP_ARGS(q, rq, bio), | |
481 | ||
482 | TP_STRUCT__entry( | |
483 | __field( dev_t, dev ) | |
484 | __field( sector_t, sector ) | |
485 | __field( unsigned int, nr_sector ) | |
486 | __field( unsigned int, rwbs ) | |
487 | __array_text( char, comm, TASK_COMM_LEN ) | |
488 | ), | |
489 | ||
490 | TP_fast_assign( | |
54c4c2e3 MD |
491 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
492 | tp_assign(dev, bio->bi_bdev->bd_dev) | |
493 | tp_assign(sector, bio->bi_iter.bi_sector) | |
494 | tp_assign(nr_sector, bio_sectors(bio)) | |
495 | blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_iter.bi_size) | |
496 | tp_memcpy(comm, current->comm, TASK_COMM_LEN) | |
497 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ | |
217f66c6 MD |
498 | tp_assign(dev, bio->bi_bdev->bd_dev) |
499 | tp_assign(sector, bio->bi_sector) | |
500 | tp_assign(nr_sector, bio->bi_size >> 9) | |
501 | blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size) | |
502 | tp_memcpy(comm, current->comm, TASK_COMM_LEN) | |
54c4c2e3 | 503 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
217f66c6 MD |
504 | ), |
505 | ||
506 | TP_printk("%d,%d %s %llu + %u [%s]", | |
507 | MAJOR(__entry->dev), MINOR(__entry->dev), | |
508 | __print_rwbs_flags(__entry->rwbs), | |
509 | (unsigned long long)__entry->sector, | |
510 | __entry->nr_sector, __entry->comm) | |
511 | ) | |
512 | ||
513 | /** | |
514 | * block_bio_backmerge - merging block operation to the end of an existing operation | |
515 | * @q: queue holding operation | |
516 | * @bio: new block operation to merge | |
517 | * | |
518 | * Merging block request @bio to the end of an existing block request | |
519 | * in queue @q. | |
520 | */ | |
521 | DEFINE_EVENT(block_bio_merge, block_bio_backmerge, | |
522 | ||
523 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), | |
524 | ||
525 | TP_ARGS(q, rq, bio) | |
526 | ) | |
527 | ||
528 | /** | |
529 | * block_bio_frontmerge - merging block operation to the beginning of an existing operation | |
530 | * @q: queue holding operation | |
531 | * @bio: new block operation to merge | |
532 | * | |
533 | * Merging block IO operation @bio to the beginning of an existing block | |
534 | * operation in queue @q. | |
535 | */ | |
536 | DEFINE_EVENT(block_bio_merge, block_bio_frontmerge, | |
537 | ||
538 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), | |
539 | ||
540 | TP_ARGS(q, rq, bio) | |
541 | ) | |
542 | ||
543 | /** | |
544 | * block_bio_queue - putting new block IO operation in queue | |
545 | * @q: queue holding operation | |
546 | * @bio: new block operation | |
547 | * | |
548 | * About to place the block IO operation @bio into queue @q. | |
549 | */ | |
550 | TRACE_EVENT(block_bio_queue, | |
551 | ||
552 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
553 | ||
554 | TP_ARGS(q, bio), | |
555 | ||
556 | TP_STRUCT__entry( | |
557 | __field( dev_t, dev ) | |
558 | __field( sector_t, sector ) | |
559 | __field( unsigned int, nr_sector ) | |
560 | __array( char, rwbs, RWBS_LEN ) | |
561 | __array( char, comm, TASK_COMM_LEN ) | |
562 | ), | |
563 | ||
564 | TP_fast_assign( | |
54c4c2e3 MD |
565 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
566 | tp_assign(dev, bio->bi_bdev->bd_dev) | |
567 | tp_assign(sector, bio->bi_iter.bi_sector) | |
568 | tp_assign(nr_sector, bio_sectors(bio)) | |
569 | blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_iter.bi_size) | |
570 | tp_memcpy(comm, current->comm, TASK_COMM_LEN) | |
571 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ | |
217f66c6 MD |
572 | tp_assign(dev, bio->bi_bdev->bd_dev) |
573 | tp_assign(sector, bio->bi_sector) | |
574 | tp_assign(nr_sector, bio->bi_size >> 9) | |
575 | blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size) | |
576 | tp_memcpy(comm, current->comm, TASK_COMM_LEN) | |
54c4c2e3 | 577 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
217f66c6 MD |
578 | ), |
579 | ||
580 | TP_printk("%d,%d %s %llu + %u [%s]", | |
581 | MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, | |
582 | (unsigned long long)__entry->sector, | |
583 | __entry->nr_sector, __entry->comm) | |
584 | ) | |
585 | #else | |
f62b389e MD |
586 | DECLARE_EVENT_CLASS(block_bio, |
587 | ||
588 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
589 | ||
590 | TP_ARGS(q, bio), | |
591 | ||
592 | TP_STRUCT__entry( | |
593 | __field( dev_t, dev ) | |
594 | __field( sector_t, sector ) | |
595 | __field( unsigned int, nr_sector ) | |
596 | __field( unsigned int, rwbs ) | |
64c796d8 | 597 | __array_text( char, comm, TASK_COMM_LEN ) |
f62b389e MD |
598 | ), |
599 | ||
600 | TP_fast_assign( | |
058e913a | 601 | tp_assign(dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0) |
f62b389e MD |
602 | tp_assign(sector, bio->bi_sector) |
603 | tp_assign(nr_sector, bio->bi_size >> 9) | |
604 | blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size) | |
605 | tp_memcpy(comm, current->comm, TASK_COMM_LEN) | |
606 | ), | |
607 | ||
608 | TP_printk("%d,%d %s %llu + %u [%s]", | |
609 | MAJOR(__entry->dev), MINOR(__entry->dev), | |
610 | __print_rwbs_flags(__entry->rwbs), | |
611 | (unsigned long long)__entry->sector, | |
612 | __entry->nr_sector, __entry->comm) | |
613 | ) | |
614 | ||
615 | /** | |
616 | * block_bio_backmerge - merging block operation to the end of an existing operation | |
617 | * @q: queue holding operation | |
618 | * @bio: new block operation to merge | |
619 | * | |
620 | * Merging block request @bio to the end of an existing block request | |
621 | * in queue @q. | |
622 | */ | |
623 | DEFINE_EVENT(block_bio, block_bio_backmerge, | |
624 | ||
625 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
626 | ||
627 | TP_ARGS(q, bio) | |
628 | ) | |
629 | ||
630 | /** | |
631 | * block_bio_frontmerge - merging block operation to the beginning of an existing operation | |
632 | * @q: queue holding operation | |
633 | * @bio: new block operation to merge | |
634 | * | |
635 | * Merging block IO operation @bio to the beginning of an existing block | |
636 | * operation in queue @q. | |
637 | */ | |
638 | DEFINE_EVENT(block_bio, block_bio_frontmerge, | |
639 | ||
640 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
641 | ||
642 | TP_ARGS(q, bio) | |
643 | ) | |
644 | ||
645 | /** | |
646 | * block_bio_queue - putting new block IO operation in queue | |
647 | * @q: queue holding operation | |
648 | * @bio: new block operation | |
649 | * | |
650 | * About to place the block IO operation @bio into queue @q. | |
651 | */ | |
652 | DEFINE_EVENT(block_bio, block_bio_queue, | |
653 | ||
654 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
655 | ||
656 | TP_ARGS(q, bio) | |
657 | ) | |
217f66c6 | 658 | #endif |
f62b389e MD |
659 | |
660 | DECLARE_EVENT_CLASS(block_get_rq, | |
661 | ||
662 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), | |
663 | ||
664 | TP_ARGS(q, bio, rw), | |
665 | ||
666 | TP_STRUCT__entry( | |
667 | __field( dev_t, dev ) | |
668 | __field( sector_t, sector ) | |
669 | __field( unsigned int, nr_sector ) | |
670 | __field( unsigned int, rwbs ) | |
64c796d8 | 671 | __array_text( char, comm, TASK_COMM_LEN ) |
f62b389e MD |
672 | ), |
673 | ||
674 | TP_fast_assign( | |
54c4c2e3 MD |
675 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
676 | tp_assign(dev, bio ? bio->bi_bdev->bd_dev : 0) | |
677 | tp_assign(sector, bio ? bio->bi_iter.bi_sector : 0) | |
678 | tp_assign(nr_sector, bio ? bio_sectors(bio) : 0) | |
679 | blk_fill_rwbs(rwbs, bio ? bio->bi_rw : 0, | |
680 | bio ? bio_sectors(bio) : 0) | |
681 | tp_memcpy(comm, current->comm, TASK_COMM_LEN) | |
682 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ | |
f62b389e MD |
683 | tp_assign(dev, bio ? bio->bi_bdev->bd_dev : 0) |
684 | tp_assign(sector, bio ? bio->bi_sector : 0) | |
685 | tp_assign(nr_sector, bio ? bio->bi_size >> 9 : 0) | |
686 | blk_fill_rwbs(rwbs, bio ? bio->bi_rw : 0, | |
687 | bio ? bio->bi_size >> 9 : 0) | |
688 | tp_memcpy(comm, current->comm, TASK_COMM_LEN) | |
54c4c2e3 | 689 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
f62b389e MD |
690 | ), |
691 | ||
692 | TP_printk("%d,%d %s %llu + %u [%s]", | |
693 | MAJOR(__entry->dev), MINOR(__entry->dev), | |
694 | __print_rwbs_flags(__entry->rwbs), | |
695 | (unsigned long long)__entry->sector, | |
696 | __entry->nr_sector, __entry->comm) | |
697 | ) | |
698 | ||
699 | /** | |
700 | * block_getrq - get a free request entry in queue for block IO operations | |
701 | * @q: queue for operations | |
702 | * @bio: pending block IO operation | |
703 | * @rw: low bit indicates a read (%0) or a write (%1) | |
704 | * | |
705 | * A request struct for queue @q has been allocated to handle the | |
706 | * block IO operation @bio. | |
707 | */ | |
708 | DEFINE_EVENT(block_get_rq, block_getrq, | |
709 | ||
710 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), | |
711 | ||
712 | TP_ARGS(q, bio, rw) | |
713 | ) | |
714 | ||
715 | /** | |
716 | * block_sleeprq - waiting to get a free request entry in queue for block IO operation | |
717 | * @q: queue for operation | |
718 | * @bio: pending block IO operation | |
719 | * @rw: low bit indicates a read (%0) or a write (%1) | |
720 | * | |
721 | * In the case where a request struct cannot be provided for queue @q | |
722 | * the process needs to wait for an request struct to become | |
723 | * available. This tracepoint event is generated each time the | |
724 | * process goes to sleep waiting for request struct become available. | |
725 | */ | |
726 | DEFINE_EVENT(block_get_rq, block_sleeprq, | |
727 | ||
728 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), | |
729 | ||
730 | TP_ARGS(q, bio, rw) | |
731 | ) | |
732 | ||
733 | /** | |
734 | * block_plug - keep operations requests in request queue | |
735 | * @q: request queue to plug | |
736 | * | |
737 | * Plug the request queue @q. Do not allow block operation requests | |
738 | * to be sent to the device driver. Instead, accumulate requests in | |
739 | * the queue to improve throughput performance of the block device. | |
740 | */ | |
741 | TRACE_EVENT(block_plug, | |
742 | ||
743 | TP_PROTO(struct request_queue *q), | |
744 | ||
745 | TP_ARGS(q), | |
746 | ||
747 | TP_STRUCT__entry( | |
64c796d8 | 748 | __array_text( char, comm, TASK_COMM_LEN ) |
f62b389e MD |
749 | ), |
750 | ||
751 | TP_fast_assign( | |
752 | tp_memcpy(comm, current->comm, TASK_COMM_LEN) | |
753 | ), | |
754 | ||
755 | TP_printk("[%s]", __entry->comm) | |
756 | ) | |
757 | ||
758 | DECLARE_EVENT_CLASS(block_unplug, | |
759 | ||
7c68b363 | 760 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) |
f62b389e MD |
761 | TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit), |
762 | ||
763 | TP_ARGS(q, depth, explicit), | |
7c68b363 AG |
764 | #else |
765 | TP_PROTO(struct request_queue *q), | |
766 | ||
767 | TP_ARGS(q), | |
768 | #endif | |
f62b389e MD |
769 | |
770 | TP_STRUCT__entry( | |
771 | __field( int, nr_rq ) | |
64c796d8 | 772 | __array_text( char, comm, TASK_COMM_LEN ) |
f62b389e MD |
773 | ), |
774 | ||
775 | TP_fast_assign( | |
7c68b363 | 776 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) |
f62b389e | 777 | tp_assign(nr_rq, depth) |
7c68b363 AG |
778 | #else |
779 | tp_assign(nr_rq, q->rq.count[READ] + q->rq.count[WRITE]) | |
780 | #endif | |
f62b389e MD |
781 | tp_memcpy(comm, current->comm, TASK_COMM_LEN) |
782 | ), | |
783 | ||
784 | TP_printk("[%s] %d", __entry->comm, __entry->nr_rq) | |
785 | ) | |
786 | ||
7c68b363 AG |
787 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) |
788 | /** | |
789 | * block_unplug_timer - timed release of operations requests in queue to device driver | |
790 | * @q: request queue to unplug | |
791 | * | |
792 | * Unplug the request queue @q because a timer expired and allow block | |
793 | * operation requests to be sent to the device driver. | |
794 | */ | |
795 | DEFINE_EVENT(block_unplug, block_unplug_timer, | |
796 | ||
797 | TP_PROTO(struct request_queue *q), | |
798 | ||
799 | TP_ARGS(q) | |
800 | ) | |
801 | #endif | |
802 | ||
f62b389e MD |
803 | /** |
804 | * block_unplug - release of operations requests in request queue | |
805 | * @q: request queue to unplug | |
806 | * @depth: number of requests just added to the queue | |
807 | * @explicit: whether this was an explicit unplug, or one from schedule() | |
808 | * | |
809 | * Unplug request queue @q because device driver is scheduled to work | |
810 | * on elements in the request queue. | |
811 | */ | |
7c68b363 | 812 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) |
f62b389e | 813 | DEFINE_EVENT(block_unplug, block_unplug, |
7c68b363 AG |
814 | #else |
815 | DEFINE_EVENT(block_unplug, block_unplug_io, | |
816 | #endif | |
f62b389e | 817 | |
7c68b363 | 818 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) |
f62b389e MD |
819 | TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit), |
820 | ||
821 | TP_ARGS(q, depth, explicit) | |
7c68b363 AG |
822 | #else |
823 | TP_PROTO(struct request_queue *q), | |
824 | ||
825 | TP_ARGS(q) | |
826 | #endif | |
f62b389e MD |
827 | ) |
828 | ||
829 | /** | |
830 | * block_split - split a single bio struct into two bio structs | |
831 | * @q: queue containing the bio | |
832 | * @bio: block operation being split | |
833 | * @new_sector: The starting sector for the new bio | |
834 | * | |
835 | * The bio request @bio in request queue @q needs to be split into two | |
836 | * bio requests. The newly created @bio request starts at | |
837 | * @new_sector. This split may be required due to hardware limitation | |
838 | * such as operation crossing device boundaries in a RAID system. | |
839 | */ | |
840 | TRACE_EVENT(block_split, | |
841 | ||
842 | TP_PROTO(struct request_queue *q, struct bio *bio, | |
843 | unsigned int new_sector), | |
844 | ||
845 | TP_ARGS(q, bio, new_sector), | |
846 | ||
847 | TP_STRUCT__entry( | |
848 | __field( dev_t, dev ) | |
849 | __field( sector_t, sector ) | |
850 | __field( sector_t, new_sector ) | |
851 | __field( unsigned int, rwbs ) | |
64c796d8 | 852 | __array_text( char, comm, TASK_COMM_LEN ) |
f62b389e MD |
853 | ), |
854 | ||
855 | TP_fast_assign( | |
54c4c2e3 MD |
856 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
857 | tp_assign(dev, bio->bi_bdev->bd_dev) | |
858 | tp_assign(sector, bio->bi_iter.bi_sector) | |
859 | tp_assign(new_sector, new_sector) | |
860 | blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_iter.bi_size) | |
861 | tp_memcpy(comm, current->comm, TASK_COMM_LEN) | |
862 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ | |
f62b389e MD |
863 | tp_assign(dev, bio->bi_bdev->bd_dev) |
864 | tp_assign(sector, bio->bi_sector) | |
865 | tp_assign(new_sector, new_sector) | |
08fa6ec9 | 866 | blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size) |
f62b389e | 867 | tp_memcpy(comm, current->comm, TASK_COMM_LEN) |
54c4c2e3 | 868 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
f62b389e MD |
869 | ), |
870 | ||
871 | TP_printk("%d,%d %s %llu / %llu [%s]", | |
872 | MAJOR(__entry->dev), MINOR(__entry->dev), | |
873 | __print_rwbs_flags(__entry->rwbs), | |
874 | (unsigned long long)__entry->sector, | |
875 | (unsigned long long)__entry->new_sector, | |
876 | __entry->comm) | |
877 | ) | |
878 | ||
879 | /** | |
880 | * block_bio_remap - map request for a logical device to the raw device | |
881 | * @q: queue holding the operation | |
882 | * @bio: revised operation | |
883 | * @dev: device for the operation | |
884 | * @from: original sector for the operation | |
885 | * | |
886 | * An operation for a logical device has been mapped to the | |
887 | * raw block device. | |
888 | */ | |
7c68b363 | 889 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
f62b389e | 890 | TRACE_EVENT(block_bio_remap, |
7c68b363 AG |
891 | #else |
892 | TRACE_EVENT(block_remap, | |
893 | #endif | |
f62b389e MD |
894 | |
895 | TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev, | |
896 | sector_t from), | |
897 | ||
898 | TP_ARGS(q, bio, dev, from), | |
899 | ||
900 | TP_STRUCT__entry( | |
901 | __field( dev_t, dev ) | |
902 | __field( sector_t, sector ) | |
903 | __field( unsigned int, nr_sector ) | |
904 | __field( dev_t, old_dev ) | |
905 | __field( sector_t, old_sector ) | |
906 | __field( unsigned int, rwbs ) | |
907 | ), | |
908 | ||
909 | TP_fast_assign( | |
54c4c2e3 MD |
910 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
911 | tp_assign(dev, bio->bi_bdev->bd_dev) | |
912 | tp_assign(sector, bio->bi_iter.bi_sector) | |
913 | tp_assign(nr_sector, bio_sectors(bio)) | |
914 | tp_assign(old_dev, dev) | |
915 | tp_assign(old_sector, from) | |
916 | blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_iter.bi_size) | |
917 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ | |
f62b389e MD |
918 | tp_assign(dev, bio->bi_bdev->bd_dev) |
919 | tp_assign(sector, bio->bi_sector) | |
920 | tp_assign(nr_sector, bio->bi_size >> 9) | |
921 | tp_assign(old_dev, dev) | |
922 | tp_assign(old_sector, from) | |
923 | blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size) | |
54c4c2e3 | 924 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
f62b389e MD |
925 | ), |
926 | ||
927 | TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu", | |
928 | MAJOR(__entry->dev), MINOR(__entry->dev), | |
929 | __print_rwbs_flags(__entry->rwbs), | |
930 | (unsigned long long)__entry->sector, | |
931 | __entry->nr_sector, | |
932 | MAJOR(__entry->old_dev), MINOR(__entry->old_dev), | |
933 | (unsigned long long)__entry->old_sector) | |
934 | ) | |
935 | ||
7c68b363 | 936 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) |
f62b389e MD |
937 | /** |
938 | * block_rq_remap - map request for a block operation request | |
939 | * @q: queue holding the operation | |
940 | * @rq: block IO operation request | |
941 | * @dev: device for the operation | |
942 | * @from: original sector for the operation | |
943 | * | |
944 | * The block operation request @rq in @q has been remapped. The block | |
945 | * operation request @rq holds the current information and @from hold | |
946 | * the original sector. | |
947 | */ | |
948 | TRACE_EVENT(block_rq_remap, | |
949 | ||
950 | TP_PROTO(struct request_queue *q, struct request *rq, dev_t dev, | |
951 | sector_t from), | |
952 | ||
953 | TP_ARGS(q, rq, dev, from), | |
954 | ||
955 | TP_STRUCT__entry( | |
956 | __field( dev_t, dev ) | |
957 | __field( sector_t, sector ) | |
958 | __field( unsigned int, nr_sector ) | |
959 | __field( dev_t, old_dev ) | |
960 | __field( sector_t, old_sector ) | |
961 | __field( unsigned int, rwbs ) | |
962 | ), | |
963 | ||
964 | TP_fast_assign( | |
965 | tp_assign(dev, disk_devt(rq->rq_disk)) | |
966 | tp_assign(sector, blk_rq_pos(rq)) | |
967 | tp_assign(nr_sector, blk_rq_sectors(rq)) | |
968 | tp_assign(old_dev, dev) | |
969 | tp_assign(old_sector, from) | |
970 | blk_fill_rwbs(rwbs, rq->cmd_flags, blk_rq_bytes(rq)) | |
971 | ), | |
972 | ||
973 | TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu", | |
974 | MAJOR(__entry->dev), MINOR(__entry->dev), | |
975 | __print_rwbs_flags(__entry->rwbs), | |
976 | (unsigned long long)__entry->sector, | |
977 | __entry->nr_sector, | |
978 | MAJOR(__entry->old_dev), MINOR(__entry->old_dev), | |
979 | (unsigned long long)__entry->old_sector) | |
980 | ) | |
7c68b363 | 981 | #endif |
f62b389e MD |
982 | |
983 | #undef __print_rwbs_flags | |
984 | #undef blk_fill_rwbs | |
985 | ||
986 | #endif /* _TRACE_BLOCK_H */ | |
987 | ||
988 | /* This part must be outside protection */ | |
5b88d86e | 989 | #include "../../../probes/define_trace.h" |
f62b389e | 990 |