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