fix: block: remove the error argument to the block_bio_complete (v5.8)
[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
MD
268
269/**
270 * block_rq_requeue - place block IO request back on a queue
271 * @q: queue holding operation
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 */
d2457078
MJ
278#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
279LTTNG_TRACEPOINT_EVENT(block_rq_requeue,
280
281 TP_PROTO(struct request_queue *q, struct request *rq),
282
283 TP_ARGS(q, rq),
284
285 TP_FIELDS(
286 ctf_integer(dev_t, dev,
287 rq->rq_disk ? disk_devt(rq->rq_disk) : 0)
288 ctf_integer(sector_t, sector, blk_rq_trace_sector(rq))
289 ctf_integer(unsigned int, nr_sector, blk_rq_trace_nr_sectors(rq))
290 blk_rwbs_ctf_integer(unsigned int, rwbs,
291 lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq))
292 )
293)
294#else
3bc29f0a 295LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_requeue,
f62b389e
MD
296
297 TP_PROTO(struct request_queue *q, struct request *rq),
298
299 TP_ARGS(q, rq)
300)
d2457078 301#endif
f62b389e 302
1c53e689
MD
303/**
304 * block_rq_complete - block IO operation completed by device driver
305 * @q: queue containing the block operation request
306 * @rq: block operations request
307 * @nr_bytes: number of completed bytes
308 *
309 * The block_rq_complete tracepoint event indicates that some portion
310 * of operation request has been completed by the device driver. If
311 * the @rq->bio is %NULL, then there is absolutely no additional work to
312 * do for the request. If @rq->bio is non-NULL then there is
313 * additional work required to complete the request.
314 */
d2457078
MJ
315#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
316LTTNG_TRACEPOINT_EVENT(block_rq_complete,
317
318 TP_PROTO(struct request *rq, int error, unsigned int nr_bytes),
319
320 TP_ARGS(rq, error, nr_bytes),
321
322 TP_FIELDS(
323 ctf_integer(dev_t, dev,
324 rq->rq_disk ? disk_devt(rq->rq_disk) : 0)
325 ctf_integer(sector_t, sector, blk_rq_pos(rq))
326 ctf_integer(unsigned int, nr_sector, nr_bytes >> 9)
327 ctf_integer(int, error, error)
328 blk_rwbs_ctf_integer(unsigned int, rwbs,
329 lttng_req_op(rq), lttng_req_rw(rq), nr_bytes)
330 )
331)
332#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
8a9f549f
FD
333LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete,
334
335 TP_PROTO(struct request_queue *q, struct request *rq,
336 unsigned int nr_bytes),
337
338 TP_ARGS(q, rq, nr_bytes),
339
340 TP_locvar(
341 unsigned char *cmd;
342 size_t cmd_len;
343 ),
344
345 TP_code_pre(
346 if (blk_rq_is_scsi(rq)) {
347 struct scsi_request *scsi_rq = scsi_req(rq);
348 tp_locvar->cmd = scsi_rq->cmd;
349 tp_locvar->cmd_len = scsi_rq->cmd_len;
350 } else {
351 tp_locvar->cmd = NULL;
352 tp_locvar->cmd_len = 0;
353 }
354 ),
355
356 TP_FIELDS(
357 ctf_integer(dev_t, dev,
358 rq->rq_disk ? disk_devt(rq->rq_disk) : 0)
359 ctf_integer(sector_t, sector, blk_rq_pos(rq))
360 ctf_integer(unsigned int, nr_sector, nr_bytes >> 9)
361 ctf_integer(int, errors, rq->errors)
362 blk_rwbs_ctf_integer(unsigned int, rwbs,
363 lttng_req_op(rq), lttng_req_rw(rq), nr_bytes)
364 ctf_sequence_hex(unsigned char, cmd,
365 tp_locvar->cmd, size_t, tp_locvar->cmd_len)
366 ),
367
368 TP_code_post()
369)
370#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,5) \
371 || LTTNG_KERNEL_RANGE(3,12,21, 3,13,0) \
372 || LTTNG_KERNEL_RANGE(3,10,41, 3,11,0) \
373 || LTTNG_KERNEL_RANGE(3,4,91, 3,5,0) \
374 || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0) \
375 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,28, 3,14,0,0) \
376 || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0))
377
f127e61e 378LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete,
1c53e689
MD
379
380 TP_PROTO(struct request_queue *q, struct request *rq,
381 unsigned int nr_bytes),
382
383 TP_ARGS(q, rq, nr_bytes),
384
f127e61e
MD
385 TP_locvar(
386 unsigned char *cmd;
387 size_t cmd_len;
1c53e689
MD
388 ),
389
265822ae 390 TP_code_pre(
f127e61e
MD
391 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
392 tp_locvar->cmd = rq->cmd;
393 tp_locvar->cmd_len = rq->cmd_len;
394 } else {
395 tp_locvar->cmd = NULL;
396 tp_locvar->cmd_len = 0;
397 }
1c53e689
MD
398 ),
399
f127e61e
MD
400 TP_FIELDS(
401 ctf_integer(dev_t, dev,
402 rq->rq_disk ? disk_devt(rq->rq_disk) : 0)
403 ctf_integer(sector_t, sector, blk_rq_pos(rq))
404 ctf_integer(unsigned int, nr_sector, nr_bytes >> 9)
405 ctf_integer(int, errors, rq->errors)
406 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09 407 lttng_req_op(rq), lttng_req_rw(rq), nr_bytes)
f127e61e
MD
408 ctf_sequence_hex(unsigned char, cmd,
409 tp_locvar->cmd, size_t, tp_locvar->cmd_len)
265822ae
MD
410 ),
411
412 TP_code_post()
1c53e689
MD
413)
414
415#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
416
f62b389e
MD
417/**
418 * block_rq_complete - block IO operation completed by device driver
419 * @q: queue containing the block operation request
420 * @rq: block operations request
421 *
422 * The block_rq_complete tracepoint event indicates that some portion
423 * of operation request has been completed by the device driver. If
424 * the @rq->bio is %NULL, then there is absolutely no additional work to
425 * do for the request. If @rq->bio is non-NULL then there is
426 * additional work required to complete the request.
427 */
3bc29f0a 428LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_complete,
f62b389e
MD
429
430 TP_PROTO(struct request_queue *q, struct request *rq),
431
432 TP_ARGS(q, rq)
433)
434
1c53e689
MD
435#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
436
d2457078
MJ
437#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
438LTTNG_TRACEPOINT_EVENT_CLASS(block_rq,
439
440 TP_PROTO(struct request_queue *q, struct request *rq),
441
442 TP_ARGS(q, rq),
443
444 TP_FIELDS(
445 ctf_integer(dev_t, dev,
446 rq->rq_disk ? disk_devt(rq->rq_disk) : 0)
447 ctf_integer(sector_t, sector, blk_rq_trace_sector(rq))
448 ctf_integer(unsigned int, nr_sector, blk_rq_trace_nr_sectors(rq))
449 ctf_integer(unsigned int, bytes, blk_rq_bytes(rq))
450 ctf_integer(pid_t, tid, current->pid)
451 blk_rwbs_ctf_integer(unsigned int, rwbs,
452 lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq))
453 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
454 )
455)
456#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
8a9f549f
FD
457LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq,
458
459 TP_PROTO(struct request_queue *q, struct request *rq),
460
461 TP_ARGS(q, rq),
462
463 TP_locvar(
464 sector_t sector;
465 unsigned int nr_sector;
466 unsigned int bytes;
467 unsigned char *cmd;
468 size_t cmd_len;
469 ),
470
471 TP_code_pre(
472 if (blk_rq_is_scsi(rq)) {
473 struct scsi_request *scsi_rq = scsi_req(rq);
474 tp_locvar->sector = 0;
475 tp_locvar->nr_sector = 0;
476 tp_locvar->bytes = scsi_rq->resid_len;
477 tp_locvar->cmd = scsi_rq->cmd;
478 tp_locvar->cmd_len = scsi_rq->cmd_len;
479 } else {
480 tp_locvar->sector = blk_rq_pos(rq);
481 tp_locvar->nr_sector = blk_rq_sectors(rq);
482 tp_locvar->bytes = 0;
483 tp_locvar->cmd = NULL;
484 tp_locvar->cmd_len = 0;
485 }
486 ),
487
488 TP_FIELDS(
489 ctf_integer(dev_t, dev,
490 rq->rq_disk ? disk_devt(rq->rq_disk) : 0)
491 ctf_integer(sector_t, sector, tp_locvar->sector)
492 ctf_integer(unsigned int, nr_sector, tp_locvar->nr_sector)
493 ctf_integer(unsigned int, bytes, tp_locvar->bytes)
494 ctf_integer(pid_t, tid, current->pid)
495 blk_rwbs_ctf_integer(unsigned int, rwbs,
496 lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq))
497 ctf_sequence_hex(unsigned char, cmd,
498 tp_locvar->cmd, size_t, tp_locvar->cmd_len)
499 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
500 ),
501
502 TP_code_post()
503)
504#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
f127e61e 505LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq,
f62b389e
MD
506
507 TP_PROTO(struct request_queue *q, struct request *rq),
508
509 TP_ARGS(q, rq),
510
f127e61e
MD
511 TP_locvar(
512 sector_t sector;
513 unsigned int nr_sector;
514 unsigned int bytes;
515 unsigned char *cmd;
516 size_t cmd_len;
f62b389e
MD
517 ),
518
265822ae 519 TP_code_pre(
f127e61e
MD
520 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
521 tp_locvar->sector = 0;
522 tp_locvar->nr_sector = 0;
523 tp_locvar->bytes = blk_rq_bytes(rq);
524 tp_locvar->cmd = rq->cmd;
525 tp_locvar->cmd_len = rq->cmd_len;
526 } else {
527 tp_locvar->sector = blk_rq_pos(rq);
528 tp_locvar->nr_sector = blk_rq_sectors(rq);
529 tp_locvar->bytes = 0;
530 tp_locvar->cmd = NULL;
531 tp_locvar->cmd_len = 0;
532 }
f62b389e
MD
533 ),
534
f127e61e
MD
535 TP_FIELDS(
536 ctf_integer(dev_t, dev,
537 rq->rq_disk ? disk_devt(rq->rq_disk) : 0)
538 ctf_integer(sector_t, sector, tp_locvar->sector)
539 ctf_integer(unsigned int, nr_sector, tp_locvar->nr_sector)
540 ctf_integer(unsigned int, bytes, tp_locvar->bytes)
541 ctf_integer(pid_t, tid, current->pid)
542 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09 543 lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq))
f127e61e
MD
544 ctf_sequence_hex(unsigned char, cmd,
545 tp_locvar->cmd, size_t, tp_locvar->cmd_len)
546 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
265822ae
MD
547 ),
548
549 TP_code_post()
f62b389e 550)
8a9f549f 551#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
f62b389e
MD
552
553/**
554 * block_rq_insert - insert block operation request into queue
555 * @q: target queue
556 * @rq: block IO operation request
557 *
558 * Called immediately before block operation request @rq is inserted
559 * into queue @q. The fields in the operation request @rq struct can
560 * be examined to determine which device and sectors the pending
561 * operation would access.
562 */
3bc29f0a 563LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_insert,
f62b389e
MD
564
565 TP_PROTO(struct request_queue *q, struct request *rq),
566
567 TP_ARGS(q, rq)
568)
569
570/**
571 * block_rq_issue - issue pending block IO request operation to device driver
572 * @q: queue holding operation
573 * @rq: block IO operation operation request
574 *
575 * Called when block operation request @rq from queue @q is sent to a
576 * device driver for processing.
577 */
3bc29f0a 578LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_issue,
f62b389e
MD
579
580 TP_PROTO(struct request_queue *q, struct request *rq),
581
582 TP_ARGS(q, rq)
583)
584
585/**
586 * block_bio_bounce - used bounce buffer when processing block operation
587 * @q: queue holding the block operation
588 * @bio: block operation
589 *
590 * A bounce buffer was used to handle the block operation @bio in @q.
591 * This occurs when hardware limitations prevent a direct transfer of
592 * data between the @bio data memory area and the IO device. Use of a
593 * bounce buffer requires extra copying of data and decreases
594 * performance.
595 */
3bc29f0a 596LTTNG_TRACEPOINT_EVENT(block_bio_bounce,
f62b389e
MD
597
598 TP_PROTO(struct request_queue *q, struct bio *bio),
599
600 TP_ARGS(q, bio),
601
f127e61e 602 TP_FIELDS(
7feabe53
MD
603#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
604 ctf_integer(dev_t, dev, bio_dev(bio))
605#else
959fe42a 606 ctf_integer(dev_t, dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0)
7feabe53 607#endif
54c4c2e3 608#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
f127e61e
MD
609 ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
610 ctf_integer(unsigned int, nr_sector, bio_sectors(bio))
611 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09
MD
612 lttng_bio_op(bio), lttng_bio_rw(bio),
613 bio->bi_iter.bi_size)
54c4c2e3 614#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
615 ctf_integer(sector_t, sector, bio->bi_sector)
616 ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9)
617 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09
MD
618 lttng_bio_op(bio), lttng_bio_rw(bio),
619 bio->bi_size)
54c4c2e3 620#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
621 ctf_integer(pid_t, tid, current->pid)
622 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
623 )
f62b389e
MD
624)
625
3441e48e
MJ
626
627#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
628/**
629 * block_bio_complete - completed all work on the block operation
630 * @q: queue holding the block operation
631 * @bio: block operation completed
632 * @error: io error value
633 *
634 * This tracepoint indicates there is no further work to do on this
635 * block IO operation @bio.
636 */
637LTTNG_TRACEPOINT_EVENT(block_bio_complete,
638
639 TP_PROTO(struct request_queue *q, struct bio *bio),
640
641 TP_ARGS(q, bio),
642
643 TP_FIELDS(
644 ctf_integer(dev_t, dev, bio_dev(bio))
645 ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
646 ctf_integer(unsigned int, nr_sector, bio_sectors(bio))
647 ctf_integer(int, error, blk_status_to_errno(bio->bi_status))
648 blk_rwbs_ctf_integer(unsigned int, rwbs,
649 lttng_bio_op(bio), lttng_bio_rw(bio),
650 bio->bi_iter.bi_size)
651 )
652)
653#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
f62b389e
MD
654/**
655 * block_bio_complete - completed all work on the block operation
656 * @q: queue holding the block operation
657 * @bio: block operation completed
658 * @error: io error value
659 *
660 * This tracepoint indicates there is no further work to do on this
661 * block IO operation @bio.
662 */
3bc29f0a 663LTTNG_TRACEPOINT_EVENT(block_bio_complete,
f62b389e
MD
664
665 TP_PROTO(struct request_queue *q, struct bio *bio, int error),
666
667 TP_ARGS(q, bio, error),
668
f127e61e 669 TP_FIELDS(
7feabe53 670 ctf_integer(dev_t, dev, bio_dev(bio))
3441e48e
MJ
671 ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
672 ctf_integer(unsigned int, nr_sector, bio_sectors(bio))
673 ctf_integer(int, error, error)
674 blk_rwbs_ctf_integer(unsigned int, rwbs,
675 lttng_bio_op(bio), lttng_bio_rw(bio),
676 bio->bi_iter.bi_size)
677 )
678)
679#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
680/**
681 * block_bio_complete - completed all work on the block operation
682 * @q: queue holding the block operation
683 * @bio: block operation completed
684 * @error: io error value
685 *
686 * This tracepoint indicates there is no further work to do on this
687 * block IO operation @bio.
688 */
689LTTNG_TRACEPOINT_EVENT(block_bio_complete,
690
691 TP_PROTO(struct request_queue *q, struct bio *bio, int error),
692
693 TP_ARGS(q, bio, error),
694
695 TP_FIELDS(
959fe42a 696 ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev)
f127e61e
MD
697 ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
698 ctf_integer(unsigned int, nr_sector, bio_sectors(bio))
699 ctf_integer(int, error, error)
700 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09
MD
701 lttng_bio_op(bio), lttng_bio_rw(bio),
702 bio->bi_iter.bi_size)
3441e48e
MJ
703 )
704)
705#else
706/**
707 * block_bio_complete - completed all work on the block operation
708 * @q: queue holding the block operation
709 * @bio: block operation completed
710 * @error: io error value
711 *
712 * This tracepoint indicates there is no further work to do on this
713 * block IO operation @bio.
714 */
715LTTNG_TRACEPOINT_EVENT(block_bio_complete,
716
717 TP_PROTO(struct request_queue *q, struct bio *bio, int error),
718
719 TP_ARGS(q, bio, error),
720
721 TP_FIELDS(
722 ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev)
f127e61e
MD
723 ctf_integer(sector_t, sector, bio->bi_sector)
724 ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9)
f127e61e 725 ctf_integer(int, error, error)
f127e61e 726 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09 727 lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size)
f127e61e 728 )
f62b389e 729)
3441e48e 730#endif
f62b389e 731
217f66c6 732#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
3bc29f0a 733LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge,
217f66c6
MD
734
735 TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
736
737 TP_ARGS(q, rq, bio),
738
f127e61e 739 TP_FIELDS(
7feabe53
MD
740#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
741 ctf_integer(dev_t, dev, bio_dev(bio))
742#else
959fe42a 743 ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev)
7feabe53 744#endif
54c4c2e3 745#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
f127e61e
MD
746 ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
747 ctf_integer(unsigned int, nr_sector, bio_sectors(bio))
748 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09
MD
749 lttng_bio_op(bio), lttng_bio_rw(bio),
750 bio->bi_iter.bi_size)
54c4c2e3 751#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
752 ctf_integer(sector_t, sector, bio->bi_sector)
753 ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9)
754 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09 755 lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size)
54c4c2e3 756#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
757 ctf_integer(pid_t, tid, current->pid)
758 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
759 )
217f66c6
MD
760)
761
762/**
763 * block_bio_backmerge - merging block operation to the end of an existing operation
764 * @q: queue holding operation
765 * @bio: new block operation to merge
766 *
767 * Merging block request @bio to the end of an existing block request
768 * in queue @q.
769 */
3bc29f0a 770LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge, block_bio_backmerge,
217f66c6
MD
771
772 TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
773
774 TP_ARGS(q, rq, bio)
775)
776
777/**
778 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
779 * @q: queue holding operation
780 * @bio: new block operation to merge
781 *
782 * Merging block IO operation @bio to the beginning of an existing block
783 * operation in queue @q.
784 */
3bc29f0a 785LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge, block_bio_frontmerge,
217f66c6
MD
786
787 TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
788
789 TP_ARGS(q, rq, bio)
790)
791
792/**
793 * block_bio_queue - putting new block IO operation in queue
794 * @q: queue holding operation
795 * @bio: new block operation
796 *
797 * About to place the block IO operation @bio into queue @q.
798 */
3bc29f0a 799LTTNG_TRACEPOINT_EVENT(block_bio_queue,
217f66c6
MD
800
801 TP_PROTO(struct request_queue *q, struct bio *bio),
802
803 TP_ARGS(q, bio),
804
f127e61e 805 TP_FIELDS(
7feabe53
MD
806#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
807 ctf_integer(dev_t, dev, bio_dev(bio))
808#else
959fe42a 809 ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev)
7feabe53 810#endif
54c4c2e3 811#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
f127e61e
MD
812 ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
813 ctf_integer(unsigned int, nr_sector, bio_sectors(bio))
814 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09
MD
815 lttng_bio_op(bio), lttng_bio_rw(bio),
816 bio->bi_iter.bi_size)
54c4c2e3 817#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
818 ctf_integer(sector_t, sector, bio->bi_sector)
819 ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9)
820 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09 821 lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size)
54c4c2e3 822#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
823 ctf_integer(pid_t, tid, current->pid)
824 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
825 )
217f66c6 826)
f127e61e 827#else /* if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
3bc29f0a 828LTTNG_TRACEPOINT_EVENT_CLASS(block_bio,
f62b389e
MD
829
830 TP_PROTO(struct request_queue *q, struct bio *bio),
831
832 TP_ARGS(q, bio),
833
f127e61e 834 TP_FIELDS(
959fe42a 835 ctf_integer(dev_t, dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0)
f127e61e
MD
836 ctf_integer(sector_t, sector, bio->bi_sector)
837 ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9)
838 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09 839 lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size)
f127e61e
MD
840 ctf_integer(pid_t, tid, current->pid)
841 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
842 )
f62b389e
MD
843)
844
845/**
846 * block_bio_backmerge - merging block operation to the end of an existing operation
847 * @q: queue holding operation
848 * @bio: new block operation to merge
849 *
850 * Merging block request @bio to the end of an existing block request
851 * in queue @q.
852 */
3bc29f0a 853LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_backmerge,
f62b389e
MD
854
855 TP_PROTO(struct request_queue *q, struct bio *bio),
856
857 TP_ARGS(q, bio)
858)
859
860/**
861 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
862 * @q: queue holding operation
863 * @bio: new block operation to merge
864 *
865 * Merging block IO operation @bio to the beginning of an existing block
866 * operation in queue @q.
867 */
3bc29f0a 868LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_frontmerge,
f62b389e
MD
869
870 TP_PROTO(struct request_queue *q, struct bio *bio),
871
872 TP_ARGS(q, bio)
873)
874
875/**
876 * block_bio_queue - putting new block IO operation in queue
877 * @q: queue holding operation
878 * @bio: new block operation
879 *
880 * About to place the block IO operation @bio into queue @q.
881 */
3bc29f0a 882LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_queue,
f62b389e
MD
883
884 TP_PROTO(struct request_queue *q, struct bio *bio),
885
886 TP_ARGS(q, bio)
887)
f127e61e 888#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
f62b389e 889
3bc29f0a 890LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq,
f62b389e
MD
891
892 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
893
894 TP_ARGS(q, bio, rw),
895
f127e61e 896 TP_FIELDS(
7feabe53 897#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
6417cda6 898 ctf_integer(dev_t, dev, bio ? bio_dev(bio) : 0)
7feabe53 899#else
959fe42a 900 ctf_integer(dev_t, dev, bio ? bio->bi_bdev->bd_dev : 0)
7feabe53 901#endif
54c4c2e3 902#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
f127e61e
MD
903 ctf_integer(sector_t, sector, bio ? bio->bi_iter.bi_sector : 0)
904 ctf_integer(unsigned int, nr_sector,
905 bio ? bio_sectors(bio) : 0)
906 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09
MD
907 bio ? lttng_bio_op(bio) : 0,
908 bio ? lttng_bio_rw(bio) : 0,
f127e61e 909 bio ? bio->bi_iter.bi_size : 0)
54c4c2e3 910#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
911 ctf_integer(sector_t, sector, bio ? bio->bi_sector : 0)
912 ctf_integer(unsigned int, nr_sector,
913 bio ? bio->bi_size >> 9 : 0)
914 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09
MD
915 bio ? lttng_bio_op(bio) : 0,
916 bio ? lttng_bio_rw(bio) : 0,
f127e61e 917 bio ? bio->bi_size : 0)
54c4c2e3 918#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
919 ctf_integer(pid_t, tid, current->pid)
920 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
921 )
f62b389e
MD
922)
923
924/**
925 * block_getrq - get a free request entry in queue for block IO operations
926 * @q: queue for operations
6417cda6 927 * @bio: pending block IO operation (can be %NULL)
f62b389e
MD
928 * @rw: low bit indicates a read (%0) or a write (%1)
929 *
930 * A request struct for queue @q has been allocated to handle the
931 * block IO operation @bio.
932 */
3bc29f0a 933LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq, block_getrq,
f62b389e
MD
934
935 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
936
937 TP_ARGS(q, bio, rw)
938)
939
940/**
941 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
942 * @q: queue for operation
6417cda6 943 * @bio: pending block IO operation (can be %NULL)
f62b389e
MD
944 * @rw: low bit indicates a read (%0) or a write (%1)
945 *
946 * In the case where a request struct cannot be provided for queue @q
947 * the process needs to wait for an request struct to become
948 * available. This tracepoint event is generated each time the
949 * process goes to sleep waiting for request struct become available.
950 */
3bc29f0a 951LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq, block_sleeprq,
f62b389e
MD
952
953 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
954
955 TP_ARGS(q, bio, rw)
956)
957
958/**
959 * block_plug - keep operations requests in request queue
960 * @q: request queue to plug
961 *
962 * Plug the request queue @q. Do not allow block operation requests
963 * to be sent to the device driver. Instead, accumulate requests in
964 * the queue to improve throughput performance of the block device.
965 */
3bc29f0a 966LTTNG_TRACEPOINT_EVENT(block_plug,
f62b389e
MD
967
968 TP_PROTO(struct request_queue *q),
969
970 TP_ARGS(q),
971
f127e61e
MD
972 TP_FIELDS(
973 ctf_integer(pid_t, tid, current->pid)
974 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
975 )
f62b389e
MD
976)
977
3bc29f0a 978LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug,
f62b389e
MD
979
980 TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit),
981
982 TP_ARGS(q, depth, explicit),
983
f127e61e 984 TP_FIELDS(
f127e61e 985 ctf_integer(int, nr_rq, depth)
f127e61e
MD
986 ctf_integer(pid_t, tid, current->pid)
987 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
988 )
f62b389e
MD
989)
990
991/**
992 * block_unplug - release of operations requests in request queue
993 * @q: request queue to unplug
994 * @depth: number of requests just added to the queue
995 * @explicit: whether this was an explicit unplug, or one from schedule()
996 *
997 * Unplug request queue @q because device driver is scheduled to work
998 * on elements in the request queue.
999 */
3bc29f0a 1000LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug, block_unplug,
f62b389e
MD
1001
1002 TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit),
1003
1004 TP_ARGS(q, depth, explicit)
1005)
1006
1007/**
1008 * block_split - split a single bio struct into two bio structs
1009 * @q: queue containing the bio
1010 * @bio: block operation being split
1011 * @new_sector: The starting sector for the new bio
1012 *
1013 * The bio request @bio in request queue @q needs to be split into two
1014 * bio requests. The newly created @bio request starts at
1015 * @new_sector. This split may be required due to hardware limitation
1016 * such as operation crossing device boundaries in a RAID system.
1017 */
3bc29f0a 1018LTTNG_TRACEPOINT_EVENT(block_split,
f62b389e
MD
1019
1020 TP_PROTO(struct request_queue *q, struct bio *bio,
1021 unsigned int new_sector),
1022
1023 TP_ARGS(q, bio, new_sector),
1024
f127e61e 1025 TP_FIELDS(
7feabe53
MD
1026#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
1027 ctf_integer(dev_t, dev, bio_dev(bio))
1028#else
959fe42a 1029 ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev)
7feabe53 1030#endif
54c4c2e3 1031#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
f127e61e
MD
1032 ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
1033 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09
MD
1034 lttng_bio_op(bio), lttng_bio_rw(bio),
1035 bio->bi_iter.bi_size)
54c4c2e3 1036#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
1037 ctf_integer(sector_t, sector, bio->bi_sector)
1038 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09 1039 lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size)
54c4c2e3 1040#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
1041 ctf_integer(sector_t, new_sector, new_sector)
1042 ctf_integer(pid_t, tid, current->pid)
1043 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
1044 )
f62b389e
MD
1045)
1046
1047/**
1048 * block_bio_remap - map request for a logical device to the raw device
1049 * @q: queue holding the operation
1050 * @bio: revised operation
1051 * @dev: device for the operation
1052 * @from: original sector for the operation
1053 *
1054 * An operation for a logical device has been mapped to the
1055 * raw block device.
1056 */
3bc29f0a 1057LTTNG_TRACEPOINT_EVENT(block_bio_remap,
f62b389e
MD
1058
1059 TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev,
1060 sector_t from),
1061
1062 TP_ARGS(q, bio, dev, from),
1063
f127e61e 1064 TP_FIELDS(
7feabe53
MD
1065#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
1066 ctf_integer(dev_t, dev, bio_dev(bio))
1067#else
959fe42a 1068 ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev)
7feabe53 1069#endif
54c4c2e3 1070#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
f127e61e
MD
1071 ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
1072 ctf_integer(unsigned int, nr_sector, bio_sectors(bio))
1073 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09
MD
1074 lttng_bio_op(bio), lttng_bio_rw(bio),
1075 bio->bi_iter.bi_size)
54c4c2e3 1076#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
1077 ctf_integer(sector_t, sector, bio->bi_sector)
1078 ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9)
1079 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09 1080 lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size)
54c4c2e3 1081#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
1082 ctf_integer(dev_t, old_dev, dev)
1083 ctf_integer(sector_t, old_sector, from)
1084 )
f62b389e
MD
1085)
1086
1087/**
1088 * block_rq_remap - map request for a block operation request
1089 * @q: queue holding the operation
1090 * @rq: block IO operation request
1091 * @dev: device for the operation
1092 * @from: original sector for the operation
1093 *
1094 * The block operation request @rq in @q has been remapped. The block
1095 * operation request @rq holds the current information and @from hold
1096 * the original sector.
1097 */
3bc29f0a 1098LTTNG_TRACEPOINT_EVENT(block_rq_remap,
f62b389e
MD
1099
1100 TP_PROTO(struct request_queue *q, struct request *rq, dev_t dev,
1101 sector_t from),
1102
1103 TP_ARGS(q, rq, dev, from),
1104
f127e61e
MD
1105 TP_FIELDS(
1106 ctf_integer(dev_t, dev, disk_devt(rq->rq_disk))
1107 ctf_integer(sector_t, sector, blk_rq_pos(rq))
1108 ctf_integer(unsigned int, nr_sector, blk_rq_sectors(rq))
1109 ctf_integer(dev_t, old_dev, dev)
1110 ctf_integer(sector_t, old_sector, from)
1111 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09 1112 lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq))
f127e61e 1113 )
f62b389e
MD
1114)
1115
1116#undef __print_rwbs_flags
1117#undef blk_fill_rwbs
1118
3bc29f0a 1119#endif /* LTTNG_TRACE_BLOCK_H */
f62b389e
MD
1120
1121/* This part must be outside protection */
3b4aafcb 1122#include <lttng/define_trace.h>
This page took 0.103619 seconds and 4 git commands to generate.