Migrate tracepoint instrumentation to TP_FIELDS
[lttng-modules.git] / instrumentation / events / lttng-module / block.h
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM block
3
4 #if !defined(LTTNG_TRACE_BLOCK_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define LTTNG_TRACE_BLOCK_H
6
7 #include "../../../probes/lttng-tracepoint-event.h"
8 #include <linux/blktrace_api.h>
9 #include <linux/blkdev.h>
10 #include <linux/trace_seq.h>
11 #include <linux/version.h>
12
13 #ifndef _TRACE_BLOCK_DEF_
14 #define _TRACE_BLOCK_DEF_
15
16 enum {
17 RWBS_FLAG_WRITE = (1 << 0),
18 RWBS_FLAG_DISCARD = (1 << 1),
19 RWBS_FLAG_READ = (1 << 2),
20 RWBS_FLAG_RAHEAD = (1 << 3),
21 RWBS_FLAG_BARRIER = (1 << 4),
22 RWBS_FLAG_SYNC = (1 << 5),
23 RWBS_FLAG_META = (1 << 6),
24 RWBS_FLAG_SECURE = (1 << 7),
25 RWBS_FLAG_FLUSH = (1 << 8),
26 RWBS_FLAG_FUA = (1 << 9),
27 };
28
29 #endif /* _TRACE_BLOCK_DEF_ */
30
31 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
32
33 #define blk_rwbs_ctf_integer(type, rwbs, rw, bytes) \
34 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
35 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
36 ( (bytes) ? RWBS_FLAG_READ : \
37 ( 0 )))) \
38 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
39 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
40 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
41 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \
42 | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \
43 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
44
45 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
46
47 #define blk_rwbs_ctf_integer(type, rwbs, rw, bytes) \
48 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
49 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
50 ( (bytes) ? RWBS_FLAG_READ : \
51 ( 0 )))) \
52 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
53 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
54 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
55 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
56
57 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
58
59 #define blk_rwbs_ctf_integer(type, rwbs, rw, bytes) \
60 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
61 ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
62 ( (bytes) ? RWBS_FLAG_READ : \
63 ( 0 )))) \
64 | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
65 | ((rw) & REQ_HARDBARRIER ? RWBS_FLAG_BARRIER : 0) \
66 | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
67 | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
68 | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0))
69
70 #else
71
72 #define blk_rwbs_ctf_integer(type, rwbs, rw, bytes) \
73 ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
74 ( (rw) & (1 << BIO_RW_DISCARD) ? RWBS_FLAG_DISCARD : \
75 ( (bytes) ? RWBS_FLAG_READ : \
76 ( 0 )))) \
77 | ((rw) & (1 << BIO_RW_AHEAD) ? RWBS_FLAG_RAHEAD : 0) \
78 | ((rw) & (1 << BIO_RW_SYNCIO) ? RWBS_FLAG_SYNC : 0) \
79 | ((rw) & (1 << BIO_RW_META) ? RWBS_FLAG_META : 0) \
80 | ((rw) & (1 << BIO_RW_BARRIER) ? RWBS_FLAG_BARRIER : 0))
81
82 #endif
83
84 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
85 LTTNG_TRACEPOINT_EVENT_CLASS(block_buffer,
86
87 TP_PROTO(struct buffer_head *bh),
88
89 TP_ARGS(bh),
90
91 TP_FIELDS (
92 ctf_integer(dev_t, dev, bh->b_bdev->bd_dev)
93 ctf_integer(sector_t, sector, bh->b_blocknr)
94 ctf_integer(size_t, size, bh->b_size)
95 )
96 )
97
98 /**
99 * block_touch_buffer - mark a buffer accessed
100 * @bh: buffer_head being touched
101 *
102 * Called from touch_buffer().
103 */
104 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer, block_touch_buffer,
105
106 TP_PROTO(struct buffer_head *bh),
107
108 TP_ARGS(bh)
109 )
110
111 /**
112 * block_dirty_buffer - mark a buffer dirty
113 * @bh: buffer_head being dirtied
114 *
115 * Called from mark_buffer_dirty().
116 */
117 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer, block_dirty_buffer,
118
119 TP_PROTO(struct buffer_head *bh),
120
121 TP_ARGS(bh)
122 )
123 #endif
124
125 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error,
126
127 TP_PROTO(struct request_queue *q, struct request *rq),
128
129 TP_ARGS(q, rq),
130
131 TP_locvar(
132 sector_t sector;
133 unsigned int nr_sector;
134 unsigned char *cmd;
135 size_t cmd_len;
136 ),
137
138 TP_code(
139 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
140 tp_locvar->sector = 0;
141 tp_locvar->nr_sector = 0;
142 tp_locvar->cmd = rq->cmd;
143 tp_locvar->cmd_len = rq->cmd_len;
144 } else {
145 tp_locvar->sector = blk_rq_pos(rq);
146 tp_locvar->nr_sector = blk_rq_sectors(rq);
147 tp_locvar->cmd = NULL;
148 tp_locvar->cmd_len = 0;
149 }
150 ),
151
152 TP_FIELDS(
153 ctf_integer(dev_t, dev,
154 rq->rq_disk ? disk_devt(rq->rq_disk) : 0)
155 ctf_integer(sector_t, sector, tp_locvar->sector)
156 ctf_integer(unsigned int, nr_sector, tp_locvar->nr_sector)
157 ctf_integer(int, errors, rq->errors)
158 blk_rwbs_ctf_integer(unsigned int, rwbs,
159 rq->cmd_flags, blk_rq_bytes(rq))
160 ctf_sequence_hex(unsigned char, cmd,
161 tp_locvar->cmd, size_t, tp_locvar->cmd_len)
162 )
163 )
164
165 /**
166 * block_rq_abort - abort block operation request
167 * @q: queue containing the block operation request
168 * @rq: block IO operation request
169 *
170 * Called immediately after pending block IO operation request @rq in
171 * queue @q is aborted. The fields in the operation request @rq
172 * can be examined to determine which device and sectors the pending
173 * operation would access.
174 */
175 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_abort,
176
177 TP_PROTO(struct request_queue *q, struct request *rq),
178
179 TP_ARGS(q, rq)
180 )
181
182 /**
183 * block_rq_requeue - place block IO request back on a queue
184 * @q: queue holding operation
185 * @rq: block IO operation request
186 *
187 * The block operation request @rq is being placed back into queue
188 * @q. For some reason the request was not completed and needs to be
189 * put back in the queue.
190 */
191 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_requeue,
192
193 TP_PROTO(struct request_queue *q, struct request *rq),
194
195 TP_ARGS(q, rq)
196 )
197
198 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,5) \
199 || LTTNG_KERNEL_RANGE(3,12,21, 3,13,0) \
200 || LTTNG_KERNEL_RANGE(3,10,41, 3,11,0) \
201 || LTTNG_KERNEL_RANGE(3,4,91, 3,5,0) \
202 || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0) \
203 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,31, 3,14,0,0))
204
205 /**
206 * block_rq_complete - block IO operation completed by device driver
207 * @q: queue containing the block operation request
208 * @rq: block operations request
209 * @nr_bytes: number of completed bytes
210 *
211 * The block_rq_complete tracepoint event indicates that some portion
212 * of operation request has been completed by the device driver. If
213 * the @rq->bio is %NULL, then there is absolutely no additional work to
214 * do for the request. If @rq->bio is non-NULL then there is
215 * additional work required to complete the request.
216 */
217 LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete,
218
219 TP_PROTO(struct request_queue *q, struct request *rq,
220 unsigned int nr_bytes),
221
222 TP_ARGS(q, rq, nr_bytes),
223
224 TP_locvar(
225 unsigned char *cmd;
226 size_t cmd_len;
227 ),
228
229 TP_code(
230 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
231 tp_locvar->cmd = rq->cmd;
232 tp_locvar->cmd_len = rq->cmd_len;
233 } else {
234 tp_locvar->cmd = NULL;
235 tp_locvar->cmd_len = 0;
236 }
237 ),
238
239 TP_FIELDS(
240 ctf_integer(dev_t, dev,
241 rq->rq_disk ? disk_devt(rq->rq_disk) : 0)
242 ctf_integer(sector_t, sector, blk_rq_pos(rq))
243 ctf_integer(unsigned int, nr_sector, nr_bytes >> 9)
244 ctf_integer(int, errors, rq->errors)
245 blk_rwbs_ctf_integer(unsigned int, rwbs,
246 rq->cmd_flags, nr_bytes)
247 ctf_sequence_hex(unsigned char, cmd,
248 tp_locvar->cmd, size_t, tp_locvar->cmd_len)
249 )
250 )
251
252 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
253
254 /**
255 * block_rq_complete - block IO operation completed by device driver
256 * @q: queue containing the block operation request
257 * @rq: block operations request
258 *
259 * The block_rq_complete tracepoint event indicates that some portion
260 * of operation request has been completed by the device driver. If
261 * the @rq->bio is %NULL, then there is absolutely no additional work to
262 * do for the request. If @rq->bio is non-NULL then there is
263 * additional work required to complete the request.
264 */
265 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_complete,
266
267 TP_PROTO(struct request_queue *q, struct request *rq),
268
269 TP_ARGS(q, rq)
270 )
271
272 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */
273
274 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq,
275
276 TP_PROTO(struct request_queue *q, struct request *rq),
277
278 TP_ARGS(q, rq),
279
280 TP_locvar(
281 sector_t sector;
282 unsigned int nr_sector;
283 unsigned int bytes;
284 unsigned char *cmd;
285 size_t cmd_len;
286 ),
287
288 TP_code(
289 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
290 tp_locvar->sector = 0;
291 tp_locvar->nr_sector = 0;
292 tp_locvar->bytes = blk_rq_bytes(rq);
293 tp_locvar->cmd = rq->cmd;
294 tp_locvar->cmd_len = rq->cmd_len;
295 } else {
296 tp_locvar->sector = blk_rq_pos(rq);
297 tp_locvar->nr_sector = blk_rq_sectors(rq);
298 tp_locvar->bytes = 0;
299 tp_locvar->cmd = NULL;
300 tp_locvar->cmd_len = 0;
301 }
302 ),
303
304 TP_FIELDS(
305 ctf_integer(dev_t, dev,
306 rq->rq_disk ? disk_devt(rq->rq_disk) : 0)
307 ctf_integer(sector_t, sector, tp_locvar->sector)
308 ctf_integer(unsigned int, nr_sector, tp_locvar->nr_sector)
309 ctf_integer(unsigned int, bytes, tp_locvar->bytes)
310 ctf_integer(pid_t, tid, current->pid)
311 blk_rwbs_ctf_integer(unsigned int, rwbs,
312 rq->cmd_flags, blk_rq_bytes(rq))
313 ctf_sequence_hex(unsigned char, cmd,
314 tp_locvar->cmd, size_t, tp_locvar->cmd_len)
315 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
316 )
317 )
318
319 /**
320 * block_rq_insert - insert block operation request into queue
321 * @q: target queue
322 * @rq: block IO operation request
323 *
324 * Called immediately before block operation request @rq is inserted
325 * into queue @q. The fields in the operation request @rq struct can
326 * be examined to determine which device and sectors the pending
327 * operation would access.
328 */
329 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_insert,
330
331 TP_PROTO(struct request_queue *q, struct request *rq),
332
333 TP_ARGS(q, rq)
334 )
335
336 /**
337 * block_rq_issue - issue pending block IO request operation to device driver
338 * @q: queue holding operation
339 * @rq: block IO operation operation request
340 *
341 * Called when block operation request @rq from queue @q is sent to a
342 * device driver for processing.
343 */
344 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_issue,
345
346 TP_PROTO(struct request_queue *q, struct request *rq),
347
348 TP_ARGS(q, rq)
349 )
350
351 /**
352 * block_bio_bounce - used bounce buffer when processing block operation
353 * @q: queue holding the block operation
354 * @bio: block operation
355 *
356 * A bounce buffer was used to handle the block operation @bio in @q.
357 * This occurs when hardware limitations prevent a direct transfer of
358 * data between the @bio data memory area and the IO device. Use of a
359 * bounce buffer requires extra copying of data and decreases
360 * performance.
361 */
362 LTTNG_TRACEPOINT_EVENT(block_bio_bounce,
363
364 TP_PROTO(struct request_queue *q, struct bio *bio),
365
366 TP_ARGS(q, bio),
367
368 TP_FIELDS(
369 ctf_integer(dev_t, dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0)
370 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
371 ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
372 ctf_integer(unsigned int, nr_sector, bio_sectors(bio))
373 blk_rwbs_ctf_integer(unsigned int, rwbs,
374 bio->bi_rw, bio->bi_iter.bi_size)
375 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
376 ctf_integer(sector_t, sector, bio->bi_sector)
377 ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9)
378 blk_rwbs_ctf_integer(unsigned int, rwbs,
379 bio->bi_rw, bio->bi_size)
380 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
381 ctf_integer(pid_t, tid, current->pid)
382 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
383 )
384 )
385
386 /**
387 * block_bio_complete - completed all work on the block operation
388 * @q: queue holding the block operation
389 * @bio: block operation completed
390 * @error: io error value
391 *
392 * This tracepoint indicates there is no further work to do on this
393 * block IO operation @bio.
394 */
395 LTTNG_TRACEPOINT_EVENT(block_bio_complete,
396
397 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
398 TP_PROTO(struct request_queue *q, struct bio *bio, int error),
399
400 TP_ARGS(q, bio, error),
401 #else
402 TP_PROTO(struct request_queue *q, struct bio *bio),
403
404 TP_ARGS(q, bio),
405 #endif
406
407 TP_FIELDS(
408 ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev)
409 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
410 ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
411 ctf_integer(unsigned int, nr_sector, bio_sectors(bio))
412 ctf_integer(int, error, error)
413 blk_rwbs_ctf_integer(unsigned int, rwbs,
414 bio->bi_rw, bio->bi_iter.bi_size)
415 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
416 ctf_integer(sector_t, sector, bio->bi_sector)
417 ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9)
418 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
419 ctf_integer(int, error, error)
420 #else
421 ctf_integer(int, error, 0)
422 #endif
423 blk_rwbs_ctf_integer(unsigned int, rwbs,
424 bio->bi_rw, bio->bi_size)
425 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
426 )
427 )
428
429 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
430 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge,
431
432 TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
433
434 TP_ARGS(q, rq, bio),
435
436 TP_FIELDS(
437 ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev)
438 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
439 ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
440 ctf_integer(unsigned int, nr_sector, bio_sectors(bio))
441 blk_rwbs_ctf_integer(unsigned int, rwbs,
442 bio->bi_rw, bio->bi_iter.bi_size)
443 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
444 ctf_integer(sector_t, sector, bio->bi_sector)
445 ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9)
446 blk_rwbs_ctf_integer(unsigned int, rwbs,
447 bio->bi_rw, bio->bi_size)
448 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
449 ctf_integer(pid_t, tid, current->pid)
450 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
451 )
452 )
453
454 /**
455 * block_bio_backmerge - merging block operation to the end of an existing operation
456 * @q: queue holding operation
457 * @bio: new block operation to merge
458 *
459 * Merging block request @bio to the end of an existing block request
460 * in queue @q.
461 */
462 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge, block_bio_backmerge,
463
464 TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
465
466 TP_ARGS(q, rq, bio)
467 )
468
469 /**
470 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
471 * @q: queue holding operation
472 * @bio: new block operation to merge
473 *
474 * Merging block IO operation @bio to the beginning of an existing block
475 * operation in queue @q.
476 */
477 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge, block_bio_frontmerge,
478
479 TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
480
481 TP_ARGS(q, rq, bio)
482 )
483
484 /**
485 * block_bio_queue - putting new block IO operation in queue
486 * @q: queue holding operation
487 * @bio: new block operation
488 *
489 * About to place the block IO operation @bio into queue @q.
490 */
491 LTTNG_TRACEPOINT_EVENT(block_bio_queue,
492
493 TP_PROTO(struct request_queue *q, struct bio *bio),
494
495 TP_ARGS(q, bio),
496
497 TP_FIELDS(
498 ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev)
499 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
500 ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
501 ctf_integer(unsigned int, nr_sector, bio_sectors(bio))
502 blk_rwbs_ctf_integer(unsigned int, rwbs,
503 bio->bi_rw, bio->bi_iter.bi_size)
504 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
505 ctf_integer(sector_t, sector, bio->bi_sector)
506 ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9)
507 blk_rwbs_ctf_integer(unsigned int, rwbs,
508 bio->bi_rw, bio->bi_size)
509 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
510 ctf_integer(pid_t, tid, current->pid)
511 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
512 )
513 )
514 #else /* if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
515 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio,
516
517 TP_PROTO(struct request_queue *q, struct bio *bio),
518
519 TP_ARGS(q, bio),
520
521 TP_FIELDS(
522 ctf_integer(dev_t, dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0)
523 ctf_integer(sector_t, sector, bio->bi_sector)
524 ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9)
525 blk_rwbs_ctf_integer(unsigned int, rwbs,
526 bio->bi_rw, bio->bi_size)
527 ctf_integer(pid_t, tid, current->pid)
528 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
529 )
530 )
531
532 /**
533 * block_bio_backmerge - merging block operation to the end of an existing operation
534 * @q: queue holding operation
535 * @bio: new block operation to merge
536 *
537 * Merging block request @bio to the end of an existing block request
538 * in queue @q.
539 */
540 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_backmerge,
541
542 TP_PROTO(struct request_queue *q, struct bio *bio),
543
544 TP_ARGS(q, bio)
545 )
546
547 /**
548 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
549 * @q: queue holding operation
550 * @bio: new block operation to merge
551 *
552 * Merging block IO operation @bio to the beginning of an existing block
553 * operation in queue @q.
554 */
555 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_frontmerge,
556
557 TP_PROTO(struct request_queue *q, struct bio *bio),
558
559 TP_ARGS(q, bio)
560 )
561
562 /**
563 * block_bio_queue - putting new block IO operation in queue
564 * @q: queue holding operation
565 * @bio: new block operation
566 *
567 * About to place the block IO operation @bio into queue @q.
568 */
569 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_queue,
570
571 TP_PROTO(struct request_queue *q, struct bio *bio),
572
573 TP_ARGS(q, bio)
574 )
575 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
576
577 LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq,
578
579 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
580
581 TP_ARGS(q, bio, rw),
582
583 TP_FIELDS(
584 ctf_integer(dev_t, dev, bio ? bio->bi_bdev->bd_dev : 0)
585 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
586 ctf_integer(sector_t, sector, bio ? bio->bi_iter.bi_sector : 0)
587 ctf_integer(unsigned int, nr_sector,
588 bio ? bio_sectors(bio) : 0)
589 blk_rwbs_ctf_integer(unsigned int, rwbs,
590 bio ? bio->bi_rw : 0,
591 bio ? bio->bi_iter.bi_size : 0)
592 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
593 ctf_integer(sector_t, sector, bio ? bio->bi_sector : 0)
594 ctf_integer(unsigned int, nr_sector,
595 bio ? bio->bi_size >> 9 : 0)
596 blk_rwbs_ctf_integer(unsigned int, rwbs,
597 bio ? bio->bi_rw : 0,
598 bio ? bio->bi_size : 0)
599 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
600 ctf_integer(pid_t, tid, current->pid)
601 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
602 )
603 )
604
605 /**
606 * block_getrq - get a free request entry in queue for block IO operations
607 * @q: queue for operations
608 * @bio: pending block IO operation
609 * @rw: low bit indicates a read (%0) or a write (%1)
610 *
611 * A request struct for queue @q has been allocated to handle the
612 * block IO operation @bio.
613 */
614 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq, block_getrq,
615
616 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
617
618 TP_ARGS(q, bio, rw)
619 )
620
621 /**
622 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
623 * @q: queue for operation
624 * @bio: pending block IO operation
625 * @rw: low bit indicates a read (%0) or a write (%1)
626 *
627 * In the case where a request struct cannot be provided for queue @q
628 * the process needs to wait for an request struct to become
629 * available. This tracepoint event is generated each time the
630 * process goes to sleep waiting for request struct become available.
631 */
632 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq, block_sleeprq,
633
634 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
635
636 TP_ARGS(q, bio, rw)
637 )
638
639 /**
640 * block_plug - keep operations requests in request queue
641 * @q: request queue to plug
642 *
643 * Plug the request queue @q. Do not allow block operation requests
644 * to be sent to the device driver. Instead, accumulate requests in
645 * the queue to improve throughput performance of the block device.
646 */
647 LTTNG_TRACEPOINT_EVENT(block_plug,
648
649 TP_PROTO(struct request_queue *q),
650
651 TP_ARGS(q),
652
653 TP_FIELDS(
654 ctf_integer(pid_t, tid, current->pid)
655 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
656 )
657 )
658
659 LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug,
660
661 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
662 TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit),
663
664 TP_ARGS(q, depth, explicit),
665 #else
666 TP_PROTO(struct request_queue *q),
667
668 TP_ARGS(q),
669 #endif
670
671 TP_FIELDS(
672 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
673 ctf_integer(int, nr_rq, depth)
674 #else
675 ctf_integer(int, nr_rq, q->rq.count[READ] + q->rq.count[WRITE])
676 #endif
677 ctf_integer(pid_t, tid, current->pid)
678 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
679 )
680 )
681
682 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
683 /**
684 * block_unplug_timer - timed release of operations requests in queue to device driver
685 * @q: request queue to unplug
686 *
687 * Unplug the request queue @q because a timer expired and allow block
688 * operation requests to be sent to the device driver.
689 */
690 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug, block_unplug_timer,
691
692 TP_PROTO(struct request_queue *q),
693
694 TP_ARGS(q)
695 )
696 #endif
697
698 /**
699 * block_unplug - release of operations requests in request queue
700 * @q: request queue to unplug
701 * @depth: number of requests just added to the queue
702 * @explicit: whether this was an explicit unplug, or one from schedule()
703 *
704 * Unplug request queue @q because device driver is scheduled to work
705 * on elements in the request queue.
706 */
707 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
708 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug, block_unplug,
709 #else
710 LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug, block_unplug_io,
711 #endif
712
713 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
714 TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit),
715
716 TP_ARGS(q, depth, explicit)
717 #else
718 TP_PROTO(struct request_queue *q),
719
720 TP_ARGS(q)
721 #endif
722 )
723
724 /**
725 * block_split - split a single bio struct into two bio structs
726 * @q: queue containing the bio
727 * @bio: block operation being split
728 * @new_sector: The starting sector for the new bio
729 *
730 * The bio request @bio in request queue @q needs to be split into two
731 * bio requests. The newly created @bio request starts at
732 * @new_sector. This split may be required due to hardware limitation
733 * such as operation crossing device boundaries in a RAID system.
734 */
735 LTTNG_TRACEPOINT_EVENT(block_split,
736
737 TP_PROTO(struct request_queue *q, struct bio *bio,
738 unsigned int new_sector),
739
740 TP_ARGS(q, bio, new_sector),
741
742 TP_FIELDS(
743 ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev)
744 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
745 ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
746 blk_rwbs_ctf_integer(unsigned int, rwbs,
747 bio->bi_rw, bio->bi_iter.bi_size)
748 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
749 ctf_integer(sector_t, sector, bio->bi_sector)
750 blk_rwbs_ctf_integer(unsigned int, rwbs,
751 bio->bi_rw, bio->bi_size)
752 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
753 ctf_integer(sector_t, new_sector, new_sector)
754 ctf_integer(pid_t, tid, current->pid)
755 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
756 )
757 )
758
759 /**
760 * block_bio_remap - map request for a logical device to the raw device
761 * @q: queue holding the operation
762 * @bio: revised operation
763 * @dev: device for the operation
764 * @from: original sector for the operation
765 *
766 * An operation for a logical device has been mapped to the
767 * raw block device.
768 */
769 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
770 LTTNG_TRACEPOINT_EVENT(block_bio_remap,
771 #else
772 LTTNG_TRACEPOINT_EVENT(block_remap,
773 #endif
774
775 TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev,
776 sector_t from),
777
778 TP_ARGS(q, bio, dev, from),
779
780 TP_FIELDS(
781 ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev)
782 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
783 ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
784 ctf_integer(unsigned int, nr_sector, bio_sectors(bio))
785 blk_rwbs_ctf_integer(unsigned int, rwbs,
786 bio->bi_rw, bio->bi_iter.bi_size)
787 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
788 ctf_integer(sector_t, sector, bio->bi_sector)
789 ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9)
790 blk_rwbs_ctf_integer(unsigned int, rwbs,
791 bio->bi_rw, bio->bi_size)
792 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
793 ctf_integer(dev_t, old_dev, dev)
794 ctf_integer(sector_t, old_sector, from)
795 )
796 )
797
798 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
799 /**
800 * block_rq_remap - map request for a block operation request
801 * @q: queue holding the operation
802 * @rq: block IO operation request
803 * @dev: device for the operation
804 * @from: original sector for the operation
805 *
806 * The block operation request @rq in @q has been remapped. The block
807 * operation request @rq holds the current information and @from hold
808 * the original sector.
809 */
810 LTTNG_TRACEPOINT_EVENT(block_rq_remap,
811
812 TP_PROTO(struct request_queue *q, struct request *rq, dev_t dev,
813 sector_t from),
814
815 TP_ARGS(q, rq, dev, from),
816
817 TP_FIELDS(
818 ctf_integer(dev_t, dev, disk_devt(rq->rq_disk))
819 ctf_integer(sector_t, sector, blk_rq_pos(rq))
820 ctf_integer(unsigned int, nr_sector, blk_rq_sectors(rq))
821 ctf_integer(dev_t, old_dev, dev)
822 ctf_integer(sector_t, old_sector, from)
823 blk_rwbs_ctf_integer(unsigned int, rwbs,
824 rq->cmd_flags, blk_rq_bytes(rq))
825 )
826 )
827 #endif
828
829 #undef __print_rwbs_flags
830 #undef blk_fill_rwbs
831
832 #endif /* LTTNG_TRACE_BLOCK_H */
833
834 /* This part must be outside protection */
835 #include "../../../probes/define_trace.h"
836
This page took 0.052748 seconds and 4 git commands to generate.