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