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