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