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