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