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 | ) | |
63e36d2e MJ |
428 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,16,0) \ |
429 | || LTTNG_RHEL_KERNEL_RANGE(5,14,0,70,0,0, 5,15,0,0,0,0)) | |
ea49f07b MJ |
430 | LTTNG_TRACEPOINT_EVENT(block_rq_complete, |
431 | ||
432 | TP_PROTO(struct request *rq, blk_status_t error, unsigned int nr_bytes), | |
433 | ||
434 | TP_ARGS(rq, error, nr_bytes), | |
435 | ||
436 | TP_FIELDS( | |
437 | ctf_integer(dev_t, dev, | |
438 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
439 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) | |
440 | ctf_integer(unsigned int, nr_sector, nr_bytes >> 9) | |
441 | ctf_integer(int, error, blk_status_to_errno(error)) | |
442 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
443 | lttng_req_op(rq), lttng_req_rw(rq), nr_bytes) | |
444 | ) | |
445 | ) | |
446 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0)) | |
d2457078 MJ |
447 | LTTNG_TRACEPOINT_EVENT(block_rq_complete, |
448 | ||
449 | TP_PROTO(struct request *rq, int error, unsigned int nr_bytes), | |
450 | ||
451 | TP_ARGS(rq, error, nr_bytes), | |
452 | ||
453 | TP_FIELDS( | |
454 | ctf_integer(dev_t, dev, | |
455 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
456 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) | |
457 | ctf_integer(unsigned int, nr_sector, nr_bytes >> 9) | |
458 | ctf_integer(int, error, error) | |
459 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
460 | lttng_req_op(rq), lttng_req_rw(rq), nr_bytes) | |
461 | ) | |
462 | ) | |
5f4c791e | 463 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) |
8a9f549f FD |
464 | LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete, |
465 | ||
466 | TP_PROTO(struct request_queue *q, struct request *rq, | |
467 | unsigned int nr_bytes), | |
468 | ||
469 | TP_ARGS(q, rq, nr_bytes), | |
470 | ||
471 | TP_locvar( | |
472 | unsigned char *cmd; | |
473 | size_t cmd_len; | |
474 | ), | |
475 | ||
476 | TP_code_pre( | |
477 | if (blk_rq_is_scsi(rq)) { | |
478 | struct scsi_request *scsi_rq = scsi_req(rq); | |
479 | tp_locvar->cmd = scsi_rq->cmd; | |
480 | tp_locvar->cmd_len = scsi_rq->cmd_len; | |
481 | } else { | |
482 | tp_locvar->cmd = NULL; | |
483 | tp_locvar->cmd_len = 0; | |
484 | } | |
485 | ), | |
486 | ||
487 | TP_FIELDS( | |
488 | ctf_integer(dev_t, dev, | |
489 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
490 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) | |
491 | ctf_integer(unsigned int, nr_sector, nr_bytes >> 9) | |
492 | ctf_integer(int, errors, rq->errors) | |
493 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
494 | lttng_req_op(rq), lttng_req_rw(rq), nr_bytes) | |
495 | ctf_sequence_hex(unsigned char, cmd, | |
496 | tp_locvar->cmd, size_t, tp_locvar->cmd_len) | |
497 | ), | |
498 | ||
499 | TP_code_post() | |
500 | ) | |
b5211887 | 501 | #else |
f127e61e | 502 | LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete, |
1c53e689 MD |
503 | |
504 | TP_PROTO(struct request_queue *q, struct request *rq, | |
505 | unsigned int nr_bytes), | |
506 | ||
507 | TP_ARGS(q, rq, nr_bytes), | |
508 | ||
f127e61e MD |
509 | TP_locvar( |
510 | unsigned char *cmd; | |
511 | size_t cmd_len; | |
1c53e689 MD |
512 | ), |
513 | ||
265822ae | 514 | TP_code_pre( |
f127e61e MD |
515 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { |
516 | tp_locvar->cmd = rq->cmd; | |
517 | tp_locvar->cmd_len = rq->cmd_len; | |
518 | } else { | |
519 | tp_locvar->cmd = NULL; | |
520 | tp_locvar->cmd_len = 0; | |
521 | } | |
1c53e689 MD |
522 | ), |
523 | ||
f127e61e MD |
524 | TP_FIELDS( |
525 | ctf_integer(dev_t, dev, | |
526 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
527 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) | |
528 | ctf_integer(unsigned int, nr_sector, nr_bytes >> 9) | |
529 | ctf_integer(int, errors, rq->errors) | |
530 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 | 531 | lttng_req_op(rq), lttng_req_rw(rq), nr_bytes) |
f127e61e MD |
532 | ctf_sequence_hex(unsigned char, cmd, |
533 | tp_locvar->cmd, size_t, tp_locvar->cmd_len) | |
265822ae MD |
534 | ), |
535 | ||
536 | TP_code_post() | |
1c53e689 | 537 | ) |
b5211887 | 538 | #endif |
1c53e689 | 539 | |
5d595580 MJ |
540 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0)) |
541 | LTTNG_TRACEPOINT_EVENT_CLASS(block_rq, | |
542 | ||
543 | TP_PROTO(struct request *rq), | |
544 | ||
545 | TP_ARGS(rq), | |
546 | ||
547 | TP_FIELDS( | |
548 | ctf_integer(dev_t, dev, | |
549 | rq->q->disk ? disk_devt(rq->q->disk) : 0) | |
550 | ctf_integer(sector_t, sector, blk_rq_trace_sector(rq)) | |
551 | ctf_integer(unsigned int, nr_sector, blk_rq_trace_nr_sectors(rq)) | |
552 | ctf_integer(unsigned int, bytes, blk_rq_bytes(rq)) | |
553 | ctf_integer(pid_t, tid, current->pid) | |
554 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
555 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) | |
556 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
557 | ) | |
558 | ) | |
5dab3d51 | 559 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \ |
89d91715 MJ |
560 | || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \ |
561 | || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0)) | |
2d67b98e MJ |
562 | LTTNG_TRACEPOINT_EVENT_CLASS(block_rq, |
563 | ||
564 | TP_PROTO(struct request *rq), | |
565 | ||
566 | TP_ARGS(rq), | |
567 | ||
568 | TP_FIELDS( | |
569 | ctf_integer(dev_t, dev, | |
570 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
571 | ctf_integer(sector_t, sector, blk_rq_trace_sector(rq)) | |
572 | ctf_integer(unsigned int, nr_sector, blk_rq_trace_nr_sectors(rq)) | |
573 | ctf_integer(unsigned int, bytes, blk_rq_bytes(rq)) | |
574 | ctf_integer(pid_t, tid, current->pid) | |
575 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
576 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) | |
577 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
578 | ) | |
579 | ) | |
5f4c791e | 580 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0)) |
d2457078 MJ |
581 | LTTNG_TRACEPOINT_EVENT_CLASS(block_rq, |
582 | ||
583 | TP_PROTO(struct request_queue *q, struct request *rq), | |
584 | ||
585 | TP_ARGS(q, rq), | |
586 | ||
587 | TP_FIELDS( | |
588 | ctf_integer(dev_t, dev, | |
589 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
590 | ctf_integer(sector_t, sector, blk_rq_trace_sector(rq)) | |
591 | ctf_integer(unsigned int, nr_sector, blk_rq_trace_nr_sectors(rq)) | |
592 | ctf_integer(unsigned int, bytes, blk_rq_bytes(rq)) | |
593 | ctf_integer(pid_t, tid, current->pid) | |
594 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
595 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) | |
596 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
597 | ) | |
598 | ) | |
5f4c791e | 599 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) |
8a9f549f FD |
600 | LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq, |
601 | ||
602 | TP_PROTO(struct request_queue *q, struct request *rq), | |
603 | ||
604 | TP_ARGS(q, rq), | |
605 | ||
606 | TP_locvar( | |
607 | sector_t sector; | |
608 | unsigned int nr_sector; | |
609 | unsigned int bytes; | |
610 | unsigned char *cmd; | |
611 | size_t cmd_len; | |
612 | ), | |
613 | ||
614 | TP_code_pre( | |
615 | if (blk_rq_is_scsi(rq)) { | |
616 | struct scsi_request *scsi_rq = scsi_req(rq); | |
617 | tp_locvar->sector = 0; | |
618 | tp_locvar->nr_sector = 0; | |
619 | tp_locvar->bytes = scsi_rq->resid_len; | |
620 | tp_locvar->cmd = scsi_rq->cmd; | |
621 | tp_locvar->cmd_len = scsi_rq->cmd_len; | |
622 | } else { | |
623 | tp_locvar->sector = blk_rq_pos(rq); | |
624 | tp_locvar->nr_sector = blk_rq_sectors(rq); | |
625 | tp_locvar->bytes = 0; | |
626 | tp_locvar->cmd = NULL; | |
627 | tp_locvar->cmd_len = 0; | |
628 | } | |
629 | ), | |
630 | ||
631 | TP_FIELDS( | |
632 | ctf_integer(dev_t, dev, | |
633 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
634 | ctf_integer(sector_t, sector, tp_locvar->sector) | |
635 | ctf_integer(unsigned int, nr_sector, tp_locvar->nr_sector) | |
636 | ctf_integer(unsigned int, bytes, tp_locvar->bytes) | |
637 | ctf_integer(pid_t, tid, current->pid) | |
638 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
639 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) | |
640 | ctf_sequence_hex(unsigned char, cmd, | |
641 | tp_locvar->cmd, size_t, tp_locvar->cmd_len) | |
642 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
643 | ), | |
644 | ||
645 | TP_code_post() | |
646 | ) | |
5f4c791e | 647 | #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */ |
f127e61e | 648 | LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq, |
f62b389e MD |
649 | |
650 | TP_PROTO(struct request_queue *q, struct request *rq), | |
651 | ||
652 | TP_ARGS(q, rq), | |
653 | ||
f127e61e MD |
654 | TP_locvar( |
655 | sector_t sector; | |
656 | unsigned int nr_sector; | |
657 | unsigned int bytes; | |
658 | unsigned char *cmd; | |
659 | size_t cmd_len; | |
f62b389e MD |
660 | ), |
661 | ||
265822ae | 662 | TP_code_pre( |
f127e61e MD |
663 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { |
664 | tp_locvar->sector = 0; | |
665 | tp_locvar->nr_sector = 0; | |
666 | tp_locvar->bytes = blk_rq_bytes(rq); | |
667 | tp_locvar->cmd = rq->cmd; | |
668 | tp_locvar->cmd_len = rq->cmd_len; | |
669 | } else { | |
670 | tp_locvar->sector = blk_rq_pos(rq); | |
671 | tp_locvar->nr_sector = blk_rq_sectors(rq); | |
672 | tp_locvar->bytes = 0; | |
673 | tp_locvar->cmd = NULL; | |
674 | tp_locvar->cmd_len = 0; | |
675 | } | |
f62b389e MD |
676 | ), |
677 | ||
f127e61e MD |
678 | TP_FIELDS( |
679 | ctf_integer(dev_t, dev, | |
680 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) | |
681 | ctf_integer(sector_t, sector, tp_locvar->sector) | |
682 | ctf_integer(unsigned int, nr_sector, tp_locvar->nr_sector) | |
683 | ctf_integer(unsigned int, bytes, tp_locvar->bytes) | |
684 | ctf_integer(pid_t, tid, current->pid) | |
685 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 | 686 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) |
f127e61e MD |
687 | ctf_sequence_hex(unsigned char, cmd, |
688 | tp_locvar->cmd, size_t, tp_locvar->cmd_len) | |
689 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
265822ae MD |
690 | ), |
691 | ||
692 | TP_code_post() | |
f62b389e | 693 | ) |
5f4c791e | 694 | #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */ |
f62b389e | 695 | |
5dab3d51 | 696 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \ |
89d91715 MJ |
697 | || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \ |
698 | || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0)) | |
2d67b98e MJ |
699 | /** |
700 | * block_rq_insert - insert block operation request into queue | |
701 | * @rq: block IO operation request | |
702 | * | |
703 | * Called immediately before block operation request @rq is inserted | |
704 | * into queue @q. The fields in the operation request @rq struct can | |
705 | * be examined to determine which device and sectors the pending | |
706 | * operation would access. | |
707 | */ | |
708 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_insert, | |
709 | ||
710 | TP_PROTO(struct request *rq), | |
711 | ||
712 | TP_ARGS(rq) | |
713 | ) | |
714 | #else | |
f62b389e MD |
715 | /** |
716 | * block_rq_insert - insert block operation request into queue | |
717 | * @q: target queue | |
718 | * @rq: block IO operation request | |
719 | * | |
720 | * Called immediately before block operation request @rq is inserted | |
721 | * into queue @q. The fields in the operation request @rq struct can | |
722 | * be examined to determine which device and sectors the pending | |
723 | * operation would access. | |
724 | */ | |
3bc29f0a | 725 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_insert, |
f62b389e MD |
726 | |
727 | TP_PROTO(struct request_queue *q, struct request *rq), | |
728 | ||
729 | TP_ARGS(q, rq) | |
730 | ) | |
2d67b98e MJ |
731 | #endif |
732 | ||
5dab3d51 | 733 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \ |
89d91715 MJ |
734 | || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \ |
735 | || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0)) | |
2d67b98e MJ |
736 | /** |
737 | * block_rq_issue - issue pending block IO request operation to device driver | |
738 | * @rq: block IO operation operation request | |
739 | * | |
740 | * Called when block operation request @rq from queue @q is sent to a | |
741 | * device driver for processing. | |
742 | */ | |
743 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_issue, | |
f62b389e | 744 | |
2d67b98e MJ |
745 | TP_PROTO(struct request *rq), |
746 | ||
747 | TP_ARGS(rq) | |
748 | ) | |
749 | #else | |
f62b389e MD |
750 | /** |
751 | * block_rq_issue - issue pending block IO request operation to device driver | |
752 | * @q: queue holding operation | |
753 | * @rq: block IO operation operation request | |
754 | * | |
755 | * Called when block operation request @rq from queue @q is sent to a | |
756 | * device driver for processing. | |
757 | */ | |
3bc29f0a | 758 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_issue, |
f62b389e MD |
759 | |
760 | TP_PROTO(struct request_queue *q, struct request *rq), | |
761 | ||
762 | TP_ARGS(q, rq) | |
763 | ) | |
2d67b98e MJ |
764 | #endif |
765 | ||
5dab3d51 MJ |
766 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \ |
767 | || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0)) | |
2d67b98e MJ |
768 | /** |
769 | * block_rq_merge - merge request with another one in the elevator | |
770 | * @rq: block IO operation operation request | |
771 | * | |
772 | * Called when block operation request @rq from queue @q is merged to another | |
773 | * request queued in the elevator. | |
774 | */ | |
775 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_merge, | |
776 | ||
777 | TP_PROTO(struct request *rq), | |
778 | ||
779 | TP_ARGS(rq) | |
780 | ) | |
5f4c791e | 781 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,9,0)) |
2d67b98e MJ |
782 | /** |
783 | * block_rq_merge - merge request with another one in the elevator | |
784 | * @q: queue holding operation | |
785 | * @rq: block IO operation operation request | |
786 | * | |
787 | * Called when block operation request @rq from queue @q is merged to another | |
788 | * request queued in the elevator. | |
789 | */ | |
790 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_merge, | |
791 | ||
792 | TP_PROTO(struct request_queue *q, struct request *rq), | |
793 | ||
794 | TP_ARGS(q, rq) | |
795 | ) | |
796 | #endif | |
f62b389e | 797 | |
fce87a6e MJ |
798 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,8,0) || \ |
799 | LTTNG_RHEL_KERNEL_RANGE(4,18,0,305,0,0, 4,19,0,0,0,0)) | |
800 | ||
3441e48e MJ |
801 | /** |
802 | * block_bio_complete - completed all work on the block operation | |
803 | * @q: queue holding the block operation | |
804 | * @bio: block operation completed | |
805 | * @error: io error value | |
806 | * | |
807 | * This tracepoint indicates there is no further work to do on this | |
808 | * block IO operation @bio. | |
809 | */ | |
810 | LTTNG_TRACEPOINT_EVENT(block_bio_complete, | |
811 | ||
812 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
813 | ||
814 | TP_ARGS(q, bio), | |
815 | ||
816 | TP_FIELDS( | |
817 | ctf_integer(dev_t, dev, bio_dev(bio)) | |
818 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) | |
819 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
820 | ctf_integer(int, error, blk_status_to_errno(bio->bi_status)) | |
821 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
822 | lttng_bio_op(bio), lttng_bio_rw(bio), | |
823 | bio->bi_iter.bi_size) | |
824 | ) | |
825 | ) | |
5f4c791e | 826 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) |
f62b389e MD |
827 | /** |
828 | * block_bio_complete - completed all work on the block operation | |
829 | * @q: queue holding the block operation | |
830 | * @bio: block operation completed | |
831 | * @error: io error value | |
832 | * | |
833 | * This tracepoint indicates there is no further work to do on this | |
834 | * block IO operation @bio. | |
835 | */ | |
3bc29f0a | 836 | LTTNG_TRACEPOINT_EVENT(block_bio_complete, |
f62b389e MD |
837 | |
838 | TP_PROTO(struct request_queue *q, struct bio *bio, int error), | |
839 | ||
840 | TP_ARGS(q, bio, error), | |
841 | ||
f127e61e | 842 | TP_FIELDS( |
7feabe53 | 843 | ctf_integer(dev_t, dev, bio_dev(bio)) |
3441e48e MJ |
844 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
845 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
846 | ctf_integer(int, error, error) | |
847 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
848 | lttng_bio_op(bio), lttng_bio_rw(bio), | |
849 | bio->bi_iter.bi_size) | |
850 | ) | |
851 | ) | |
b5211887 | 852 | #else |
3441e48e MJ |
853 | /** |
854 | * block_bio_complete - completed all work on the block operation | |
855 | * @q: queue holding the block operation | |
856 | * @bio: block operation completed | |
857 | * @error: io error value | |
858 | * | |
859 | * This tracepoint indicates there is no further work to do on this | |
860 | * block IO operation @bio. | |
861 | */ | |
862 | LTTNG_TRACEPOINT_EVENT(block_bio_complete, | |
863 | ||
864 | TP_PROTO(struct request_queue *q, struct bio *bio, int error), | |
865 | ||
866 | TP_ARGS(q, bio, error), | |
867 | ||
868 | TP_FIELDS( | |
959fe42a | 869 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
f127e61e MD |
870 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
871 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
872 | ctf_integer(int, error, error) | |
873 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 MD |
874 | lttng_bio_op(bio), lttng_bio_rw(bio), |
875 | bio->bi_iter.bi_size) | |
3441e48e MJ |
876 | ) |
877 | ) | |
3441e48e | 878 | #endif |
f62b389e | 879 | |
5f4c791e | 880 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
fa79b21c MJ |
881 | LTTNG_TRACEPOINT_EVENT_CLASS(block_bio, |
882 | ||
883 | TP_PROTO(struct bio *bio), | |
884 | ||
885 | TP_ARGS(bio), | |
886 | ||
887 | TP_FIELDS( | |
888 | ctf_integer(dev_t, dev, bio_dev(bio)) | |
889 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) | |
890 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
891 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
892 | lttng_bio_op(bio), lttng_bio_rw(bio), | |
893 | bio->bi_iter.bi_size) | |
894 | ctf_integer(pid_t, tid, current->pid) | |
895 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
896 | ) | |
897 | ) | |
5f4c791e | 898 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) |
3bc29f0a | 899 | LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge, |
217f66c6 MD |
900 | |
901 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), | |
902 | ||
903 | TP_ARGS(q, rq, bio), | |
904 | ||
f127e61e | 905 | TP_FIELDS( |
7feabe53 | 906 | ctf_integer(dev_t, dev, bio_dev(bio)) |
fa79b21c MJ |
907 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
908 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
909 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
910 | lttng_bio_op(bio), lttng_bio_rw(bio), | |
911 | bio->bi_iter.bi_size) | |
912 | ctf_integer(pid_t, tid, current->pid) | |
913 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
914 | ) | |
915 | ) | |
b5211887 | 916 | #else |
fa79b21c MJ |
917 | LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge, |
918 | ||
919 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), | |
920 | ||
921 | TP_ARGS(q, rq, bio), | |
922 | ||
923 | TP_FIELDS( | |
959fe42a | 924 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
f127e61e MD |
925 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
926 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
927 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 MD |
928 | lttng_bio_op(bio), lttng_bio_rw(bio), |
929 | bio->bi_iter.bi_size) | |
fa79b21c MJ |
930 | ctf_integer(pid_t, tid, current->pid) |
931 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
932 | ) | |
933 | ) | |
fa79b21c MJ |
934 | #endif |
935 | ||
936 | ||
937 | ||
5f4c791e | 938 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
fa79b21c MJ |
939 | /** |
940 | * block_bio_bounce - used bounce buffer when processing block operation | |
941 | * @bio: block operation | |
942 | * | |
943 | * A bounce buffer was used to handle the block operation @bio in @q. | |
944 | * This occurs when hardware limitations prevent a direct transfer of | |
945 | * data between the @bio data memory area and the IO device. Use of a | |
946 | * bounce buffer requires extra copying of data and decreases | |
947 | * performance. | |
948 | */ | |
949 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_bounce, | |
950 | ||
951 | TP_PROTO(struct bio *bio), | |
952 | ||
953 | TP_ARGS(bio) | |
954 | ) | |
5f4c791e | 955 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) |
fa79b21c MJ |
956 | /** |
957 | * block_bio_bounce - used bounce buffer when processing block operation | |
958 | * @q: queue holding the block operation | |
959 | * @bio: block operation | |
960 | * | |
961 | * A bounce buffer was used to handle the block operation @bio in @q. | |
962 | * This occurs when hardware limitations prevent a direct transfer of | |
963 | * data between the @bio data memory area and the IO device. Use of a | |
964 | * bounce buffer requires extra copying of data and decreases | |
965 | * performance. | |
966 | */ | |
967 | LTTNG_TRACEPOINT_EVENT(block_bio_bounce, | |
968 | ||
969 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
970 | ||
971 | TP_ARGS(q, bio), | |
972 | ||
973 | TP_FIELDS( | |
974 | ctf_integer(dev_t, dev, bio_dev(bio)) | |
975 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) | |
976 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
977 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
978 | lttng_bio_op(bio), lttng_bio_rw(bio), | |
979 | bio->bi_iter.bi_size) | |
980 | ctf_integer(pid_t, tid, current->pid) | |
981 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
982 | ) | |
983 | ) | |
b5211887 | 984 | #else |
fa79b21c MJ |
985 | LTTNG_TRACEPOINT_EVENT(block_bio_bounce, |
986 | ||
987 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
988 | ||
989 | TP_ARGS(q, bio), | |
990 | ||
991 | TP_FIELDS( | |
992 | ctf_integer(dev_t, dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0) | |
993 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) | |
994 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
995 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
996 | lttng_bio_op(bio), lttng_bio_rw(bio), | |
997 | bio->bi_iter.bi_size) | |
998 | ctf_integer(pid_t, tid, current->pid) | |
999 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
1000 | ) | |
1001 | ) | |
fa79b21c MJ |
1002 | #endif |
1003 | ||
1004 | ||
5f4c791e | 1005 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
fa79b21c MJ |
1006 | /** |
1007 | * block_bio_backmerge - merging block operation to the end of an existing operation | |
1008 | * @bio: new block operation to merge | |
1009 | * | |
1010 | * Merging block request @bio to the end of an existing block request. | |
1011 | */ | |
1012 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_backmerge, | |
1013 | ||
1014 | TP_PROTO(struct bio *bio), | |
1015 | ||
1016 | TP_ARGS(bio) | |
1017 | ) | |
1018 | ||
1019 | /** | |
1020 | * block_bio_frontmerge - merging block operation to the beginning of an existing operation | |
1021 | * @bio: new block operation to merge | |
1022 | * | |
1023 | * Merging block IO operation @bio to the beginning of an existing block request. | |
1024 | */ | |
1025 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_frontmerge, | |
1026 | ||
1027 | TP_PROTO(struct bio *bio), | |
1028 | ||
1029 | TP_ARGS(bio) | |
1030 | ) | |
1031 | ||
1032 | /** | |
1033 | * block_bio_queue - putting new block IO operation in queue | |
1034 | * @bio: new block operation | |
1035 | * | |
1036 | * About to place the block IO operation @bio into queue @q. | |
1037 | */ | |
1038 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_queue, | |
1039 | ||
1040 | TP_PROTO(struct bio *bio), | |
1041 | ||
1042 | TP_ARGS(bio) | |
1043 | ) | |
b5211887 | 1044 | #else |
217f66c6 MD |
1045 | /** |
1046 | * block_bio_backmerge - merging block operation to the end of an existing operation | |
1047 | * @q: queue holding operation | |
fa79b21c | 1048 | * @rq: request bio is being merged into |
217f66c6 MD |
1049 | * @bio: new block operation to merge |
1050 | * | |
1051 | * Merging block request @bio to the end of an existing block request | |
1052 | * in queue @q. | |
1053 | */ | |
3bc29f0a | 1054 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge, block_bio_backmerge, |
217f66c6 MD |
1055 | |
1056 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), | |
1057 | ||
1058 | TP_ARGS(q, rq, bio) | |
1059 | ) | |
1060 | ||
1061 | /** | |
1062 | * block_bio_frontmerge - merging block operation to the beginning of an existing operation | |
1063 | * @q: queue holding operation | |
fa79b21c | 1064 | * @rq: request bio is being merged into |
217f66c6 MD |
1065 | * @bio: new block operation to merge |
1066 | * | |
1067 | * Merging block IO operation @bio to the beginning of an existing block | |
1068 | * operation in queue @q. | |
1069 | */ | |
3bc29f0a | 1070 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge, block_bio_frontmerge, |
217f66c6 MD |
1071 | |
1072 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), | |
1073 | ||
1074 | TP_ARGS(q, rq, bio) | |
1075 | ) | |
1076 | ||
1077 | /** | |
1078 | * block_bio_queue - putting new block IO operation in queue | |
1079 | * @q: queue holding operation | |
1080 | * @bio: new block operation | |
1081 | * | |
1082 | * About to place the block IO operation @bio into queue @q. | |
1083 | */ | |
3bc29f0a | 1084 | LTTNG_TRACEPOINT_EVENT(block_bio_queue, |
217f66c6 MD |
1085 | |
1086 | TP_PROTO(struct request_queue *q, struct bio *bio), | |
1087 | ||
1088 | TP_ARGS(q, bio), | |
1089 | ||
f127e61e | 1090 | TP_FIELDS( |
5f4c791e | 1091 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) |
7feabe53 MD |
1092 | ctf_integer(dev_t, dev, bio_dev(bio)) |
1093 | #else | |
959fe42a | 1094 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
7feabe53 | 1095 | #endif |
f127e61e MD |
1096 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
1097 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
1098 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 MD |
1099 | lttng_bio_op(bio), lttng_bio_rw(bio), |
1100 | bio->bi_iter.bi_size) | |
f127e61e MD |
1101 | ctf_integer(pid_t, tid, current->pid) |
1102 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
1103 | ) | |
217f66c6 | 1104 | ) |
5f4c791e | 1105 | #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) */ |
f62b389e | 1106 | |
5f4c791e | 1107 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
fa79b21c MJ |
1108 | /** |
1109 | * block_getrq - get a free request entry in queue for block IO operations | |
1110 | * @bio: pending block IO operation (can be %NULL) | |
1111 | * | |
1112 | * A request struct has been allocated to handle the block IO operation @bio. | |
1113 | */ | |
1114 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_getrq, | |
1115 | ||
1116 | TP_PROTO(struct bio *bio), | |
1117 | ||
1118 | TP_ARGS(bio) | |
1119 | ) | |
1120 | #else | |
3bc29f0a | 1121 | LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq, |
f62b389e MD |
1122 | |
1123 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), | |
1124 | ||
1125 | TP_ARGS(q, bio, rw), | |
1126 | ||
f127e61e | 1127 | TP_FIELDS( |
5f4c791e | 1128 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) |
6417cda6 | 1129 | ctf_integer(dev_t, dev, bio ? bio_dev(bio) : 0) |
7feabe53 | 1130 | #else |
959fe42a | 1131 | ctf_integer(dev_t, dev, bio ? bio->bi_bdev->bd_dev : 0) |
7feabe53 | 1132 | #endif |
f127e61e MD |
1133 | ctf_integer(sector_t, sector, bio ? bio->bi_iter.bi_sector : 0) |
1134 | ctf_integer(unsigned int, nr_sector, | |
1135 | bio ? bio_sectors(bio) : 0) | |
1136 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 MD |
1137 | bio ? lttng_bio_op(bio) : 0, |
1138 | bio ? lttng_bio_rw(bio) : 0, | |
f127e61e | 1139 | bio ? bio->bi_iter.bi_size : 0) |
f127e61e MD |
1140 | ctf_integer(pid_t, tid, current->pid) |
1141 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
1142 | ) | |
f62b389e MD |
1143 | ) |
1144 | ||
1145 | /** | |
1146 | * block_getrq - get a free request entry in queue for block IO operations | |
1147 | * @q: queue for operations | |
6417cda6 | 1148 | * @bio: pending block IO operation (can be %NULL) |
f62b389e MD |
1149 | * @rw: low bit indicates a read (%0) or a write (%1) |
1150 | * | |
1151 | * A request struct for queue @q has been allocated to handle the | |
1152 | * block IO operation @bio. | |
1153 | */ | |
3bc29f0a | 1154 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq, block_getrq, |
f62b389e MD |
1155 | |
1156 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), | |
1157 | ||
1158 | TP_ARGS(q, bio, rw) | |
1159 | ) | |
1160 | ||
1161 | /** | |
1162 | * block_sleeprq - waiting to get a free request entry in queue for block IO operation | |
1163 | * @q: queue for operation | |
6417cda6 | 1164 | * @bio: pending block IO operation (can be %NULL) |
f62b389e MD |
1165 | * @rw: low bit indicates a read (%0) or a write (%1) |
1166 | * | |
1167 | * In the case where a request struct cannot be provided for queue @q | |
1168 | * the process needs to wait for an request struct to become | |
1169 | * available. This tracepoint event is generated each time the | |
1170 | * process goes to sleep waiting for request struct become available. | |
1171 | */ | |
3bc29f0a | 1172 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq, block_sleeprq, |
f62b389e MD |
1173 | |
1174 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), | |
1175 | ||
1176 | TP_ARGS(q, bio, rw) | |
1177 | ) | |
fa79b21c | 1178 | #endif |
f62b389e MD |
1179 | |
1180 | /** | |
1181 | * block_plug - keep operations requests in request queue | |
1182 | * @q: request queue to plug | |
1183 | * | |
1184 | * Plug the request queue @q. Do not allow block operation requests | |
1185 | * to be sent to the device driver. Instead, accumulate requests in | |
1186 | * the queue to improve throughput performance of the block device. | |
1187 | */ | |
3bc29f0a | 1188 | LTTNG_TRACEPOINT_EVENT(block_plug, |
f62b389e MD |
1189 | |
1190 | TP_PROTO(struct request_queue *q), | |
1191 | ||
1192 | TP_ARGS(q), | |
1193 | ||
f127e61e MD |
1194 | TP_FIELDS( |
1195 | ctf_integer(pid_t, tid, current->pid) | |
1196 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
1197 | ) | |
f62b389e MD |
1198 | ) |
1199 | ||
3bc29f0a | 1200 | LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug, |
f62b389e MD |
1201 | |
1202 | TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit), | |
1203 | ||
1204 | TP_ARGS(q, depth, explicit), | |
1205 | ||
f127e61e | 1206 | TP_FIELDS( |
f127e61e | 1207 | ctf_integer(int, nr_rq, depth) |
f127e61e MD |
1208 | ctf_integer(pid_t, tid, current->pid) |
1209 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
1210 | ) | |
f62b389e MD |
1211 | ) |
1212 | ||
1213 | /** | |
1214 | * block_unplug - release of operations requests in request queue | |
1215 | * @q: request queue to unplug | |
1216 | * @depth: number of requests just added to the queue | |
1217 | * @explicit: whether this was an explicit unplug, or one from schedule() | |
1218 | * | |
1219 | * Unplug request queue @q because device driver is scheduled to work | |
1220 | * on elements in the request queue. | |
1221 | */ | |
3bc29f0a | 1222 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug, block_unplug, |
f62b389e MD |
1223 | |
1224 | TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit), | |
1225 | ||
1226 | TP_ARGS(q, depth, explicit) | |
1227 | ) | |
1228 | ||
5f4c791e | 1229 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
ffcab3ce MJ |
1230 | /** |
1231 | * block_split - split a single bio struct into two bio structs | |
1232 | * @bio: block operation being split | |
1233 | * @new_sector: The starting sector for the new bio | |
1234 | * | |
1235 | * The bio request @bio needs to be split into two bio requests. The newly | |
1236 | * created @bio request starts at @new_sector. This split may be required due to | |
1237 | * hardware limitations such as operation crossing device boundaries in a RAID | |
1238 | * system. | |
1239 | */ | |
1240 | LTTNG_TRACEPOINT_EVENT(block_split, | |
1241 | ||
1242 | TP_PROTO(struct bio *bio, unsigned int new_sector), | |
1243 | ||
1244 | TP_ARGS(bio, new_sector), | |
1245 | ||
1246 | TP_FIELDS( | |
1247 | ctf_integer(dev_t, dev, bio_dev(bio)) | |
1248 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) | |
1249 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
1250 | lttng_bio_op(bio), lttng_bio_rw(bio), | |
1251 | bio->bi_iter.bi_size) | |
1252 | ctf_integer(sector_t, new_sector, new_sector) | |
1253 | ctf_integer(pid_t, tid, current->pid) | |
1254 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
1255 | ) | |
1256 | ) | |
1257 | ||
5f4c791e | 1258 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) |
f62b389e MD |
1259 | /** |
1260 | * block_split - split a single bio struct into two bio structs | |
1261 | * @q: queue containing the bio | |
1262 | * @bio: block operation being split | |
1263 | * @new_sector: The starting sector for the new bio | |
1264 | * | |
1265 | * The bio request @bio in request queue @q needs to be split into two | |
1266 | * bio requests. The newly created @bio request starts at | |
1267 | * @new_sector. This split may be required due to hardware limitation | |
1268 | * such as operation crossing device boundaries in a RAID system. | |
1269 | */ | |
3bc29f0a | 1270 | LTTNG_TRACEPOINT_EVENT(block_split, |
f62b389e MD |
1271 | |
1272 | TP_PROTO(struct request_queue *q, struct bio *bio, | |
1273 | unsigned int new_sector), | |
1274 | ||
1275 | TP_ARGS(q, bio, new_sector), | |
1276 | ||
f127e61e | 1277 | TP_FIELDS( |
7feabe53 | 1278 | ctf_integer(dev_t, dev, bio_dev(bio)) |
ffcab3ce MJ |
1279 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
1280 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
1281 | lttng_bio_op(bio), lttng_bio_rw(bio), | |
1282 | bio->bi_iter.bi_size) | |
1283 | ctf_integer(sector_t, new_sector, new_sector) | |
1284 | ctf_integer(pid_t, tid, current->pid) | |
1285 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
1286 | ) | |
1287 | ) | |
b5211887 | 1288 | #else |
ffcab3ce MJ |
1289 | LTTNG_TRACEPOINT_EVENT(block_split, |
1290 | ||
1291 | TP_PROTO(struct request_queue *q, struct bio *bio, | |
1292 | unsigned int new_sector), | |
1293 | ||
1294 | TP_ARGS(q, bio, new_sector), | |
1295 | ||
1296 | TP_FIELDS( | |
959fe42a | 1297 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
f127e61e MD |
1298 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
1299 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 MD |
1300 | lttng_bio_op(bio), lttng_bio_rw(bio), |
1301 | bio->bi_iter.bi_size) | |
ffcab3ce MJ |
1302 | ctf_integer(sector_t, new_sector, new_sector) |
1303 | ctf_integer(pid_t, tid, current->pid) | |
1304 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) | |
1305 | ) | |
1306 | ) | |
ffcab3ce | 1307 | #endif |
f62b389e | 1308 | |
5f4c791e | 1309 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
5ef5f891 MJ |
1310 | /** |
1311 | * block_bio_remap - map request for a logical device to the raw device | |
1312 | * @bio: revised operation | |
1313 | * @dev: original device for the operation | |
1314 | * @from: original sector for the operation | |
1315 | * | |
1316 | * An operation for a logical device has been mapped to the | |
1317 | * raw block device. | |
1318 | */ | |
1319 | LTTNG_TRACEPOINT_EVENT(block_bio_remap, | |
1320 | ||
1321 | TP_PROTO(struct bio *bio, dev_t dev, sector_t from), | |
1322 | ||
1323 | TP_ARGS(bio, dev, from), | |
1324 | ||
1325 | TP_FIELDS( | |
1326 | ctf_integer(dev_t, dev, bio_dev(bio)) | |
1327 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) | |
1328 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
1329 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
1330 | lttng_bio_op(bio), lttng_bio_rw(bio), | |
1331 | bio->bi_iter.bi_size) | |
1332 | ctf_integer(dev_t, old_dev, dev) | |
1333 | ctf_integer(sector_t, old_sector, from) | |
1334 | ) | |
1335 | ) | |
5f4c791e | 1336 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) |
f62b389e MD |
1337 | /** |
1338 | * block_bio_remap - map request for a logical device to the raw device | |
1339 | * @q: queue holding the operation | |
1340 | * @bio: revised operation | |
1341 | * @dev: device for the operation | |
1342 | * @from: original sector for the operation | |
1343 | * | |
1344 | * An operation for a logical device has been mapped to the | |
1345 | * raw block device. | |
1346 | */ | |
3bc29f0a | 1347 | LTTNG_TRACEPOINT_EVENT(block_bio_remap, |
f62b389e MD |
1348 | |
1349 | TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev, | |
1350 | sector_t from), | |
1351 | ||
1352 | TP_ARGS(q, bio, dev, from), | |
1353 | ||
f127e61e | 1354 | TP_FIELDS( |
7feabe53 | 1355 | ctf_integer(dev_t, dev, bio_dev(bio)) |
5ef5f891 MJ |
1356 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
1357 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
1358 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
1359 | lttng_bio_op(bio), lttng_bio_rw(bio), | |
1360 | bio->bi_iter.bi_size) | |
1361 | ctf_integer(dev_t, old_dev, dev) | |
1362 | ctf_integer(sector_t, old_sector, from) | |
1363 | ) | |
1364 | ) | |
b5211887 | 1365 | #else |
5ef5f891 MJ |
1366 | LTTNG_TRACEPOINT_EVENT(block_bio_remap, |
1367 | ||
1368 | TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev, | |
1369 | sector_t from), | |
1370 | ||
1371 | TP_ARGS(q, bio, dev, from), | |
1372 | ||
1373 | TP_FIELDS( | |
959fe42a | 1374 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
f127e61e MD |
1375 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
1376 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) | |
1377 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 MD |
1378 | lttng_bio_op(bio), lttng_bio_rw(bio), |
1379 | bio->bi_iter.bi_size) | |
5ef5f891 MJ |
1380 | ctf_integer(dev_t, old_dev, dev) |
1381 | ctf_integer(sector_t, old_sector, from) | |
1382 | ) | |
1383 | ) | |
5ef5f891 | 1384 | #endif |
f62b389e | 1385 | |
5d595580 MJ |
1386 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0)) |
1387 | /** | |
1388 | * block_rq_remap - map request for a block operation request | |
1389 | * @rq: block IO operation request | |
1390 | * @dev: device for the operation | |
1391 | * @from: original sector for the operation | |
1392 | * | |
1393 | * The block operation request @rq in @q has been remapped. The block | |
1394 | * operation request @rq holds the current information and @from hold | |
1395 | * the original sector. | |
1396 | */ | |
1397 | LTTNG_TRACEPOINT_EVENT(block_rq_remap, | |
1398 | ||
1399 | TP_PROTO(struct request *rq, dev_t dev, sector_t from), | |
1400 | ||
1401 | TP_ARGS(rq, dev, from), | |
1402 | ||
1403 | TP_FIELDS( | |
1404 | ctf_integer(dev_t, dev, disk_devt(rq->q->disk)) | |
1405 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) | |
1406 | ctf_integer(unsigned int, nr_sector, blk_rq_sectors(rq)) | |
1407 | ctf_integer(dev_t, old_dev, dev) | |
1408 | ctf_integer(sector_t, old_sector, from) | |
1409 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
1410 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) | |
1411 | ) | |
1412 | ) | |
5dab3d51 | 1413 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \ |
89d91715 MJ |
1414 | || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0) \ |
1415 | || LTTNG_RHEL_KERNEL_RANGE(4,18,0,372,0,0, 4,19,0,0,0,0)) | |
2d67b98e MJ |
1416 | /** |
1417 | * block_rq_remap - map request for a block operation request | |
1418 | * @rq: block IO operation request | |
1419 | * @dev: device for the operation | |
1420 | * @from: original sector for the operation | |
1421 | * | |
1422 | * The block operation request @rq in @q has been remapped. The block | |
1423 | * operation request @rq holds the current information and @from hold | |
1424 | * the original sector. | |
1425 | */ | |
1426 | LTTNG_TRACEPOINT_EVENT(block_rq_remap, | |
1427 | ||
1428 | TP_PROTO(struct request *rq, dev_t dev, sector_t from), | |
1429 | ||
1430 | TP_ARGS(rq, dev, from), | |
1431 | ||
1432 | TP_FIELDS( | |
1433 | ctf_integer(dev_t, dev, disk_devt(rq->rq_disk)) | |
1434 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) | |
1435 | ctf_integer(unsigned int, nr_sector, blk_rq_sectors(rq)) | |
1436 | ctf_integer(dev_t, old_dev, dev) | |
1437 | ctf_integer(sector_t, old_sector, from) | |
1438 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
1439 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) | |
1440 | ) | |
1441 | ) | |
1442 | #else | |
f62b389e MD |
1443 | /** |
1444 | * block_rq_remap - map request for a block operation request | |
1445 | * @q: queue holding the operation | |
1446 | * @rq: block IO operation request | |
1447 | * @dev: device for the operation | |
1448 | * @from: original sector for the operation | |
1449 | * | |
1450 | * The block operation request @rq in @q has been remapped. The block | |
1451 | * operation request @rq holds the current information and @from hold | |
1452 | * the original sector. | |
1453 | */ | |
3bc29f0a | 1454 | LTTNG_TRACEPOINT_EVENT(block_rq_remap, |
f62b389e MD |
1455 | |
1456 | TP_PROTO(struct request_queue *q, struct request *rq, dev_t dev, | |
1457 | sector_t from), | |
1458 | ||
1459 | TP_ARGS(q, rq, dev, from), | |
1460 | ||
f127e61e MD |
1461 | TP_FIELDS( |
1462 | ctf_integer(dev_t, dev, disk_devt(rq->rq_disk)) | |
1463 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) | |
1464 | ctf_integer(unsigned int, nr_sector, blk_rq_sectors(rq)) | |
1465 | ctf_integer(dev_t, old_dev, dev) | |
1466 | ctf_integer(sector_t, old_sector, from) | |
1467 | blk_rwbs_ctf_integer(unsigned int, rwbs, | |
e6d2cc09 | 1468 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) |
f127e61e | 1469 | ) |
f62b389e | 1470 | ) |
2d67b98e | 1471 | #endif |
f62b389e MD |
1472 | |
1473 | #undef __print_rwbs_flags | |
1474 | #undef blk_fill_rwbs | |
1475 | ||
3bc29f0a | 1476 | #endif /* LTTNG_TRACE_BLOCK_H */ |
f62b389e MD |
1477 | |
1478 | /* This part must be outside protection */ | |
3b4aafcb | 1479 | #include <lttng/define_trace.h> |