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