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