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