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