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