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