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