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