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