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 | ||
f62b389e MD |
13 | #ifndef _TRACE_BLOCK_DEF_ |
14 | #define _TRACE_BLOCK_DEF_ | |
15 | ||
f62b389e MD |
16 | enum { |
17 | RWBS_FLAG_WRITE = (1 << 0), | |
18 | RWBS_FLAG_DISCARD = (1 << 1), | |
19 | RWBS_FLAG_READ = (1 << 2), | |
20 | RWBS_FLAG_RAHEAD = (1 << 3), | |
7c68b363 AG |
21 | RWBS_FLAG_BARRIER = (1 << 4), |
22 | RWBS_FLAG_SYNC = (1 << 5), | |
23 | RWBS_FLAG_META = (1 << 6), | |
24 | RWBS_FLAG_SECURE = (1 << 7), | |
25 | RWBS_FLAG_FLUSH = (1 << 8), | |
26 | RWBS_FLAG_FUA = (1 << 9), | |
f62b389e MD |
27 | }; |
28 | ||
29 | #endif /* _TRACE_BLOCK_DEF_ */ | |
30 | ||
7c68b363 AG |
31 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) |
32 | ||
f127e61e MD |
33 | #define blk_rwbs_ctf_integer(type, rwbs, rw, bytes) \ |
34 | ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ | |
7c68b363 AG |
35 | ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \ |
36 | ( (bytes) ? RWBS_FLAG_READ : \ | |
37 | ( 0 )))) \ | |
38 | | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \ | |
39 | | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \ | |
40 | | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \ | |
41 | | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \ | |
42 | | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \ | |
43 | | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0)) | |
44 | ||
45 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) | |
46 | ||
f127e61e MD |
47 | #define blk_rwbs_ctf_integer(type, rwbs, rw, bytes) \ |
48 | ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ | |
f62b389e MD |
49 | ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \ |
50 | ( (bytes) ? RWBS_FLAG_READ : \ | |
51 | ( 0 )))) \ | |
52 | | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \ | |
53 | | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \ | |
54 | | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \ | |
55 | | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0)) | |
56 | ||
7c68b363 AG |
57 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) |
58 | ||
f127e61e MD |
59 | #define blk_rwbs_ctf_integer(type, rwbs, rw, bytes) \ |
60 | ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ | |
7c68b363 AG |
61 | ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \ |
62 | ( (bytes) ? RWBS_FLAG_READ : \ | |
63 | ( 0 )))) \ | |
64 | | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \ | |
65 | | ((rw) & REQ_HARDBARRIER ? RWBS_FLAG_BARRIER : 0) \ | |
66 | | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \ | |
67 | | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \ | |
68 | | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0)) | |
69 | ||
70 | #else | |
71 | ||
f127e61e MD |
72 | #define blk_rwbs_ctf_integer(type, rwbs, rw, bytes) \ |
73 | ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ | |
7c68b363 AG |
74 | ( (rw) & (1 << BIO_RW_DISCARD) ? RWBS_FLAG_DISCARD : \ |
75 | ( (bytes) ? RWBS_FLAG_READ : \ | |
76 | ( 0 )))) \ | |
77 | | ((rw) & (1 << BIO_RW_AHEAD) ? RWBS_FLAG_RAHEAD : 0) \ | |
78 | | ((rw) & (1 << BIO_RW_SYNCIO) ? RWBS_FLAG_SYNC : 0) \ | |
79 | | ((rw) & (1 << BIO_RW_META) ? RWBS_FLAG_META : 0) \ | |
80 | | ((rw) & (1 << BIO_RW_BARRIER) ? RWBS_FLAG_BARRIER : 0)) | |
81 | ||
82 | #endif | |
83 | ||
217f66c6 | 84 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
3bc29f0a | 85 | LTTNG_TRACEPOINT_EVENT_CLASS(block_buffer, |
217f66c6 MD |
86 | |
87 | TP_PROTO(struct buffer_head *bh), | |
88 | ||
89 | TP_ARGS(bh), | |
90 | ||
f127e61e MD |
91 | TP_FIELDS ( |
92 | ctf_integer(dev_t, dev, bh->b_bdev->bd_dev) | |
93 | ctf_integer(sector_t, sector, bh->b_blocknr) | |
94 | ctf_integer(size_t, size, bh->b_size) | |
217f66c6 MD |
95 | ) |
96 | ) | |
97 | ||
98 | /** | |
99 | * block_touch_buffer - mark a buffer accessed | |
100 | * @bh: buffer_head being touched | |
101 | * | |
102 | * Called from touch_buffer(). | |
103 | */ | |
3bc29f0a | 104 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer, block_touch_buffer, |
217f66c6 MD |
105 | |
106 | TP_PROTO(struct buffer_head *bh), | |
107 | ||
108 | TP_ARGS(bh) | |
109 | ) | |
110 | ||
111 | /** | |
112 | * block_dirty_buffer - mark a buffer dirty | |
113 | * @bh: buffer_head being dirtied | |
114 | * | |
115 | * Called from mark_buffer_dirty(). | |
116 | */ | |
3bc29f0a | 117 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer, block_dirty_buffer, |
217f66c6 MD |
118 | |
119 | TP_PROTO(struct buffer_head *bh), | |
120 | ||
121 | TP_ARGS(bh) | |
122 | ) | |
123 | #endif | |
124 | ||
f127e61e | 125 | LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error, |
f62b389e MD |
126 | |
127 | TP_PROTO(struct request_queue *q, struct request *rq), | |
128 | ||
129 | TP_ARGS(q, rq), | |
130 | ||
f127e61e MD |
131 | TP_locvar( |
132 | sector_t sector; | |
133 | unsigned int nr_sector; | |
134 | unsigned char *cmd; | |
135 | size_t cmd_len; | |
f62b389e MD |
136 | ), |
137 | ||
f127e61e MD |
138 | TP_code( |
139 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { | |
140 | tp_locvar->sector = 0; | |
141 | tp_locvar->nr_sector = 0; | |
142 | tp_locvar->cmd = rq->cmd; | |
143 | tp_locvar->cmd_len = rq->cmd_len; | |
144 | } else { | |
145 | tp_locvar->sector = blk_rq_pos(rq); | |
146 | tp_locvar->nr_sector = blk_rq_sectors(rq); | |
147 | tp_locvar->cmd = NULL; | |
148 | tp_locvar->cmd_len = 0; | |
149 | } | |
f62b389e MD |
150 | ), |
151 | ||
f127e61e MD |
152 | TP_FIELDS( |
153 | ctf_integer(dev_t, dev, | |
154 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
155 | ctf_integer(sector_t, sector, tp_locvar->sector) | |
156 | ctf_integer(unsigned int, nr_sector, tp_locvar->nr_sector) | |
157 | ctf_integer(int, errors, rq->errors) | |
158 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
159 | rq->cmd_flags, blk_rq_bytes(rq)) | |
160 | ctf_sequence_hex(unsigned char, cmd, | |
161 | tp_locvar->cmd, size_t, tp_locvar->cmd_len) | |
162 | ) | |
f62b389e MD |
163 | ) |
164 | ||
165 | /** | |
166 | * block_rq_abort - abort block operation request | |
167 | * @q: queue containing the block operation request | |
168 | * @rq: block IO operation request | |
169 | * | |
170 | * Called immediately after pending block IO operation request @rq in | |
171 | * queue @q is aborted. The fields in the operation request @rq | |
172 | * can be examined to determine which device and sectors the pending | |
173 | * operation would access. | |
174 | */ | |
3bc29f0a | 175 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_abort, |
f62b389e MD |
176 | |
177 | TP_PROTO(struct request_queue *q, struct request *rq), | |
178 | ||
179 | TP_ARGS(q, rq) | |
180 | ) | |
181 | ||
182 | /** | |
183 | * block_rq_requeue - place block IO request back on a queue | |
184 | * @q: queue holding operation | |
185 | * @rq: block IO operation request | |
186 | * | |
187 | * The block operation request @rq is being placed back into queue | |
188 | * @q. For some reason the request was not completed and needs to be | |
189 | * put back in the queue. | |
190 | */ | |
3bc29f0a | 191 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_requeue, |
f62b389e MD |
192 | |
193 | TP_PROTO(struct request_queue *q, struct request *rq), | |
194 | ||
195 | TP_ARGS(q, rq) | |
196 | ) | |
197 | ||
bba0442a AB |
198 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,5) \ |
199 | || LTTNG_KERNEL_RANGE(3,12,21, 3,13,0) \ | |
200 | || LTTNG_KERNEL_RANGE(3,10,41, 3,11,0) \ | |
cc3b2f06 | 201 | || LTTNG_KERNEL_RANGE(3,4,91, 3,5,0) \ |
f64d76a5 JD |
202 | || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0) \ |
203 | || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,31, 3,14,0,0)) | |
1c53e689 MD |
204 | |
205 | /** | |
206 | * block_rq_complete - block IO operation completed by device driver | |
207 | * @q: queue containing the block operation request | |
208 | * @rq: block operations request | |
209 | * @nr_bytes: number of completed bytes | |
210 | * | |
211 | * The block_rq_complete tracepoint event indicates that some portion | |
212 | * of operation request has been completed by the device driver. If | |
213 | * the @rq->bio is %NULL, then there is absolutely no additional work to | |
214 | * do for the request. If @rq->bio is non-NULL then there is | |
215 | * additional work required to complete the request. | |
216 | */ | |
f127e61e | 217 | LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete, |
1c53e689 MD |
218 | |
219 | TP_PROTO(struct request_queue *q, struct request *rq, | |
220 | unsigned int nr_bytes), | |
221 | ||
222 | TP_ARGS(q, rq, nr_bytes), | |
223 | ||
f127e61e MD |
224 | TP_locvar( |
225 | unsigned char *cmd; | |
226 | size_t cmd_len; | |
1c53e689 MD |
227 | ), |
228 | ||
f127e61e MD |
229 | TP_code( |
230 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { | |
231 | tp_locvar->cmd = rq->cmd; | |
232 | tp_locvar->cmd_len = rq->cmd_len; | |
233 | } else { | |
234 | tp_locvar->cmd = NULL; | |
235 | tp_locvar->cmd_len = 0; | |
236 | } | |
1c53e689 MD |
237 | ), |
238 | ||
f127e61e MD |
239 | TP_FIELDS( |
240 | ctf_integer(dev_t, dev, | |
241 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
242 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) | |
243 | ctf_integer(unsigned int, nr_sector, nr_bytes >> 9) | |
244 | ctf_integer(int, errors, rq->errors) | |
245 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
246 | rq->cmd_flags, nr_bytes) | |
247 | ctf_sequence_hex(unsigned char, cmd, | |
248 | tp_locvar->cmd, size_t, tp_locvar->cmd_len) | |
249 | ) | |
1c53e689 MD |
250 | ) |
251 | ||
252 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */ | |
253 | ||
f62b389e MD |
254 | /** |
255 | * block_rq_complete - block IO operation completed by device driver | |
256 | * @q: queue containing the block operation request | |
257 | * @rq: block operations request | |
258 | * | |
259 | * The block_rq_complete tracepoint event indicates that some portion | |
260 | * of operation request has been completed by the device driver. If | |
261 | * the @rq->bio is %NULL, then there is absolutely no additional work to | |
262 | * do for the request. If @rq->bio is non-NULL then there is | |
263 | * additional work required to complete the request. | |
264 | */ | |
3bc29f0a | 265 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_complete, |
f62b389e MD |
266 | |
267 | TP_PROTO(struct request_queue *q, struct request *rq), | |
268 | ||
269 | TP_ARGS(q, rq) | |
270 | ) | |
271 | ||
1c53e689 MD |
272 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */ |
273 | ||
f127e61e | 274 | LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq, |
f62b389e MD |
275 | |
276 | TP_PROTO(struct request_queue *q, struct request *rq), | |
277 | ||
278 | TP_ARGS(q, rq), | |
279 | ||
f127e61e MD |
280 | TP_locvar( |
281 | sector_t sector; | |
282 | unsigned int nr_sector; | |
283 | unsigned int bytes; | |
284 | unsigned char *cmd; | |
285 | size_t cmd_len; | |
f62b389e MD |
286 | ), |
287 | ||
f127e61e MD |
288 | TP_code( |
289 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { | |
290 | tp_locvar->sector = 0; | |
291 | tp_locvar->nr_sector = 0; | |
292 | tp_locvar->bytes = blk_rq_bytes(rq); | |
293 | tp_locvar->cmd = rq->cmd; | |
294 | tp_locvar->cmd_len = rq->cmd_len; | |
295 | } else { | |
296 | tp_locvar->sector = blk_rq_pos(rq); | |
297 | tp_locvar->nr_sector = blk_rq_sectors(rq); | |
298 | tp_locvar->bytes = 0; | |
299 | tp_locvar->cmd = NULL; | |
300 | tp_locvar->cmd_len = 0; | |
301 | } | |
f62b389e MD |
302 | ), |
303 | ||
f127e61e MD |
304 | TP_FIELDS( |
305 | ctf_integer(dev_t, dev, | |
306 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
307 | ctf_integer(sector_t, sector, tp_locvar->sector) | |
308 | ctf_integer(unsigned int, nr_sector, tp_locvar->nr_sector) | |
309 | ctf_integer(unsigned int, bytes, tp_locvar->bytes) | |
310 | ctf_integer(pid_t, tid, current->pid) | |
311 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
312 | rq->cmd_flags, blk_rq_bytes(rq)) | |
313 | ctf_sequence_hex(unsigned char, cmd, | |
314 | tp_locvar->cmd, size_t, tp_locvar->cmd_len) | |
315 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
316 | ) | |
f62b389e MD |
317 | ) |
318 | ||
319 | /** | |
320 | * block_rq_insert - insert block operation request into queue | |
321 | * @q: target queue | |
322 | * @rq: block IO operation request | |
323 | * | |
324 | * Called immediately before block operation request @rq is inserted | |
325 | * into queue @q. The fields in the operation request @rq struct can | |
326 | * be examined to determine which device and sectors the pending | |
327 | * operation would access. | |
328 | */ | |
3bc29f0a | 329 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_insert, |
f62b389e MD |
330 | |
331 | TP_PROTO(struct request_queue *q, struct request *rq), | |
332 | ||
333 | TP_ARGS(q, rq) | |
334 | ) | |
335 | ||
336 | /** | |
337 | * block_rq_issue - issue pending block IO request operation to device driver | |
338 | * @q: queue holding operation | |
339 | * @rq: block IO operation operation request | |
340 | * | |
341 | * Called when block operation request @rq from queue @q is sent to a | |
342 | * device driver for processing. | |
343 | */ | |
3bc29f0a | 344 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_issue, |
f62b389e MD |
345 | |
346 | TP_PROTO(struct request_queue *q, struct request *rq), | |
347 | ||
348 | TP_ARGS(q, rq) | |
349 | ) | |
350 | ||
351 | /** | |
352 | * block_bio_bounce - used bounce buffer when processing block operation | |
353 | * @q: queue holding the block operation | |
354 | * @bio: block operation | |
355 | * | |
356 | * A bounce buffer was used to handle the block operation @bio in @q. | |
357 | * This occurs when hardware limitations prevent a direct transfer of | |
358 | * data between the @bio data memory area and the IO device. Use of a | |
359 | * bounce buffer requires extra copying of data and decreases | |
360 | * performance. | |
361 | */ | |
3bc29f0a | 362 | LTTNG_TRACEPOINT_EVENT(block_bio_bounce, |
f62b389e MD |
363 | |
364 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
365 | ||
366 | TP_ARGS(q, bio), | |
367 | ||
f127e61e MD |
368 | TP_FIELDS( |
369 | ctf_integer(dev_t, dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0) | |
54c4c2e3 | 370 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
f127e61e MD |
371 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
372 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
373 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
374 | bio->bi_rw, bio->bi_iter.bi_size) | |
54c4c2e3 | 375 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
f127e61e MD |
376 | ctf_integer(sector_t, sector, bio->bi_sector) |
377 | ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) | |
378 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
379 | bio->bi_rw, bio->bi_size) | |
54c4c2e3 | 380 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
f127e61e MD |
381 | ctf_integer(pid_t, tid, current->pid) |
382 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
383 | ) | |
f62b389e MD |
384 | ) |
385 | ||
386 | /** | |
387 | * block_bio_complete - completed all work on the block operation | |
388 | * @q: queue holding the block operation | |
389 | * @bio: block operation completed | |
390 | * @error: io error value | |
391 | * | |
392 | * This tracepoint indicates there is no further work to do on this | |
393 | * block IO operation @bio. | |
394 | */ | |
3bc29f0a | 395 | LTTNG_TRACEPOINT_EVENT(block_bio_complete, |
f62b389e | 396 | |
1bc491fc | 397 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
f62b389e MD |
398 | TP_PROTO(struct request_queue *q, struct bio *bio, int error), |
399 | ||
400 | TP_ARGS(q, bio, error), | |
7c68b363 AG |
401 | #else |
402 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
403 | ||
404 | TP_ARGS(q, bio), | |
405 | #endif | |
f62b389e | 406 | |
f127e61e MD |
407 | TP_FIELDS( |
408 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) | |
54c4c2e3 | 409 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
f127e61e MD |
410 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
411 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
412 | ctf_integer(int, error, error) | |
413 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
414 | bio->bi_rw, bio->bi_iter.bi_size) | |
54c4c2e3 | 415 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
f127e61e MD |
416 | ctf_integer(sector_t, sector, bio->bi_sector) |
417 | ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) | |
7c68b363 | 418 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
f127e61e | 419 | ctf_integer(int, error, error) |
7c68b363 | 420 | #else |
f127e61e | 421 | ctf_integer(int, error, 0) |
7c68b363 | 422 | #endif |
f127e61e MD |
423 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
424 | bio->bi_rw, bio->bi_size) | |
54c4c2e3 | 425 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
f127e61e | 426 | ) |
f62b389e MD |
427 | ) |
428 | ||
217f66c6 | 429 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
3bc29f0a | 430 | LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge, |
217f66c6 MD |
431 | |
432 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), | |
433 | ||
434 | TP_ARGS(q, rq, bio), | |
435 | ||
f127e61e MD |
436 | TP_FIELDS( |
437 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) | |
54c4c2e3 | 438 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
f127e61e MD |
439 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
440 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
441 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
442 | bio->bi_rw, bio->bi_iter.bi_size) | |
54c4c2e3 | 443 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
f127e61e MD |
444 | ctf_integer(sector_t, sector, bio->bi_sector) |
445 | ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) | |
446 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
447 | bio->bi_rw, bio->bi_size) | |
54c4c2e3 | 448 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
f127e61e MD |
449 | ctf_integer(pid_t, tid, current->pid) |
450 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
451 | ) | |
217f66c6 MD |
452 | ) |
453 | ||
454 | /** | |
455 | * block_bio_backmerge - merging block operation to the end of an existing operation | |
456 | * @q: queue holding operation | |
457 | * @bio: new block operation to merge | |
458 | * | |
459 | * Merging block request @bio to the end of an existing block request | |
460 | * in queue @q. | |
461 | */ | |
3bc29f0a | 462 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge, block_bio_backmerge, |
217f66c6 MD |
463 | |
464 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), | |
465 | ||
466 | TP_ARGS(q, rq, bio) | |
467 | ) | |
468 | ||
469 | /** | |
470 | * block_bio_frontmerge - merging block operation to the beginning of an existing operation | |
471 | * @q: queue holding operation | |
472 | * @bio: new block operation to merge | |
473 | * | |
474 | * Merging block IO operation @bio to the beginning of an existing block | |
475 | * operation in queue @q. | |
476 | */ | |
3bc29f0a | 477 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge, block_bio_frontmerge, |
217f66c6 MD |
478 | |
479 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), | |
480 | ||
481 | TP_ARGS(q, rq, bio) | |
482 | ) | |
483 | ||
484 | /** | |
485 | * block_bio_queue - putting new block IO operation in queue | |
486 | * @q: queue holding operation | |
487 | * @bio: new block operation | |
488 | * | |
489 | * About to place the block IO operation @bio into queue @q. | |
490 | */ | |
3bc29f0a | 491 | LTTNG_TRACEPOINT_EVENT(block_bio_queue, |
217f66c6 MD |
492 | |
493 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
494 | ||
495 | TP_ARGS(q, bio), | |
496 | ||
f127e61e MD |
497 | TP_FIELDS( |
498 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) | |
54c4c2e3 | 499 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
f127e61e MD |
500 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
501 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
502 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
503 | bio->bi_rw, bio->bi_iter.bi_size) | |
54c4c2e3 | 504 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
f127e61e MD |
505 | ctf_integer(sector_t, sector, bio->bi_sector) |
506 | ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) | |
507 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
508 | bio->bi_rw, bio->bi_size) | |
54c4c2e3 | 509 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
f127e61e MD |
510 | ctf_integer(pid_t, tid, current->pid) |
511 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
512 | ) | |
217f66c6 | 513 | ) |
f127e61e | 514 | #else /* if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */ |
3bc29f0a | 515 | LTTNG_TRACEPOINT_EVENT_CLASS(block_bio, |
f62b389e MD |
516 | |
517 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
518 | ||
519 | TP_ARGS(q, bio), | |
520 | ||
f127e61e MD |
521 | TP_FIELDS( |
522 | ctf_integer(dev_t, dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0) | |
523 | ctf_integer(sector_t, sector, bio->bi_sector) | |
524 | ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) | |
525 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
526 | bio->bi_rw, bio->bi_size) | |
527 | ctf_integer(pid_t, tid, current->pid) | |
528 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
529 | ) | |
f62b389e MD |
530 | ) |
531 | ||
532 | /** | |
533 | * block_bio_backmerge - merging block operation to the end of an existing operation | |
534 | * @q: queue holding operation | |
535 | * @bio: new block operation to merge | |
536 | * | |
537 | * Merging block request @bio to the end of an existing block request | |
538 | * in queue @q. | |
539 | */ | |
3bc29f0a | 540 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_backmerge, |
f62b389e MD |
541 | |
542 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
543 | ||
544 | TP_ARGS(q, bio) | |
545 | ) | |
546 | ||
547 | /** | |
548 | * block_bio_frontmerge - merging block operation to the beginning of an existing operation | |
549 | * @q: queue holding operation | |
550 | * @bio: new block operation to merge | |
551 | * | |
552 | * Merging block IO operation @bio to the beginning of an existing block | |
553 | * operation in queue @q. | |
554 | */ | |
3bc29f0a | 555 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_frontmerge, |
f62b389e MD |
556 | |
557 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
558 | ||
559 | TP_ARGS(q, bio) | |
560 | ) | |
561 | ||
562 | /** | |
563 | * block_bio_queue - putting new block IO operation in queue | |
564 | * @q: queue holding operation | |
565 | * @bio: new block operation | |
566 | * | |
567 | * About to place the block IO operation @bio into queue @q. | |
568 | */ | |
3bc29f0a | 569 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_queue, |
f62b389e MD |
570 | |
571 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
572 | ||
573 | TP_ARGS(q, bio) | |
574 | ) | |
f127e61e | 575 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */ |
f62b389e | 576 | |
3bc29f0a | 577 | LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq, |
f62b389e MD |
578 | |
579 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), | |
580 | ||
581 | TP_ARGS(q, bio, rw), | |
582 | ||
f127e61e MD |
583 | TP_FIELDS( |
584 | ctf_integer(dev_t, dev, bio ? bio->bi_bdev->bd_dev : 0) | |
54c4c2e3 | 585 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
f127e61e MD |
586 | ctf_integer(sector_t, sector, bio ? bio->bi_iter.bi_sector : 0) |
587 | ctf_integer(unsigned int, nr_sector, | |
588 | bio ? bio_sectors(bio) : 0) | |
589 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
590 | bio ? bio->bi_rw : 0, | |
591 | bio ? bio->bi_iter.bi_size : 0) | |
54c4c2e3 | 592 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
f127e61e MD |
593 | ctf_integer(sector_t, sector, bio ? bio->bi_sector : 0) |
594 | ctf_integer(unsigned int, nr_sector, | |
595 | bio ? bio->bi_size >> 9 : 0) | |
596 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
597 | bio ? bio->bi_rw : 0, | |
598 | bio ? bio->bi_size : 0) | |
54c4c2e3 | 599 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
f127e61e MD |
600 | ctf_integer(pid_t, tid, current->pid) |
601 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
602 | ) | |
f62b389e MD |
603 | ) |
604 | ||
605 | /** | |
606 | * block_getrq - get a free request entry in queue for block IO operations | |
607 | * @q: queue for operations | |
608 | * @bio: pending block IO operation | |
609 | * @rw: low bit indicates a read (%0) or a write (%1) | |
610 | * | |
611 | * A request struct for queue @q has been allocated to handle the | |
612 | * block IO operation @bio. | |
613 | */ | |
3bc29f0a | 614 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq, block_getrq, |
f62b389e MD |
615 | |
616 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), | |
617 | ||
618 | TP_ARGS(q, bio, rw) | |
619 | ) | |
620 | ||
621 | /** | |
622 | * block_sleeprq - waiting to get a free request entry in queue for block IO operation | |
623 | * @q: queue for operation | |
624 | * @bio: pending block IO operation | |
625 | * @rw: low bit indicates a read (%0) or a write (%1) | |
626 | * | |
627 | * In the case where a request struct cannot be provided for queue @q | |
628 | * the process needs to wait for an request struct to become | |
629 | * available. This tracepoint event is generated each time the | |
630 | * process goes to sleep waiting for request struct become available. | |
631 | */ | |
3bc29f0a | 632 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq, block_sleeprq, |
f62b389e MD |
633 | |
634 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), | |
635 | ||
636 | TP_ARGS(q, bio, rw) | |
637 | ) | |
638 | ||
639 | /** | |
640 | * block_plug - keep operations requests in request queue | |
641 | * @q: request queue to plug | |
642 | * | |
643 | * Plug the request queue @q. Do not allow block operation requests | |
644 | * to be sent to the device driver. Instead, accumulate requests in | |
645 | * the queue to improve throughput performance of the block device. | |
646 | */ | |
3bc29f0a | 647 | LTTNG_TRACEPOINT_EVENT(block_plug, |
f62b389e MD |
648 | |
649 | TP_PROTO(struct request_queue *q), | |
650 | ||
651 | TP_ARGS(q), | |
652 | ||
f127e61e MD |
653 | TP_FIELDS( |
654 | ctf_integer(pid_t, tid, current->pid) | |
655 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
656 | ) | |
f62b389e MD |
657 | ) |
658 | ||
3bc29f0a | 659 | LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug, |
f62b389e | 660 | |
7c68b363 | 661 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) |
f62b389e MD |
662 | TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit), |
663 | ||
664 | TP_ARGS(q, depth, explicit), | |
7c68b363 AG |
665 | #else |
666 | TP_PROTO(struct request_queue *q), | |
667 | ||
668 | TP_ARGS(q), | |
669 | #endif | |
f62b389e | 670 | |
f127e61e | 671 | TP_FIELDS( |
7c68b363 | 672 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) |
f127e61e | 673 | ctf_integer(int, nr_rq, depth) |
7c68b363 | 674 | #else |
f127e61e | 675 | ctf_integer(int, nr_rq, q->rq.count[READ] + q->rq.count[WRITE]) |
7c68b363 | 676 | #endif |
f127e61e MD |
677 | ctf_integer(pid_t, tid, current->pid) |
678 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
679 | ) | |
f62b389e MD |
680 | ) |
681 | ||
7c68b363 AG |
682 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) |
683 | /** | |
684 | * block_unplug_timer - timed release of operations requests in queue to device driver | |
685 | * @q: request queue to unplug | |
686 | * | |
687 | * Unplug the request queue @q because a timer expired and allow block | |
688 | * operation requests to be sent to the device driver. | |
689 | */ | |
3bc29f0a | 690 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug, block_unplug_timer, |
7c68b363 AG |
691 | |
692 | TP_PROTO(struct request_queue *q), | |
693 | ||
694 | TP_ARGS(q) | |
695 | ) | |
696 | #endif | |
697 | ||
f62b389e MD |
698 | /** |
699 | * block_unplug - release of operations requests in request queue | |
700 | * @q: request queue to unplug | |
701 | * @depth: number of requests just added to the queue | |
702 | * @explicit: whether this was an explicit unplug, or one from schedule() | |
703 | * | |
704 | * Unplug request queue @q because device driver is scheduled to work | |
705 | * on elements in the request queue. | |
706 | */ | |
7c68b363 | 707 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) |
3bc29f0a | 708 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug, block_unplug, |
7c68b363 | 709 | #else |
3bc29f0a | 710 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug, block_unplug_io, |
7c68b363 | 711 | #endif |
f62b389e | 712 | |
7c68b363 | 713 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) |
f62b389e MD |
714 | TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit), |
715 | ||
716 | TP_ARGS(q, depth, explicit) | |
7c68b363 AG |
717 | #else |
718 | TP_PROTO(struct request_queue *q), | |
719 | ||
720 | TP_ARGS(q) | |
721 | #endif | |
f62b389e MD |
722 | ) |
723 | ||
724 | /** | |
725 | * block_split - split a single bio struct into two bio structs | |
726 | * @q: queue containing the bio | |
727 | * @bio: block operation being split | |
728 | * @new_sector: The starting sector for the new bio | |
729 | * | |
730 | * The bio request @bio in request queue @q needs to be split into two | |
731 | * bio requests. The newly created @bio request starts at | |
732 | * @new_sector. This split may be required due to hardware limitation | |
733 | * such as operation crossing device boundaries in a RAID system. | |
734 | */ | |
3bc29f0a | 735 | LTTNG_TRACEPOINT_EVENT(block_split, |
f62b389e MD |
736 | |
737 | TP_PROTO(struct request_queue *q, struct bio *bio, | |
738 | unsigned int new_sector), | |
739 | ||
740 | TP_ARGS(q, bio, new_sector), | |
741 | ||
f127e61e MD |
742 | TP_FIELDS( |
743 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) | |
54c4c2e3 | 744 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
f127e61e MD |
745 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
746 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
747 | bio->bi_rw, bio->bi_iter.bi_size) | |
54c4c2e3 | 748 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
f127e61e MD |
749 | ctf_integer(sector_t, sector, bio->bi_sector) |
750 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
751 | bio->bi_rw, bio->bi_size) | |
54c4c2e3 | 752 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
f127e61e MD |
753 | ctf_integer(sector_t, new_sector, new_sector) |
754 | ctf_integer(pid_t, tid, current->pid) | |
755 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
756 | ) | |
f62b389e MD |
757 | ) |
758 | ||
759 | /** | |
760 | * block_bio_remap - map request for a logical device to the raw device | |
761 | * @q: queue holding the operation | |
762 | * @bio: revised operation | |
763 | * @dev: device for the operation | |
764 | * @from: original sector for the operation | |
765 | * | |
766 | * An operation for a logical device has been mapped to the | |
767 | * raw block device. | |
768 | */ | |
7c68b363 | 769 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
3bc29f0a | 770 | LTTNG_TRACEPOINT_EVENT(block_bio_remap, |
7c68b363 | 771 | #else |
3bc29f0a | 772 | LTTNG_TRACEPOINT_EVENT(block_remap, |
7c68b363 | 773 | #endif |
f62b389e MD |
774 | |
775 | TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev, | |
776 | sector_t from), | |
777 | ||
778 | TP_ARGS(q, bio, dev, from), | |
779 | ||
f127e61e MD |
780 | TP_FIELDS( |
781 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) | |
54c4c2e3 | 782 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
f127e61e MD |
783 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
784 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
785 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
786 | bio->bi_rw, bio->bi_iter.bi_size) | |
54c4c2e3 | 787 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
f127e61e MD |
788 | ctf_integer(sector_t, sector, bio->bi_sector) |
789 | ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) | |
790 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
791 | bio->bi_rw, bio->bi_size) | |
54c4c2e3 | 792 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
f127e61e MD |
793 | ctf_integer(dev_t, old_dev, dev) |
794 | ctf_integer(sector_t, old_sector, from) | |
795 | ) | |
f62b389e MD |
796 | ) |
797 | ||
7c68b363 | 798 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) |
f62b389e MD |
799 | /** |
800 | * block_rq_remap - map request for a block operation request | |
801 | * @q: queue holding the operation | |
802 | * @rq: block IO operation request | |
803 | * @dev: device for the operation | |
804 | * @from: original sector for the operation | |
805 | * | |
806 | * The block operation request @rq in @q has been remapped. The block | |
807 | * operation request @rq holds the current information and @from hold | |
808 | * the original sector. | |
809 | */ | |
3bc29f0a | 810 | LTTNG_TRACEPOINT_EVENT(block_rq_remap, |
f62b389e MD |
811 | |
812 | TP_PROTO(struct request_queue *q, struct request *rq, dev_t dev, | |
813 | sector_t from), | |
814 | ||
815 | TP_ARGS(q, rq, dev, from), | |
816 | ||
f127e61e MD |
817 | TP_FIELDS( |
818 | ctf_integer(dev_t, dev, disk_devt(rq->rq_disk)) | |
819 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) | |
820 | ctf_integer(unsigned int, nr_sector, blk_rq_sectors(rq)) | |
821 | ctf_integer(dev_t, old_dev, dev) | |
822 | ctf_integer(sector_t, old_sector, from) | |
823 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
824 | rq->cmd_flags, blk_rq_bytes(rq)) | |
825 | ) | |
f62b389e | 826 | ) |
7c68b363 | 827 | #endif |
f62b389e MD |
828 | |
829 | #undef __print_rwbs_flags | |
830 | #undef blk_fill_rwbs | |
831 | ||
3bc29f0a | 832 | #endif /* LTTNG_TRACE_BLOCK_H */ |
f62b389e MD |
833 | |
834 | /* This part must be outside protection */ | |
5b88d86e | 835 | #include "../../../probes/define_trace.h" |
f62b389e | 836 |