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