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