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