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