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