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