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