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