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