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