Commit | Line | Data |
---|---|---|
b7cdc182 | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
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 | |
3b4aafcb | 8 | #include <lttng/tracepoint-event.h> |
f62b389e MD |
9 | #include <linux/blktrace_api.h> |
10 | #include <linux/blkdev.h> | |
f62b389e | 11 | #include <linux/trace_seq.h> |
5f4c791e | 12 | #include <lttng/kernel-version.h> |
7c68b363 | 13 | |
5f4c791e | 14 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) |
8a9f549f | 15 | #include <scsi/scsi_request.h> |
5f4c791e | 16 | #endif /* (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */ |
8a9f549f | 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 | ||
b76633f1 | 37 | #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM |
23634515 GB |
38 | LTTNG_TRACEPOINT_ENUM(block_rq_type, |
39 | TP_ENUM_VALUES( | |
40 | ctf_enum_value("RWBS_FLAG_WRITE", RWBS_FLAG_WRITE) | |
41 | ctf_enum_value("RWBS_FLAG_DISCARD", RWBS_FLAG_DISCARD) | |
42 | ctf_enum_value("RWBS_FLAG_READ", RWBS_FLAG_READ) | |
43 | ctf_enum_value("RWBS_FLAG_RAHEAD", RWBS_FLAG_RAHEAD) | |
44 | ctf_enum_value("RWBS_FLAG_BARRIER", RWBS_FLAG_BARRIER) | |
45 | ctf_enum_value("RWBS_FLAG_SYNC", RWBS_FLAG_SYNC) | |
46 | ctf_enum_value("RWBS_FLAG_META", RWBS_FLAG_META) | |
47 | ctf_enum_value("RWBS_FLAG_SECURE", RWBS_FLAG_SECURE) | |
48 | ctf_enum_value("RWBS_FLAG_FLUSH", RWBS_FLAG_FLUSH) | |
49 | ctf_enum_value("RWBS_FLAG_FUA", RWBS_FLAG_FUA) | |
50 | ctf_enum_value("RWBS_FLAG_PREFLUSH", RWBS_FLAG_PREFLUSH) | |
51 | ) | |
52 | ) | |
b76633f1 | 53 | #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */ |
23634515 | 54 | |
5f4c791e | 55 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,8,0) || \ |
0badc02f MJ |
56 | LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \ |
57 | LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \ | |
58 | LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \ | |
59 | LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,4,103,7,0,0) || \ | |
60 | LTTNG_SLE_KERNEL_RANGE(4,4,114,94,0,0, 4,4,114,95,0,0) || \ | |
61 | LTTNG_SLE_KERNEL_RANGE(4,4,120,94,0,0, 4,4,120,95,0,0) || \ | |
62 | LTTNG_SLE_KERNEL_RANGE(4,4,126,94,0,0, 4,5,0,0,0,0)) | |
e6d2cc09 MD |
63 | |
64 | #define lttng_req_op(rq) req_op(rq) | |
65 | #define lttng_req_rw(rq) ((rq)->cmd_flags) | |
66 | #define lttng_bio_op(bio) bio_op(bio) | |
67 | #define lttng_bio_rw(bio) ((bio)->bi_opf) | |
68 | ||
b76633f1 | 69 | #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM |
e6d2cc09 | 70 | #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \ |
23634515 | 71 | ctf_enum(block_rq_type, type, rwbs, \ |
e6d2cc09 MD |
72 | (((op) == REQ_OP_WRITE || (op) == REQ_OP_WRITE_SAME) ? RWBS_FLAG_WRITE : \ |
73 | ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \ | |
74 | ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \ | |
75 | ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \ | |
76 | ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \ | |
77 | ( 0 )))))) \ | |
78 | | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \ | |
79 | | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \ | |
80 | | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \ | |
81 | | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \ | |
82 | | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0)) | |
b76633f1 MJ |
83 | #else |
84 | #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \ | |
85 | ctf_integer(type, rwbs, \ | |
86 | (((op) == REQ_OP_WRITE || (op) == REQ_OP_WRITE_SAME) ? RWBS_FLAG_WRITE : \ | |
87 | ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \ | |
88 | ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \ | |
89 | ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \ | |
90 | ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \ | |
91 | ( 0 )))))) \ | |
92 | | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \ | |
93 | | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \ | |
94 | | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \ | |
95 | | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \ | |
96 | | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0)) | |
97 | #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */ | |
e6d2cc09 | 98 | |
5f4c791e | 99 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,1,0)) |
7c68b363 | 100 | |
e6d2cc09 MD |
101 | #define lttng_req_op(rq) |
102 | #define lttng_req_rw(rq) ((rq)->cmd_flags) | |
103 | #define lttng_bio_op(bio) | |
104 | #define lttng_bio_rw(bio) ((bio)->bi_rw) | |
105 | ||
b76633f1 | 106 | #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM |
e6d2cc09 | 107 | #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \ |
23634515 | 108 | ctf_enum(block_rq_type, type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ |
7c68b363 AG |
109 | ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \ |
110 | ( (bytes) ? RWBS_FLAG_READ : \ | |
111 | ( 0 )))) \ | |
112 | | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \ | |
113 | | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \ | |
114 | | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \ | |
115 | | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \ | |
116 | | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \ | |
117 | | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0)) | |
b76633f1 MJ |
118 | #else |
119 | #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \ | |
120 | ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ | |
121 | ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \ | |
122 | ( (bytes) ? RWBS_FLAG_READ : \ | |
123 | ( 0 )))) \ | |
124 | | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \ | |
125 | | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \ | |
126 | | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \ | |
127 | | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \ | |
128 | | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \ | |
129 | | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0)) | |
130 | #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */ | |
7c68b363 | 131 | |
5093a483 | 132 | #else |
7c68b363 | 133 | |
e6d2cc09 MD |
134 | #define lttng_req_op(rq) |
135 | #define lttng_req_rw(rq) ((rq)->cmd_flags) | |
136 | #define lttng_bio_op(bio) | |
137 | #define lttng_bio_rw(bio) ((bio)->bi_rw) | |
138 | ||
b76633f1 | 139 | #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM |
e6d2cc09 | 140 | #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \ |
23634515 | 141 | ctf_enum(block_rq_type, type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ |
7c68b363 AG |
142 | ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \ |
143 | ( (bytes) ? RWBS_FLAG_READ : \ | |
144 | ( 0 )))) \ | |
145 | | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \ | |
7c68b363 AG |
146 | | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \ |
147 | | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \ | |
148 | | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0)) | |
b76633f1 MJ |
149 | #else |
150 | #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \ | |
151 | ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ | |
152 | ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \ | |
153 | ( (bytes) ? RWBS_FLAG_READ : \ | |
154 | ( 0 )))) \ | |
155 | | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \ | |
156 | | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \ | |
157 | | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \ | |
158 | | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0)) | |
159 | #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */ | |
7c68b363 | 160 | |
7c68b363 AG |
161 | #endif |
162 | ||
5f4c791e | 163 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) |
3bc29f0a | 164 | LTTNG_TRACEPOINT_EVENT_CLASS(block_buffer, |
217f66c6 MD |
165 | |
166 | TP_PROTO(struct buffer_head *bh), | |
167 | ||
168 | TP_ARGS(bh), | |
169 | ||
f127e61e MD |
170 | TP_FIELDS ( |
171 | ctf_integer(dev_t, dev, bh->b_bdev->bd_dev) | |
172 | ctf_integer(sector_t, sector, bh->b_blocknr) | |
173 | ctf_integer(size_t, size, bh->b_size) | |
217f66c6 MD |
174 | ) |
175 | ) | |
176 | ||
177 | /** | |
178 | * block_touch_buffer - mark a buffer accessed | |
179 | * @bh: buffer_head being touched | |
180 | * | |
181 | * Called from touch_buffer(). | |
182 | */ | |
3bc29f0a | 183 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer, block_touch_buffer, |
217f66c6 MD |
184 | |
185 | TP_PROTO(struct buffer_head *bh), | |
186 | ||
187 | TP_ARGS(bh) | |
188 | ) | |
189 | ||
190 | /** | |
191 | * block_dirty_buffer - mark a buffer dirty | |
192 | * @bh: buffer_head being dirtied | |
193 | * | |
194 | * Called from mark_buffer_dirty(). | |
195 | */ | |
3bc29f0a | 196 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer, block_dirty_buffer, |
217f66c6 MD |
197 | |
198 | TP_PROTO(struct buffer_head *bh), | |
199 | ||
200 | TP_ARGS(bh) | |
201 | ) | |
202 | #endif | |
203 | ||
5f4c791e | 204 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0)) |
d2457078 | 205 | /* block_rq_with_error event class removed in kernel 4.12 */ |
5f4c791e | 206 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) |
f127e61e | 207 | LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error, |
f62b389e MD |
208 | |
209 | TP_PROTO(struct request_queue *q, struct request *rq), | |
210 | ||
211 | TP_ARGS(q, rq), | |
212 | ||
f127e61e MD |
213 | TP_locvar( |
214 | sector_t sector; | |
215 | unsigned int nr_sector; | |
216 | unsigned char *cmd; | |
217 | size_t cmd_len; | |
f62b389e MD |
218 | ), |
219 | ||
265822ae | 220 | TP_code_pre( |
8a9f549f FD |
221 | if (blk_rq_is_scsi(rq)) { |
222 | struct scsi_request *scsi_rq = scsi_req(rq); | |
223 | tp_locvar->sector = 0; | |
224 | tp_locvar->nr_sector = 0; | |
225 | tp_locvar->cmd = scsi_rq->cmd; | |
226 | tp_locvar->cmd_len = scsi_rq->cmd_len; | |
227 | } else { | |
228 | tp_locvar->sector = blk_rq_pos(rq); | |
229 | tp_locvar->nr_sector = blk_rq_sectors(rq); | |
230 | tp_locvar->cmd = NULL; | |
231 | tp_locvar->cmd_len = 0; | |
232 | } | |
233 | ), | |
234 | ||
235 | TP_FIELDS( | |
236 | ctf_integer(dev_t, dev, | |
237 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
238 | ctf_integer(sector_t, sector, tp_locvar->sector) | |
239 | ctf_integer(unsigned int, nr_sector, tp_locvar->nr_sector) | |
240 | ctf_integer(int, errors, rq->errors) | |
241 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
242 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) | |
243 | ctf_sequence_hex(unsigned char, cmd, | |
244 | tp_locvar->cmd, size_t, tp_locvar->cmd_len) | |
245 | ), | |
246 | ||
247 | TP_code_post() | |
248 | ) | |
5f4c791e | 249 | #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */ |
8a9f549f FD |
250 | LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error, |
251 | ||
252 | TP_PROTO(struct request_queue *q, struct request *rq), | |
253 | ||
254 | TP_ARGS(q, rq), | |
255 | ||
256 | TP_locvar( | |
257 | sector_t sector; | |
258 | unsigned int nr_sector; | |
259 | unsigned char *cmd; | |
260 | size_t cmd_len; | |
261 | ), | |
262 | ||
263 | TP_code_pre( | |
264 | ||
f127e61e MD |
265 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { |
266 | tp_locvar->sector = 0; | |
267 | tp_locvar->nr_sector = 0; | |
268 | tp_locvar->cmd = rq->cmd; | |
269 | tp_locvar->cmd_len = rq->cmd_len; | |
270 | } else { | |
271 | tp_locvar->sector = blk_rq_pos(rq); | |
272 | tp_locvar->nr_sector = blk_rq_sectors(rq); | |
273 | tp_locvar->cmd = NULL; | |
274 | tp_locvar->cmd_len = 0; | |
275 | } | |
f62b389e MD |
276 | ), |
277 | ||
f127e61e MD |
278 | TP_FIELDS( |
279 | ctf_integer(dev_t, dev, | |
280 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
281 | ctf_integer(sector_t, sector, tp_locvar->sector) | |
282 | ctf_integer(unsigned int, nr_sector, tp_locvar->nr_sector) | |
283 | ctf_integer(int, errors, rq->errors) | |
284 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 | 285 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) |
f127e61e MD |
286 | ctf_sequence_hex(unsigned char, cmd, |
287 | tp_locvar->cmd, size_t, tp_locvar->cmd_len) | |
265822ae MD |
288 | ), |
289 | ||
290 | TP_code_post() | |
f62b389e | 291 | ) |
5f4c791e | 292 | #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */ |
f62b389e | 293 | |
5f4c791e | 294 | #if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(4,12,0)) |
f62b389e MD |
295 | /** |
296 | * block_rq_abort - abort block operation request | |
297 | * @q: queue containing the block operation request | |
298 | * @rq: block IO operation request | |
299 | * | |
300 | * Called immediately after pending block IO operation request @rq in | |
301 | * queue @q is aborted. The fields in the operation request @rq | |
302 | * can be examined to determine which device and sectors the pending | |
303 | * operation would access. | |
304 | */ | |
3bc29f0a | 305 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_abort, |
f62b389e MD |
306 | |
307 | TP_PROTO(struct request_queue *q, struct request *rq), | |
308 | ||
309 | TP_ARGS(q, rq) | |
310 | ) | |
d2457078 | 311 | #endif |
f62b389e | 312 | |
4b1945d3 MJ |
313 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0)) |
314 | /** | |
315 | * block_rq_requeue - place block IO request back on a queue | |
316 | * @rq: block IO operation request | |
317 | * | |
318 | * The block operation request @rq is being placed back into queue | |
319 | * @q. For some reason the request was not completed and needs to be | |
320 | * put back in the queue. | |
321 | */ | |
322 | LTTNG_TRACEPOINT_EVENT(block_rq_requeue, | |
323 | ||
324 | TP_PROTO(struct request *rq), | |
325 | ||
326 | TP_ARGS(rq), | |
327 | ||
328 | TP_FIELDS( | |
329 | ctf_integer(dev_t, dev, | |
330 | rq->q->disk ? disk_devt(rq->q->disk) : 0) | |
331 | ctf_integer(sector_t, sector, blk_rq_trace_sector(rq)) | |
332 | ctf_integer(unsigned int, nr_sector, blk_rq_trace_nr_sectors(rq)) | |
333 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
334 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) | |
335 | ) | |
336 | ) | |
337 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) | |
2d67b98e MJ |
338 | /** |
339 | * block_rq_requeue - place block IO request back on a queue | |
340 | * @rq: block IO operation request | |
341 | * | |
342 | * The block operation request @rq is being placed back into queue | |
343 | * @q. For some reason the request was not completed and needs to be | |
344 | * put back in the queue. | |
345 | */ | |
346 | LTTNG_TRACEPOINT_EVENT(block_rq_requeue, | |
347 | ||
348 | TP_PROTO(struct request *rq), | |
349 | ||
350 | TP_ARGS(rq), | |
351 | ||
352 | TP_FIELDS( | |
353 | ctf_integer(dev_t, dev, | |
354 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
355 | ctf_integer(sector_t, sector, blk_rq_trace_sector(rq)) | |
356 | ctf_integer(unsigned int, nr_sector, blk_rq_trace_nr_sectors(rq)) | |
357 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
358 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) | |
359 | ) | |
360 | ) | |
5f4c791e | 361 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0)) |
f62b389e MD |
362 | /** |
363 | * block_rq_requeue - place block IO request back on a queue | |
364 | * @q: queue holding operation | |
365 | * @rq: block IO operation request | |
366 | * | |
367 | * The block operation request @rq is being placed back into queue | |
368 | * @q. For some reason the request was not completed and needs to be | |
369 | * put back in the queue. | |
370 | */ | |
d2457078 MJ |
371 | LTTNG_TRACEPOINT_EVENT(block_rq_requeue, |
372 | ||
373 | TP_PROTO(struct request_queue *q, struct request *rq), | |
374 | ||
375 | TP_ARGS(q, rq), | |
376 | ||
377 | TP_FIELDS( | |
378 | ctf_integer(dev_t, dev, | |
379 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
380 | ctf_integer(sector_t, sector, blk_rq_trace_sector(rq)) | |
381 | ctf_integer(unsigned int, nr_sector, blk_rq_trace_nr_sectors(rq)) | |
382 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
383 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) | |
384 | ) | |
385 | ) | |
386 | #else | |
3bc29f0a | 387 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_requeue, |
f62b389e MD |
388 | |
389 | TP_PROTO(struct request_queue *q, struct request *rq), | |
390 | ||
391 | TP_ARGS(q, rq) | |
392 | ) | |
d2457078 | 393 | #endif |
f62b389e | 394 | |
1c53e689 MD |
395 | /** |
396 | * block_rq_complete - block IO operation completed by device driver | |
397 | * @q: queue containing the block operation request | |
398 | * @rq: block operations request | |
399 | * @nr_bytes: number of completed bytes | |
400 | * | |
401 | * The block_rq_complete tracepoint event indicates that some portion | |
402 | * of operation request has been completed by the device driver. If | |
403 | * the @rq->bio is %NULL, then there is absolutely no additional work to | |
404 | * do for the request. If @rq->bio is non-NULL then there is | |
405 | * additional work required to complete the request. | |
406 | */ | |
4b1945d3 MJ |
407 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0)) |
408 | LTTNG_TRACEPOINT_EVENT(block_rq_complete, | |
409 | ||
410 | TP_PROTO(struct request *rq, blk_status_t error, unsigned int nr_bytes), | |
411 | ||
412 | TP_ARGS(rq, error, nr_bytes), | |
413 | ||
414 | TP_FIELDS( | |
415 | ctf_integer(dev_t, dev, | |
416 | rq->q->disk ? disk_devt(rq->q->disk) : 0) | |
417 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) | |
418 | ctf_integer(unsigned int, nr_sector, nr_bytes >> 9) | |
419 | ctf_integer(int, error, blk_status_to_errno(error)) | |
420 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
421 | lttng_req_op(rq), lttng_req_rw(rq), nr_bytes) | |
422 | ) | |
423 | ) | |
424 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,16,0)) | |
2f0087ab MJ |
425 | LTTNG_TRACEPOINT_EVENT(block_rq_complete, |
426 | ||
427 | TP_PROTO(struct request *rq, blk_status_t error, unsigned int nr_bytes), | |
428 | ||
429 | TP_ARGS(rq, error, nr_bytes), | |
430 | ||
431 | TP_FIELDS( | |
432 | ctf_integer(dev_t, dev, | |
433 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
434 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) | |
435 | ctf_integer(unsigned int, nr_sector, nr_bytes >> 9) | |
436 | ctf_integer(int, error, blk_status_to_errno(error)) | |
437 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
438 | lttng_req_op(rq), lttng_req_rw(rq), nr_bytes) | |
439 | ) | |
440 | ) | |
441 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0)) | |
d2457078 MJ |
442 | LTTNG_TRACEPOINT_EVENT(block_rq_complete, |
443 | ||
444 | TP_PROTO(struct request *rq, int error, unsigned int nr_bytes), | |
445 | ||
446 | TP_ARGS(rq, error, nr_bytes), | |
447 | ||
448 | TP_FIELDS( | |
449 | ctf_integer(dev_t, dev, | |
450 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
451 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) | |
452 | ctf_integer(unsigned int, nr_sector, nr_bytes >> 9) | |
453 | ctf_integer(int, error, error) | |
454 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
455 | lttng_req_op(rq), lttng_req_rw(rq), nr_bytes) | |
456 | ) | |
457 | ) | |
5f4c791e | 458 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) |
8a9f549f FD |
459 | LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete, |
460 | ||
461 | TP_PROTO(struct request_queue *q, struct request *rq, | |
462 | unsigned int nr_bytes), | |
463 | ||
464 | TP_ARGS(q, rq, nr_bytes), | |
465 | ||
466 | TP_locvar( | |
467 | unsigned char *cmd; | |
468 | size_t cmd_len; | |
469 | ), | |
470 | ||
471 | TP_code_pre( | |
472 | if (blk_rq_is_scsi(rq)) { | |
473 | struct scsi_request *scsi_rq = scsi_req(rq); | |
474 | tp_locvar->cmd = scsi_rq->cmd; | |
475 | tp_locvar->cmd_len = scsi_rq->cmd_len; | |
476 | } else { | |
477 | tp_locvar->cmd = NULL; | |
478 | tp_locvar->cmd_len = 0; | |
479 | } | |
480 | ), | |
481 | ||
482 | TP_FIELDS( | |
483 | ctf_integer(dev_t, dev, | |
484 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
485 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) | |
486 | ctf_integer(unsigned int, nr_sector, nr_bytes >> 9) | |
487 | ctf_integer(int, errors, rq->errors) | |
488 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
489 | lttng_req_op(rq), lttng_req_rw(rq), nr_bytes) | |
490 | ctf_sequence_hex(unsigned char, cmd, | |
491 | tp_locvar->cmd, size_t, tp_locvar->cmd_len) | |
492 | ), | |
493 | ||
494 | TP_code_post() | |
495 | ) | |
5f4c791e | 496 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,5) \ |
8a9f549f FD |
497 | || LTTNG_KERNEL_RANGE(3,12,21, 3,13,0) \ |
498 | || LTTNG_KERNEL_RANGE(3,10,41, 3,11,0) \ | |
499 | || LTTNG_KERNEL_RANGE(3,4,91, 3,5,0) \ | |
500 | || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0) \ | |
501 | || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,28, 3,14,0,0) \ | |
502 | || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0)) | |
503 | ||
f127e61e | 504 | LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete, |
1c53e689 MD |
505 | |
506 | TP_PROTO(struct request_queue *q, struct request *rq, | |
507 | unsigned int nr_bytes), | |
508 | ||
509 | TP_ARGS(q, rq, nr_bytes), | |
510 | ||
f127e61e MD |
511 | TP_locvar( |
512 | unsigned char *cmd; | |
513 | size_t cmd_len; | |
1c53e689 MD |
514 | ), |
515 | ||
265822ae | 516 | TP_code_pre( |
f127e61e MD |
517 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { |
518 | tp_locvar->cmd = rq->cmd; | |
519 | tp_locvar->cmd_len = rq->cmd_len; | |
520 | } else { | |
521 | tp_locvar->cmd = NULL; | |
522 | tp_locvar->cmd_len = 0; | |
523 | } | |
1c53e689 MD |
524 | ), |
525 | ||
f127e61e MD |
526 | TP_FIELDS( |
527 | ctf_integer(dev_t, dev, | |
528 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
529 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) | |
530 | ctf_integer(unsigned int, nr_sector, nr_bytes >> 9) | |
531 | ctf_integer(int, errors, rq->errors) | |
532 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 | 533 | lttng_req_op(rq), lttng_req_rw(rq), nr_bytes) |
f127e61e MD |
534 | ctf_sequence_hex(unsigned char, cmd, |
535 | tp_locvar->cmd, size_t, tp_locvar->cmd_len) | |
265822ae MD |
536 | ), |
537 | ||
538 | TP_code_post() | |
1c53e689 MD |
539 | ) |
540 | ||
5f4c791e | 541 | #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,15,0)) */ |
1c53e689 | 542 | |
f62b389e MD |
543 | /** |
544 | * block_rq_complete - block IO operation completed by device driver | |
545 | * @q: queue containing the block operation request | |
546 | * @rq: block operations request | |
547 | * | |
548 | * The block_rq_complete tracepoint event indicates that some portion | |
549 | * of operation request has been completed by the device driver. If | |
550 | * the @rq->bio is %NULL, then there is absolutely no additional work to | |
551 | * do for the request. If @rq->bio is non-NULL then there is | |
552 | * additional work required to complete the request. | |
553 | */ | |
3bc29f0a | 554 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_complete, |
f62b389e MD |
555 | |
556 | TP_PROTO(struct request_queue *q, struct request *rq), | |
557 | ||
558 | TP_ARGS(q, rq) | |
559 | ) | |
560 | ||
5f4c791e | 561 | #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,15,0)) */ |
1c53e689 | 562 | |
4b1945d3 MJ |
563 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0)) |
564 | LTTNG_TRACEPOINT_EVENT_CLASS(block_rq, | |
565 | ||
566 | TP_PROTO(struct request *rq), | |
567 | ||
568 | TP_ARGS(rq), | |
569 | ||
570 | TP_FIELDS( | |
571 | ctf_integer(dev_t, dev, | |
572 | rq->q->disk ? disk_devt(rq->q->disk) : 0) | |
573 | ctf_integer(sector_t, sector, blk_rq_trace_sector(rq)) | |
574 | ctf_integer(unsigned int, nr_sector, blk_rq_trace_nr_sectors(rq)) | |
575 | ctf_integer(unsigned int, bytes, blk_rq_bytes(rq)) | |
576 | ctf_integer(pid_t, tid, current->pid) | |
577 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
578 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) | |
579 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
580 | ) | |
581 | ) | |
582 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) | |
2d67b98e MJ |
583 | LTTNG_TRACEPOINT_EVENT_CLASS(block_rq, |
584 | ||
585 | TP_PROTO(struct request *rq), | |
586 | ||
587 | TP_ARGS(rq), | |
588 | ||
589 | TP_FIELDS( | |
590 | ctf_integer(dev_t, dev, | |
591 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
592 | ctf_integer(sector_t, sector, blk_rq_trace_sector(rq)) | |
593 | ctf_integer(unsigned int, nr_sector, blk_rq_trace_nr_sectors(rq)) | |
594 | ctf_integer(unsigned int, bytes, blk_rq_bytes(rq)) | |
595 | ctf_integer(pid_t, tid, current->pid) | |
596 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
597 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) | |
598 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
599 | ) | |
600 | ) | |
5f4c791e | 601 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0)) |
d2457078 MJ |
602 | LTTNG_TRACEPOINT_EVENT_CLASS(block_rq, |
603 | ||
604 | TP_PROTO(struct request_queue *q, struct request *rq), | |
605 | ||
606 | TP_ARGS(q, rq), | |
607 | ||
608 | TP_FIELDS( | |
609 | ctf_integer(dev_t, dev, | |
610 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
611 | ctf_integer(sector_t, sector, blk_rq_trace_sector(rq)) | |
612 | ctf_integer(unsigned int, nr_sector, blk_rq_trace_nr_sectors(rq)) | |
613 | ctf_integer(unsigned int, bytes, blk_rq_bytes(rq)) | |
614 | ctf_integer(pid_t, tid, current->pid) | |
615 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
616 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) | |
617 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
618 | ) | |
619 | ) | |
5f4c791e | 620 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) |
8a9f549f FD |
621 | LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq, |
622 | ||
623 | TP_PROTO(struct request_queue *q, struct request *rq), | |
624 | ||
625 | TP_ARGS(q, rq), | |
626 | ||
627 | TP_locvar( | |
628 | sector_t sector; | |
629 | unsigned int nr_sector; | |
630 | unsigned int bytes; | |
631 | unsigned char *cmd; | |
632 | size_t cmd_len; | |
633 | ), | |
634 | ||
635 | TP_code_pre( | |
636 | if (blk_rq_is_scsi(rq)) { | |
637 | struct scsi_request *scsi_rq = scsi_req(rq); | |
638 | tp_locvar->sector = 0; | |
639 | tp_locvar->nr_sector = 0; | |
640 | tp_locvar->bytes = scsi_rq->resid_len; | |
641 | tp_locvar->cmd = scsi_rq->cmd; | |
642 | tp_locvar->cmd_len = scsi_rq->cmd_len; | |
643 | } else { | |
644 | tp_locvar->sector = blk_rq_pos(rq); | |
645 | tp_locvar->nr_sector = blk_rq_sectors(rq); | |
646 | tp_locvar->bytes = 0; | |
647 | tp_locvar->cmd = NULL; | |
648 | tp_locvar->cmd_len = 0; | |
649 | } | |
650 | ), | |
651 | ||
652 | TP_FIELDS( | |
653 | ctf_integer(dev_t, dev, | |
654 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
655 | ctf_integer(sector_t, sector, tp_locvar->sector) | |
656 | ctf_integer(unsigned int, nr_sector, tp_locvar->nr_sector) | |
657 | ctf_integer(unsigned int, bytes, tp_locvar->bytes) | |
658 | ctf_integer(pid_t, tid, current->pid) | |
659 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
660 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) | |
661 | ctf_sequence_hex(unsigned char, cmd, | |
662 | tp_locvar->cmd, size_t, tp_locvar->cmd_len) | |
663 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
664 | ), | |
665 | ||
666 | TP_code_post() | |
667 | ) | |
5f4c791e | 668 | #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */ |
f127e61e | 669 | LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq, |
f62b389e MD |
670 | |
671 | TP_PROTO(struct request_queue *q, struct request *rq), | |
672 | ||
673 | TP_ARGS(q, rq), | |
674 | ||
f127e61e MD |
675 | TP_locvar( |
676 | sector_t sector; | |
677 | unsigned int nr_sector; | |
678 | unsigned int bytes; | |
679 | unsigned char *cmd; | |
680 | size_t cmd_len; | |
f62b389e MD |
681 | ), |
682 | ||
265822ae | 683 | TP_code_pre( |
f127e61e MD |
684 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { |
685 | tp_locvar->sector = 0; | |
686 | tp_locvar->nr_sector = 0; | |
687 | tp_locvar->bytes = blk_rq_bytes(rq); | |
688 | tp_locvar->cmd = rq->cmd; | |
689 | tp_locvar->cmd_len = rq->cmd_len; | |
690 | } else { | |
691 | tp_locvar->sector = blk_rq_pos(rq); | |
692 | tp_locvar->nr_sector = blk_rq_sectors(rq); | |
693 | tp_locvar->bytes = 0; | |
694 | tp_locvar->cmd = NULL; | |
695 | tp_locvar->cmd_len = 0; | |
696 | } | |
f62b389e MD |
697 | ), |
698 | ||
f127e61e MD |
699 | TP_FIELDS( |
700 | ctf_integer(dev_t, dev, | |
701 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
702 | ctf_integer(sector_t, sector, tp_locvar->sector) | |
703 | ctf_integer(unsigned int, nr_sector, tp_locvar->nr_sector) | |
704 | ctf_integer(unsigned int, bytes, tp_locvar->bytes) | |
705 | ctf_integer(pid_t, tid, current->pid) | |
706 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 | 707 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) |
f127e61e MD |
708 | ctf_sequence_hex(unsigned char, cmd, |
709 | tp_locvar->cmd, size_t, tp_locvar->cmd_len) | |
710 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
265822ae MD |
711 | ), |
712 | ||
713 | TP_code_post() | |
f62b389e | 714 | ) |
5f4c791e | 715 | #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */ |
f62b389e | 716 | |
5f4c791e | 717 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
2d67b98e MJ |
718 | /** |
719 | * block_rq_insert - insert block operation request into queue | |
720 | * @rq: block IO operation request | |
721 | * | |
722 | * Called immediately before block operation request @rq is inserted | |
723 | * into queue @q. The fields in the operation request @rq struct can | |
724 | * be examined to determine which device and sectors the pending | |
725 | * operation would access. | |
726 | */ | |
727 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_insert, | |
728 | ||
729 | TP_PROTO(struct request *rq), | |
730 | ||
731 | TP_ARGS(rq) | |
732 | ) | |
733 | #else | |
f62b389e MD |
734 | /** |
735 | * block_rq_insert - insert block operation request into queue | |
736 | * @q: target queue | |
737 | * @rq: block IO operation request | |
738 | * | |
739 | * Called immediately before block operation request @rq is inserted | |
740 | * into queue @q. The fields in the operation request @rq struct can | |
741 | * be examined to determine which device and sectors the pending | |
742 | * operation would access. | |
743 | */ | |
3bc29f0a | 744 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_insert, |
f62b389e MD |
745 | |
746 | TP_PROTO(struct request_queue *q, struct request *rq), | |
747 | ||
748 | TP_ARGS(q, rq) | |
749 | ) | |
2d67b98e MJ |
750 | #endif |
751 | ||
5f4c791e | 752 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
2d67b98e MJ |
753 | /** |
754 | * block_rq_issue - issue pending block IO request operation to device driver | |
755 | * @rq: block IO operation operation request | |
756 | * | |
757 | * Called when block operation request @rq from queue @q is sent to a | |
758 | * device driver for processing. | |
759 | */ | |
760 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_issue, | |
f62b389e | 761 | |
2d67b98e MJ |
762 | TP_PROTO(struct request *rq), |
763 | ||
764 | TP_ARGS(rq) | |
765 | ) | |
766 | #else | |
f62b389e MD |
767 | /** |
768 | * block_rq_issue - issue pending block IO request operation to device driver | |
769 | * @q: queue holding operation | |
770 | * @rq: block IO operation operation request | |
771 | * | |
772 | * Called when block operation request @rq from queue @q is sent to a | |
773 | * device driver for processing. | |
774 | */ | |
3bc29f0a | 775 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_issue, |
f62b389e MD |
776 | |
777 | TP_PROTO(struct request_queue *q, struct request *rq), | |
778 | ||
779 | TP_ARGS(q, rq) | |
780 | ) | |
2d67b98e MJ |
781 | #endif |
782 | ||
5f4c791e | 783 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
2d67b98e MJ |
784 | /** |
785 | * block_rq_merge - merge request with another one in the elevator | |
786 | * @rq: block IO operation operation request | |
787 | * | |
788 | * Called when block operation request @rq from queue @q is merged to another | |
789 | * request queued in the elevator. | |
790 | */ | |
791 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_merge, | |
792 | ||
793 | TP_PROTO(struct request *rq), | |
794 | ||
795 | TP_ARGS(rq) | |
796 | ) | |
5f4c791e | 797 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,9,0)) |
2d67b98e MJ |
798 | /** |
799 | * block_rq_merge - merge request with another one in the elevator | |
800 | * @q: queue holding operation | |
801 | * @rq: block IO operation operation request | |
802 | * | |
803 | * Called when block operation request @rq from queue @q is merged to another | |
804 | * request queued in the elevator. | |
805 | */ | |
806 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_merge, | |
807 | ||
808 | TP_PROTO(struct request_queue *q, struct request *rq), | |
809 | ||
810 | TP_ARGS(q, rq) | |
811 | ) | |
812 | #endif | |
f62b389e | 813 | |
f3a2b1ec MJ |
814 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,8,0) || \ |
815 | LTTNG_RHEL_KERNEL_RANGE(4,18,0,305,0,0, 4,19,0,0,0,0)) | |
816 | ||
3441e48e MJ |
817 | /** |
818 | * block_bio_complete - completed all work on the block operation | |
819 | * @q: queue holding the block operation | |
820 | * @bio: block operation completed | |
821 | * @error: io error value | |
822 | * | |
823 | * This tracepoint indicates there is no further work to do on this | |
824 | * block IO operation @bio. | |
825 | */ | |
826 | LTTNG_TRACEPOINT_EVENT(block_bio_complete, | |
827 | ||
828 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
829 | ||
830 | TP_ARGS(q, bio), | |
831 | ||
832 | TP_FIELDS( | |
833 | ctf_integer(dev_t, dev, bio_dev(bio)) | |
834 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) | |
835 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
836 | ctf_integer(int, error, blk_status_to_errno(bio->bi_status)) | |
837 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
838 | lttng_bio_op(bio), lttng_bio_rw(bio), | |
839 | bio->bi_iter.bi_size) | |
840 | ) | |
841 | ) | |
5f4c791e | 842 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) |
f62b389e MD |
843 | /** |
844 | * block_bio_complete - completed all work on the block operation | |
845 | * @q: queue holding the block operation | |
846 | * @bio: block operation completed | |
847 | * @error: io error value | |
848 | * | |
849 | * This tracepoint indicates there is no further work to do on this | |
850 | * block IO operation @bio. | |
851 | */ | |
3bc29f0a | 852 | LTTNG_TRACEPOINT_EVENT(block_bio_complete, |
f62b389e MD |
853 | |
854 | TP_PROTO(struct request_queue *q, struct bio *bio, int error), | |
855 | ||
856 | TP_ARGS(q, bio, error), | |
857 | ||
f127e61e | 858 | TP_FIELDS( |
7feabe53 | 859 | ctf_integer(dev_t, dev, bio_dev(bio)) |
3441e48e MJ |
860 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
861 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
862 | ctf_integer(int, error, error) | |
863 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
864 | lttng_bio_op(bio), lttng_bio_rw(bio), | |
865 | bio->bi_iter.bi_size) | |
866 | ) | |
867 | ) | |
5f4c791e | 868 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) |
3441e48e MJ |
869 | /** |
870 | * block_bio_complete - completed all work on the block operation | |
871 | * @q: queue holding the block operation | |
872 | * @bio: block operation completed | |
873 | * @error: io error value | |
874 | * | |
875 | * This tracepoint indicates there is no further work to do on this | |
876 | * block IO operation @bio. | |
877 | */ | |
878 | LTTNG_TRACEPOINT_EVENT(block_bio_complete, | |
879 | ||
880 | TP_PROTO(struct request_queue *q, struct bio *bio, int error), | |
881 | ||
882 | TP_ARGS(q, bio, error), | |
883 | ||
884 | TP_FIELDS( | |
959fe42a | 885 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
f127e61e MD |
886 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
887 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
888 | ctf_integer(int, error, error) | |
889 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 MD |
890 | lttng_bio_op(bio), lttng_bio_rw(bio), |
891 | bio->bi_iter.bi_size) | |
3441e48e MJ |
892 | ) |
893 | ) | |
894 | #else | |
895 | /** | |
896 | * block_bio_complete - completed all work on the block operation | |
897 | * @q: queue holding the block operation | |
898 | * @bio: block operation completed | |
899 | * @error: io error value | |
900 | * | |
901 | * This tracepoint indicates there is no further work to do on this | |
902 | * block IO operation @bio. | |
903 | */ | |
904 | LTTNG_TRACEPOINT_EVENT(block_bio_complete, | |
905 | ||
906 | TP_PROTO(struct request_queue *q, struct bio *bio, int error), | |
907 | ||
908 | TP_ARGS(q, bio, error), | |
909 | ||
910 | TP_FIELDS( | |
911 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) | |
f127e61e MD |
912 | ctf_integer(sector_t, sector, bio->bi_sector) |
913 | ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) | |
f127e61e | 914 | ctf_integer(int, error, error) |
f127e61e | 915 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
e6d2cc09 | 916 | lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size) |
f127e61e | 917 | ) |
f62b389e | 918 | ) |
3441e48e | 919 | #endif |
f62b389e | 920 | |
5f4c791e | 921 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
fa79b21c MJ |
922 | LTTNG_TRACEPOINT_EVENT_CLASS(block_bio, |
923 | ||
924 | TP_PROTO(struct bio *bio), | |
925 | ||
926 | TP_ARGS(bio), | |
927 | ||
928 | TP_FIELDS( | |
929 | ctf_integer(dev_t, dev, bio_dev(bio)) | |
930 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) | |
931 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
932 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
933 | lttng_bio_op(bio), lttng_bio_rw(bio), | |
934 | bio->bi_iter.bi_size) | |
935 | ctf_integer(pid_t, tid, current->pid) | |
936 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
937 | ) | |
938 | ) | |
5f4c791e | 939 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) |
3bc29f0a | 940 | LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge, |
217f66c6 MD |
941 | |
942 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), | |
943 | ||
944 | TP_ARGS(q, rq, bio), | |
945 | ||
f127e61e | 946 | TP_FIELDS( |
7feabe53 | 947 | ctf_integer(dev_t, dev, bio_dev(bio)) |
fa79b21c MJ |
948 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
949 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
950 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
951 | lttng_bio_op(bio), lttng_bio_rw(bio), | |
952 | bio->bi_iter.bi_size) | |
953 | ctf_integer(pid_t, tid, current->pid) | |
954 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
955 | ) | |
956 | ) | |
5f4c791e | 957 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) |
fa79b21c MJ |
958 | LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge, |
959 | ||
960 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), | |
961 | ||
962 | TP_ARGS(q, rq, bio), | |
963 | ||
964 | TP_FIELDS( | |
959fe42a | 965 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
f127e61e MD |
966 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
967 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
968 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 MD |
969 | lttng_bio_op(bio), lttng_bio_rw(bio), |
970 | bio->bi_iter.bi_size) | |
fa79b21c MJ |
971 | ctf_integer(pid_t, tid, current->pid) |
972 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
973 | ) | |
974 | ) | |
5f4c791e | 975 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) |
fa79b21c MJ |
976 | LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge, |
977 | ||
978 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), | |
979 | ||
980 | TP_ARGS(q, rq, bio), | |
981 | ||
982 | TP_FIELDS( | |
983 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) | |
f127e61e MD |
984 | ctf_integer(sector_t, sector, bio->bi_sector) |
985 | ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) | |
986 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 | 987 | lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size) |
f127e61e MD |
988 | ctf_integer(pid_t, tid, current->pid) |
989 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
990 | ) | |
217f66c6 | 991 | ) |
fa79b21c MJ |
992 | #endif |
993 | ||
994 | ||
995 | ||
5f4c791e | 996 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
fa79b21c MJ |
997 | /** |
998 | * block_bio_bounce - used bounce buffer when processing block operation | |
999 | * @bio: block operation | |
1000 | * | |
1001 | * A bounce buffer was used to handle the block operation @bio in @q. | |
1002 | * This occurs when hardware limitations prevent a direct transfer of | |
1003 | * data between the @bio data memory area and the IO device. Use of a | |
1004 | * bounce buffer requires extra copying of data and decreases | |
1005 | * performance. | |
1006 | */ | |
1007 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_bounce, | |
1008 | ||
1009 | TP_PROTO(struct bio *bio), | |
1010 | ||
1011 | TP_ARGS(bio) | |
1012 | ) | |
5f4c791e | 1013 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) |
fa79b21c MJ |
1014 | /** |
1015 | * block_bio_bounce - used bounce buffer when processing block operation | |
1016 | * @q: queue holding the block operation | |
1017 | * @bio: block operation | |
1018 | * | |
1019 | * A bounce buffer was used to handle the block operation @bio in @q. | |
1020 | * This occurs when hardware limitations prevent a direct transfer of | |
1021 | * data between the @bio data memory area and the IO device. Use of a | |
1022 | * bounce buffer requires extra copying of data and decreases | |
1023 | * performance. | |
1024 | */ | |
1025 | LTTNG_TRACEPOINT_EVENT(block_bio_bounce, | |
1026 | ||
1027 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
1028 | ||
1029 | TP_ARGS(q, bio), | |
1030 | ||
1031 | TP_FIELDS( | |
1032 | ctf_integer(dev_t, dev, bio_dev(bio)) | |
1033 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) | |
1034 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
1035 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
1036 | lttng_bio_op(bio), lttng_bio_rw(bio), | |
1037 | bio->bi_iter.bi_size) | |
1038 | ctf_integer(pid_t, tid, current->pid) | |
1039 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
1040 | ) | |
1041 | ) | |
5f4c791e | 1042 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) |
fa79b21c MJ |
1043 | LTTNG_TRACEPOINT_EVENT(block_bio_bounce, |
1044 | ||
1045 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
1046 | ||
1047 | TP_ARGS(q, bio), | |
1048 | ||
1049 | TP_FIELDS( | |
1050 | ctf_integer(dev_t, dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0) | |
1051 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) | |
1052 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
1053 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
1054 | lttng_bio_op(bio), lttng_bio_rw(bio), | |
1055 | bio->bi_iter.bi_size) | |
1056 | ctf_integer(pid_t, tid, current->pid) | |
1057 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
1058 | ) | |
1059 | ) | |
1060 | #else | |
1061 | LTTNG_TRACEPOINT_EVENT(block_bio_bounce, | |
1062 | ||
1063 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
217f66c6 | 1064 | |
fa79b21c MJ |
1065 | TP_ARGS(q, bio), |
1066 | ||
1067 | TP_FIELDS( | |
1068 | ctf_integer(dev_t, dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0) | |
1069 | ctf_integer(sector_t, sector, bio->bi_sector) | |
1070 | ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) | |
1071 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
1072 | lttng_bio_op(bio), lttng_bio_rw(bio), | |
1073 | bio->bi_size) | |
1074 | ctf_integer(pid_t, tid, current->pid) | |
1075 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
1076 | ) | |
1077 | ) | |
1078 | #endif | |
1079 | ||
1080 | ||
5f4c791e | 1081 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
fa79b21c MJ |
1082 | /** |
1083 | * block_bio_backmerge - merging block operation to the end of an existing operation | |
1084 | * @bio: new block operation to merge | |
1085 | * | |
1086 | * Merging block request @bio to the end of an existing block request. | |
1087 | */ | |
1088 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_backmerge, | |
1089 | ||
1090 | TP_PROTO(struct bio *bio), | |
1091 | ||
1092 | TP_ARGS(bio) | |
1093 | ) | |
1094 | ||
1095 | /** | |
1096 | * block_bio_frontmerge - merging block operation to the beginning of an existing operation | |
1097 | * @bio: new block operation to merge | |
1098 | * | |
1099 | * Merging block IO operation @bio to the beginning of an existing block request. | |
1100 | */ | |
1101 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_frontmerge, | |
1102 | ||
1103 | TP_PROTO(struct bio *bio), | |
1104 | ||
1105 | TP_ARGS(bio) | |
1106 | ) | |
1107 | ||
1108 | /** | |
1109 | * block_bio_queue - putting new block IO operation in queue | |
1110 | * @bio: new block operation | |
1111 | * | |
1112 | * About to place the block IO operation @bio into queue @q. | |
1113 | */ | |
1114 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_queue, | |
1115 | ||
1116 | TP_PROTO(struct bio *bio), | |
1117 | ||
1118 | TP_ARGS(bio) | |
1119 | ) | |
5f4c791e | 1120 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) |
217f66c6 MD |
1121 | /** |
1122 | * block_bio_backmerge - merging block operation to the end of an existing operation | |
1123 | * @q: queue holding operation | |
fa79b21c | 1124 | * @rq: request bio is being merged into |
217f66c6 MD |
1125 | * @bio: new block operation to merge |
1126 | * | |
1127 | * Merging block request @bio to the end of an existing block request | |
1128 | * in queue @q. | |
1129 | */ | |
3bc29f0a | 1130 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge, block_bio_backmerge, |
217f66c6 MD |
1131 | |
1132 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), | |
1133 | ||
1134 | TP_ARGS(q, rq, bio) | |
1135 | ) | |
1136 | ||
1137 | /** | |
1138 | * block_bio_frontmerge - merging block operation to the beginning of an existing operation | |
1139 | * @q: queue holding operation | |
fa79b21c | 1140 | * @rq: request bio is being merged into |
217f66c6 MD |
1141 | * @bio: new block operation to merge |
1142 | * | |
1143 | * Merging block IO operation @bio to the beginning of an existing block | |
1144 | * operation in queue @q. | |
1145 | */ | |
3bc29f0a | 1146 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge, block_bio_frontmerge, |
217f66c6 MD |
1147 | |
1148 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), | |
1149 | ||
1150 | TP_ARGS(q, rq, bio) | |
1151 | ) | |
1152 | ||
1153 | /** | |
1154 | * block_bio_queue - putting new block IO operation in queue | |
1155 | * @q: queue holding operation | |
1156 | * @bio: new block operation | |
1157 | * | |
1158 | * About to place the block IO operation @bio into queue @q. | |
1159 | */ | |
3bc29f0a | 1160 | LTTNG_TRACEPOINT_EVENT(block_bio_queue, |
217f66c6 MD |
1161 | |
1162 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
1163 | ||
1164 | TP_ARGS(q, bio), | |
1165 | ||
f127e61e | 1166 | TP_FIELDS( |
5f4c791e | 1167 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) |
7feabe53 MD |
1168 | ctf_integer(dev_t, dev, bio_dev(bio)) |
1169 | #else | |
959fe42a | 1170 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
7feabe53 | 1171 | #endif |
5f4c791e | 1172 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) |
f127e61e MD |
1173 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
1174 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
1175 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 MD |
1176 | lttng_bio_op(bio), lttng_bio_rw(bio), |
1177 | bio->bi_iter.bi_size) | |
5f4c791e | 1178 | #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */ |
f127e61e MD |
1179 | ctf_integer(sector_t, sector, bio->bi_sector) |
1180 | ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) | |
1181 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 | 1182 | lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size) |
5f4c791e | 1183 | #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */ |
f127e61e MD |
1184 | ctf_integer(pid_t, tid, current->pid) |
1185 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
1186 | ) | |
217f66c6 | 1187 | ) |
5f4c791e | 1188 | #else /* if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) */ |
3bc29f0a | 1189 | LTTNG_TRACEPOINT_EVENT_CLASS(block_bio, |
f62b389e MD |
1190 | |
1191 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
1192 | ||
1193 | TP_ARGS(q, bio), | |
1194 | ||
f127e61e | 1195 | TP_FIELDS( |
959fe42a | 1196 | ctf_integer(dev_t, dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0) |
f127e61e MD |
1197 | ctf_integer(sector_t, sector, bio->bi_sector) |
1198 | ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) | |
1199 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 | 1200 | lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size) |
f127e61e MD |
1201 | ctf_integer(pid_t, tid, current->pid) |
1202 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
1203 | ) | |
f62b389e MD |
1204 | ) |
1205 | ||
1206 | /** | |
1207 | * block_bio_backmerge - merging block operation to the end of an existing operation | |
1208 | * @q: queue holding operation | |
1209 | * @bio: new block operation to merge | |
1210 | * | |
1211 | * Merging block request @bio to the end of an existing block request | |
1212 | * in queue @q. | |
1213 | */ | |
3bc29f0a | 1214 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_backmerge, |
f62b389e MD |
1215 | |
1216 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
1217 | ||
1218 | TP_ARGS(q, bio) | |
1219 | ) | |
1220 | ||
1221 | /** | |
1222 | * block_bio_frontmerge - merging block operation to the beginning of an existing operation | |
1223 | * @q: queue holding operation | |
1224 | * @bio: new block operation to merge | |
1225 | * | |
1226 | * Merging block IO operation @bio to the beginning of an existing block | |
1227 | * operation in queue @q. | |
1228 | */ | |
3bc29f0a | 1229 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_frontmerge, |
f62b389e MD |
1230 | |
1231 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
1232 | ||
1233 | TP_ARGS(q, bio) | |
1234 | ) | |
1235 | ||
1236 | /** | |
1237 | * block_bio_queue - putting new block IO operation in queue | |
1238 | * @q: queue holding operation | |
1239 | * @bio: new block operation | |
1240 | * | |
1241 | * About to place the block IO operation @bio into queue @q. | |
1242 | */ | |
3bc29f0a | 1243 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_queue, |
f62b389e MD |
1244 | |
1245 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
1246 | ||
1247 | TP_ARGS(q, bio) | |
1248 | ) | |
5f4c791e | 1249 | #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) */ |
f62b389e | 1250 | |
5f4c791e | 1251 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
fa79b21c MJ |
1252 | /** |
1253 | * block_getrq - get a free request entry in queue for block IO operations | |
1254 | * @bio: pending block IO operation (can be %NULL) | |
1255 | * | |
1256 | * A request struct has been allocated to handle the block IO operation @bio. | |
1257 | */ | |
1258 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_getrq, | |
1259 | ||
1260 | TP_PROTO(struct bio *bio), | |
1261 | ||
1262 | TP_ARGS(bio) | |
1263 | ) | |
1264 | #else | |
3bc29f0a | 1265 | LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq, |
f62b389e MD |
1266 | |
1267 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), | |
1268 | ||
1269 | TP_ARGS(q, bio, rw), | |
1270 | ||
f127e61e | 1271 | TP_FIELDS( |
5f4c791e | 1272 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) |
6417cda6 | 1273 | ctf_integer(dev_t, dev, bio ? bio_dev(bio) : 0) |
7feabe53 | 1274 | #else |
959fe42a | 1275 | ctf_integer(dev_t, dev, bio ? bio->bi_bdev->bd_dev : 0) |
7feabe53 | 1276 | #endif |
5f4c791e | 1277 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) |
f127e61e MD |
1278 | ctf_integer(sector_t, sector, bio ? bio->bi_iter.bi_sector : 0) |
1279 | ctf_integer(unsigned int, nr_sector, | |
1280 | bio ? bio_sectors(bio) : 0) | |
1281 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 MD |
1282 | bio ? lttng_bio_op(bio) : 0, |
1283 | bio ? lttng_bio_rw(bio) : 0, | |
f127e61e | 1284 | bio ? bio->bi_iter.bi_size : 0) |
5f4c791e | 1285 | #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */ |
f127e61e MD |
1286 | ctf_integer(sector_t, sector, bio ? bio->bi_sector : 0) |
1287 | ctf_integer(unsigned int, nr_sector, | |
1288 | bio ? bio->bi_size >> 9 : 0) | |
1289 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 MD |
1290 | bio ? lttng_bio_op(bio) : 0, |
1291 | bio ? lttng_bio_rw(bio) : 0, | |
f127e61e | 1292 | bio ? bio->bi_size : 0) |
5f4c791e | 1293 | #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */ |
f127e61e MD |
1294 | ctf_integer(pid_t, tid, current->pid) |
1295 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
1296 | ) | |
f62b389e MD |
1297 | ) |
1298 | ||
1299 | /** | |
1300 | * block_getrq - get a free request entry in queue for block IO operations | |
1301 | * @q: queue for operations | |
6417cda6 | 1302 | * @bio: pending block IO operation (can be %NULL) |
f62b389e MD |
1303 | * @rw: low bit indicates a read (%0) or a write (%1) |
1304 | * | |
1305 | * A request struct for queue @q has been allocated to handle the | |
1306 | * block IO operation @bio. | |
1307 | */ | |
3bc29f0a | 1308 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq, block_getrq, |
f62b389e MD |
1309 | |
1310 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), | |
1311 | ||
1312 | TP_ARGS(q, bio, rw) | |
1313 | ) | |
1314 | ||
1315 | /** | |
1316 | * block_sleeprq - waiting to get a free request entry in queue for block IO operation | |
1317 | * @q: queue for operation | |
6417cda6 | 1318 | * @bio: pending block IO operation (can be %NULL) |
f62b389e MD |
1319 | * @rw: low bit indicates a read (%0) or a write (%1) |
1320 | * | |
1321 | * In the case where a request struct cannot be provided for queue @q | |
1322 | * the process needs to wait for an request struct to become | |
1323 | * available. This tracepoint event is generated each time the | |
1324 | * process goes to sleep waiting for request struct become available. | |
1325 | */ | |
3bc29f0a | 1326 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq, block_sleeprq, |
f62b389e MD |
1327 | |
1328 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), | |
1329 | ||
1330 | TP_ARGS(q, bio, rw) | |
1331 | ) | |
fa79b21c | 1332 | #endif |
f62b389e MD |
1333 | |
1334 | /** | |
1335 | * block_plug - keep operations requests in request queue | |
1336 | * @q: request queue to plug | |
1337 | * | |
1338 | * Plug the request queue @q. Do not allow block operation requests | |
1339 | * to be sent to the device driver. Instead, accumulate requests in | |
1340 | * the queue to improve throughput performance of the block device. | |
1341 | */ | |
3bc29f0a | 1342 | LTTNG_TRACEPOINT_EVENT(block_plug, |
f62b389e MD |
1343 | |
1344 | TP_PROTO(struct request_queue *q), | |
1345 | ||
1346 | TP_ARGS(q), | |
1347 | ||
f127e61e MD |
1348 | TP_FIELDS( |
1349 | ctf_integer(pid_t, tid, current->pid) | |
1350 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
1351 | ) | |
f62b389e MD |
1352 | ) |
1353 | ||
3bc29f0a | 1354 | LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug, |
f62b389e MD |
1355 | |
1356 | TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit), | |
1357 | ||
1358 | TP_ARGS(q, depth, explicit), | |
1359 | ||
f127e61e | 1360 | TP_FIELDS( |
f127e61e | 1361 | ctf_integer(int, nr_rq, depth) |
f127e61e MD |
1362 | ctf_integer(pid_t, tid, current->pid) |
1363 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
1364 | ) | |
f62b389e MD |
1365 | ) |
1366 | ||
1367 | /** | |
1368 | * block_unplug - release of operations requests in request queue | |
1369 | * @q: request queue to unplug | |
1370 | * @depth: number of requests just added to the queue | |
1371 | * @explicit: whether this was an explicit unplug, or one from schedule() | |
1372 | * | |
1373 | * Unplug request queue @q because device driver is scheduled to work | |
1374 | * on elements in the request queue. | |
1375 | */ | |
3bc29f0a | 1376 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug, block_unplug, |
f62b389e MD |
1377 | |
1378 | TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit), | |
1379 | ||
1380 | TP_ARGS(q, depth, explicit) | |
1381 | ) | |
1382 | ||
5f4c791e | 1383 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
ffcab3ce MJ |
1384 | /** |
1385 | * block_split - split a single bio struct into two bio structs | |
1386 | * @bio: block operation being split | |
1387 | * @new_sector: The starting sector for the new bio | |
1388 | * | |
1389 | * The bio request @bio needs to be split into two bio requests. The newly | |
1390 | * created @bio request starts at @new_sector. This split may be required due to | |
1391 | * hardware limitations such as operation crossing device boundaries in a RAID | |
1392 | * system. | |
1393 | */ | |
1394 | LTTNG_TRACEPOINT_EVENT(block_split, | |
1395 | ||
1396 | TP_PROTO(struct bio *bio, unsigned int new_sector), | |
1397 | ||
1398 | TP_ARGS(bio, new_sector), | |
1399 | ||
1400 | TP_FIELDS( | |
1401 | ctf_integer(dev_t, dev, bio_dev(bio)) | |
1402 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) | |
1403 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
1404 | lttng_bio_op(bio), lttng_bio_rw(bio), | |
1405 | bio->bi_iter.bi_size) | |
1406 | ctf_integer(sector_t, new_sector, new_sector) | |
1407 | ctf_integer(pid_t, tid, current->pid) | |
1408 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
1409 | ) | |
1410 | ) | |
1411 | ||
5f4c791e | 1412 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) |
f62b389e MD |
1413 | /** |
1414 | * block_split - split a single bio struct into two bio structs | |
1415 | * @q: queue containing the bio | |
1416 | * @bio: block operation being split | |
1417 | * @new_sector: The starting sector for the new bio | |
1418 | * | |
1419 | * The bio request @bio in request queue @q needs to be split into two | |
1420 | * bio requests. The newly created @bio request starts at | |
1421 | * @new_sector. This split may be required due to hardware limitation | |
1422 | * such as operation crossing device boundaries in a RAID system. | |
1423 | */ | |
3bc29f0a | 1424 | LTTNG_TRACEPOINT_EVENT(block_split, |
f62b389e MD |
1425 | |
1426 | TP_PROTO(struct request_queue *q, struct bio *bio, | |
1427 | unsigned int new_sector), | |
1428 | ||
1429 | TP_ARGS(q, bio, new_sector), | |
1430 | ||
f127e61e | 1431 | TP_FIELDS( |
7feabe53 | 1432 | ctf_integer(dev_t, dev, bio_dev(bio)) |
ffcab3ce MJ |
1433 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
1434 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
1435 | lttng_bio_op(bio), lttng_bio_rw(bio), | |
1436 | bio->bi_iter.bi_size) | |
1437 | ctf_integer(sector_t, new_sector, new_sector) | |
1438 | ctf_integer(pid_t, tid, current->pid) | |
1439 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
1440 | ) | |
1441 | ) | |
5f4c791e | 1442 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) |
ffcab3ce MJ |
1443 | LTTNG_TRACEPOINT_EVENT(block_split, |
1444 | ||
1445 | TP_PROTO(struct request_queue *q, struct bio *bio, | |
1446 | unsigned int new_sector), | |
1447 | ||
1448 | TP_ARGS(q, bio, new_sector), | |
1449 | ||
1450 | TP_FIELDS( | |
959fe42a | 1451 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
f127e61e MD |
1452 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
1453 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 MD |
1454 | lttng_bio_op(bio), lttng_bio_rw(bio), |
1455 | bio->bi_iter.bi_size) | |
ffcab3ce MJ |
1456 | ctf_integer(sector_t, new_sector, new_sector) |
1457 | ctf_integer(pid_t, tid, current->pid) | |
1458 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
1459 | ) | |
1460 | ) | |
1461 | #else | |
1462 | LTTNG_TRACEPOINT_EVENT(block_split, | |
1463 | ||
1464 | TP_PROTO(struct request_queue *q, struct bio *bio, | |
1465 | unsigned int new_sector), | |
1466 | ||
1467 | TP_ARGS(q, bio, new_sector), | |
1468 | ||
1469 | TP_FIELDS( | |
1470 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) | |
f127e61e MD |
1471 | ctf_integer(sector_t, sector, bio->bi_sector) |
1472 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 | 1473 | lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size) |
f127e61e MD |
1474 | ctf_integer(sector_t, new_sector, new_sector) |
1475 | ctf_integer(pid_t, tid, current->pid) | |
1476 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
1477 | ) | |
f62b389e | 1478 | ) |
ffcab3ce | 1479 | #endif |
f62b389e | 1480 | |
5f4c791e | 1481 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
5ef5f891 MJ |
1482 | /** |
1483 | * block_bio_remap - map request for a logical device to the raw device | |
1484 | * @bio: revised operation | |
1485 | * @dev: original device for the operation | |
1486 | * @from: original sector for the operation | |
1487 | * | |
1488 | * An operation for a logical device has been mapped to the | |
1489 | * raw block device. | |
1490 | */ | |
1491 | LTTNG_TRACEPOINT_EVENT(block_bio_remap, | |
1492 | ||
1493 | TP_PROTO(struct bio *bio, dev_t dev, sector_t from), | |
1494 | ||
1495 | TP_ARGS(bio, dev, from), | |
1496 | ||
1497 | TP_FIELDS( | |
1498 | ctf_integer(dev_t, dev, bio_dev(bio)) | |
1499 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) | |
1500 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
1501 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
1502 | lttng_bio_op(bio), lttng_bio_rw(bio), | |
1503 | bio->bi_iter.bi_size) | |
1504 | ctf_integer(dev_t, old_dev, dev) | |
1505 | ctf_integer(sector_t, old_sector, from) | |
1506 | ) | |
1507 | ) | |
5f4c791e | 1508 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) |
f62b389e MD |
1509 | /** |
1510 | * block_bio_remap - map request for a logical device to the raw device | |
1511 | * @q: queue holding the operation | |
1512 | * @bio: revised operation | |
1513 | * @dev: device for the operation | |
1514 | * @from: original sector for the operation | |
1515 | * | |
1516 | * An operation for a logical device has been mapped to the | |
1517 | * raw block device. | |
1518 | */ | |
3bc29f0a | 1519 | LTTNG_TRACEPOINT_EVENT(block_bio_remap, |
f62b389e MD |
1520 | |
1521 | TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev, | |
1522 | sector_t from), | |
1523 | ||
1524 | TP_ARGS(q, bio, dev, from), | |
1525 | ||
f127e61e | 1526 | TP_FIELDS( |
7feabe53 | 1527 | ctf_integer(dev_t, dev, bio_dev(bio)) |
5ef5f891 MJ |
1528 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
1529 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
1530 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
1531 | lttng_bio_op(bio), lttng_bio_rw(bio), | |
1532 | bio->bi_iter.bi_size) | |
1533 | ctf_integer(dev_t, old_dev, dev) | |
1534 | ctf_integer(sector_t, old_sector, from) | |
1535 | ) | |
1536 | ) | |
5f4c791e | 1537 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) |
5ef5f891 MJ |
1538 | LTTNG_TRACEPOINT_EVENT(block_bio_remap, |
1539 | ||
1540 | TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev, | |
1541 | sector_t from), | |
1542 | ||
1543 | TP_ARGS(q, bio, dev, from), | |
1544 | ||
1545 | TP_FIELDS( | |
959fe42a | 1546 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
f127e61e MD |
1547 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
1548 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
1549 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 MD |
1550 | lttng_bio_op(bio), lttng_bio_rw(bio), |
1551 | bio->bi_iter.bi_size) | |
5ef5f891 MJ |
1552 | ctf_integer(dev_t, old_dev, dev) |
1553 | ctf_integer(sector_t, old_sector, from) | |
1554 | ) | |
1555 | ) | |
1556 | #else | |
1557 | LTTNG_TRACEPOINT_EVENT(block_bio_remap, | |
1558 | ||
1559 | TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev, | |
1560 | sector_t from), | |
1561 | ||
1562 | TP_ARGS(q, bio, dev, from), | |
1563 | ||
1564 | TP_FIELDS( | |
1565 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) | |
f127e61e MD |
1566 | ctf_integer(sector_t, sector, bio->bi_sector) |
1567 | ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) | |
1568 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 | 1569 | lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size) |
f127e61e MD |
1570 | ctf_integer(dev_t, old_dev, dev) |
1571 | ctf_integer(sector_t, old_sector, from) | |
1572 | ) | |
f62b389e | 1573 | ) |
5ef5f891 | 1574 | #endif |
f62b389e | 1575 | |
4b1945d3 MJ |
1576 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0)) |
1577 | /** | |
1578 | * block_rq_remap - map request for a block operation request | |
1579 | * @rq: block IO operation request | |
1580 | * @dev: device for the operation | |
1581 | * @from: original sector for the operation | |
1582 | * | |
1583 | * The block operation request @rq in @q has been remapped. The block | |
1584 | * operation request @rq holds the current information and @from hold | |
1585 | * the original sector. | |
1586 | */ | |
1587 | LTTNG_TRACEPOINT_EVENT(block_rq_remap, | |
1588 | ||
1589 | TP_PROTO(struct request *rq, dev_t dev, sector_t from), | |
1590 | ||
1591 | TP_ARGS(rq, dev, from), | |
1592 | ||
1593 | TP_FIELDS( | |
1594 | ctf_integer(dev_t, dev, disk_devt(rq->q->disk)) | |
1595 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) | |
1596 | ctf_integer(unsigned int, nr_sector, blk_rq_sectors(rq)) | |
1597 | ctf_integer(dev_t, old_dev, dev) | |
1598 | ctf_integer(sector_t, old_sector, from) | |
1599 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
1600 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) | |
1601 | ) | |
1602 | ) | |
1603 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) | |
2d67b98e MJ |
1604 | /** |
1605 | * block_rq_remap - map request for a block operation request | |
1606 | * @rq: block IO operation request | |
1607 | * @dev: device for the operation | |
1608 | * @from: original sector for the operation | |
1609 | * | |
1610 | * The block operation request @rq in @q has been remapped. The block | |
1611 | * operation request @rq holds the current information and @from hold | |
1612 | * the original sector. | |
1613 | */ | |
1614 | LTTNG_TRACEPOINT_EVENT(block_rq_remap, | |
1615 | ||
1616 | TP_PROTO(struct request *rq, dev_t dev, sector_t from), | |
1617 | ||
1618 | TP_ARGS(rq, dev, from), | |
1619 | ||
1620 | TP_FIELDS( | |
1621 | ctf_integer(dev_t, dev, disk_devt(rq->rq_disk)) | |
1622 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) | |
1623 | ctf_integer(unsigned int, nr_sector, blk_rq_sectors(rq)) | |
1624 | ctf_integer(dev_t, old_dev, dev) | |
1625 | ctf_integer(sector_t, old_sector, from) | |
1626 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
1627 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) | |
1628 | ) | |
1629 | ) | |
1630 | #else | |
f62b389e MD |
1631 | /** |
1632 | * block_rq_remap - map request for a block operation request | |
1633 | * @q: queue holding the operation | |
1634 | * @rq: block IO operation request | |
1635 | * @dev: device for the operation | |
1636 | * @from: original sector for the operation | |
1637 | * | |
1638 | * The block operation request @rq in @q has been remapped. The block | |
1639 | * operation request @rq holds the current information and @from hold | |
1640 | * the original sector. | |
1641 | */ | |
3bc29f0a | 1642 | LTTNG_TRACEPOINT_EVENT(block_rq_remap, |
f62b389e MD |
1643 | |
1644 | TP_PROTO(struct request_queue *q, struct request *rq, dev_t dev, | |
1645 | sector_t from), | |
1646 | ||
1647 | TP_ARGS(q, rq, dev, from), | |
1648 | ||
f127e61e MD |
1649 | TP_FIELDS( |
1650 | ctf_integer(dev_t, dev, disk_devt(rq->rq_disk)) | |
1651 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) | |
1652 | ctf_integer(unsigned int, nr_sector, blk_rq_sectors(rq)) | |
1653 | ctf_integer(dev_t, old_dev, dev) | |
1654 | ctf_integer(sector_t, old_sector, from) | |
1655 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 | 1656 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) |
f127e61e | 1657 | ) |
f62b389e | 1658 | ) |
2d67b98e | 1659 | #endif |
f62b389e MD |
1660 | |
1661 | #undef __print_rwbs_flags | |
1662 | #undef blk_fill_rwbs | |
1663 | ||
3bc29f0a | 1664 | #endif /* LTTNG_TRACE_BLOCK_H */ |
f62b389e MD |
1665 | |
1666 | /* This part must be outside protection */ | |
3b4aafcb | 1667 | #include <lttng/define_trace.h> |