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