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