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