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