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