Fix: adjust SLE version ranges to build with SP2 and SP3
[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
c122f936 36#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0) || \
818760e1
MJ
37 LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
38 LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
39 LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
40 LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,4,103,7,0,0) || \
41 LTTNG_SLE_KERNEL_RANGE(4,4,114,94,0,0, 4,4,114,95,0,0) || \
42 LTTNG_SLE_KERNEL_RANGE(4,4,120,94,0,0, 4,4,120,95,0,0) || \
43 LTTNG_SLE_KERNEL_RANGE(4,4,126,94,0,0, 4,5,0,0,0,0))
e6d2cc09
MD
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
e064edf1
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
e064edf1 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)
e064edf1 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 */
e064edf1
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)
e064edf1 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 */
e064edf1
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
e064edf1
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(
321e5e89
MD
621#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
622 ctf_integer(dev_t, dev, bio_dev(bio))
623#else
cc0c32f0 624 ctf_integer(dev_t, dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0)
321e5e89 625#endif
54c4c2e3 626#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
f127e61e
MD
627 ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
628 ctf_integer(unsigned int, nr_sector, bio_sectors(bio))
629 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09
MD
630 lttng_bio_op(bio), lttng_bio_rw(bio),
631 bio->bi_iter.bi_size)
54c4c2e3 632#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
633 ctf_integer(sector_t, sector, bio->bi_sector)
634 ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9)
635 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09
MD
636 lttng_bio_op(bio), lttng_bio_rw(bio),
637 bio->bi_size)
54c4c2e3 638#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
639 ctf_integer(pid_t, tid, current->pid)
640 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
641 )
f62b389e
MD
642)
643
644/**
645 * block_bio_complete - completed all work on the block operation
646 * @q: queue holding the block operation
647 * @bio: block operation completed
648 * @error: io error value
649 *
650 * This tracepoint indicates there is no further work to do on this
651 * block IO operation @bio.
652 */
3bc29f0a 653LTTNG_TRACEPOINT_EVENT(block_bio_complete,
f62b389e 654
1bc491fc 655#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
f62b389e
MD
656 TP_PROTO(struct request_queue *q, struct bio *bio, int error),
657
658 TP_ARGS(q, bio, error),
7c68b363
AG
659#else
660 TP_PROTO(struct request_queue *q, struct bio *bio),
661
662 TP_ARGS(q, bio),
663#endif
f62b389e 664
f127e61e 665 TP_FIELDS(
321e5e89
MD
666#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
667 ctf_integer(dev_t, dev, bio_dev(bio))
668#else
cc0c32f0 669 ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev)
321e5e89 670#endif
54c4c2e3 671#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
f127e61e
MD
672 ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
673 ctf_integer(unsigned int, nr_sector, bio_sectors(bio))
674 ctf_integer(int, error, error)
675 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09
MD
676 lttng_bio_op(bio), lttng_bio_rw(bio),
677 bio->bi_iter.bi_size)
54c4c2e3 678#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
679 ctf_integer(sector_t, sector, bio->bi_sector)
680 ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9)
7c68b363 681#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
f127e61e 682 ctf_integer(int, error, error)
7c68b363 683#else
f127e61e 684 ctf_integer(int, error, 0)
7c68b363 685#endif
f127e61e 686 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09 687 lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size)
54c4c2e3 688#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e 689 )
f62b389e
MD
690)
691
217f66c6 692#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
3bc29f0a 693LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge,
217f66c6
MD
694
695 TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
696
697 TP_ARGS(q, rq, bio),
698
f127e61e 699 TP_FIELDS(
321e5e89
MD
700#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
701 ctf_integer(dev_t, dev, bio_dev(bio))
702#else
cc0c32f0 703 ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev)
321e5e89 704#endif
54c4c2e3 705#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
f127e61e
MD
706 ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
707 ctf_integer(unsigned int, nr_sector, bio_sectors(bio))
708 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09
MD
709 lttng_bio_op(bio), lttng_bio_rw(bio),
710 bio->bi_iter.bi_size)
54c4c2e3 711#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
712 ctf_integer(sector_t, sector, bio->bi_sector)
713 ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9)
714 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09 715 lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size)
54c4c2e3 716#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
717 ctf_integer(pid_t, tid, current->pid)
718 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
719 )
217f66c6
MD
720)
721
722/**
723 * block_bio_backmerge - merging block operation to the end of an existing operation
724 * @q: queue holding operation
725 * @bio: new block operation to merge
726 *
727 * Merging block request @bio to the end of an existing block request
728 * in queue @q.
729 */
3bc29f0a 730LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge, block_bio_backmerge,
217f66c6
MD
731
732 TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
733
734 TP_ARGS(q, rq, bio)
735)
736
737/**
738 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
739 * @q: queue holding operation
740 * @bio: new block operation to merge
741 *
742 * Merging block IO operation @bio to the beginning of an existing block
743 * operation in queue @q.
744 */
3bc29f0a 745LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge, block_bio_frontmerge,
217f66c6
MD
746
747 TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
748
749 TP_ARGS(q, rq, bio)
750)
751
752/**
753 * block_bio_queue - putting new block IO operation in queue
754 * @q: queue holding operation
755 * @bio: new block operation
756 *
757 * About to place the block IO operation @bio into queue @q.
758 */
3bc29f0a 759LTTNG_TRACEPOINT_EVENT(block_bio_queue,
217f66c6
MD
760
761 TP_PROTO(struct request_queue *q, struct bio *bio),
762
763 TP_ARGS(q, bio),
764
f127e61e 765 TP_FIELDS(
321e5e89
MD
766#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
767 ctf_integer(dev_t, dev, bio_dev(bio))
768#else
cc0c32f0 769 ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev)
321e5e89 770#endif
54c4c2e3 771#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
f127e61e
MD
772 ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
773 ctf_integer(unsigned int, nr_sector, bio_sectors(bio))
774 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09
MD
775 lttng_bio_op(bio), lttng_bio_rw(bio),
776 bio->bi_iter.bi_size)
54c4c2e3 777#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
778 ctf_integer(sector_t, sector, bio->bi_sector)
779 ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9)
780 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09 781 lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size)
54c4c2e3 782#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
783 ctf_integer(pid_t, tid, current->pid)
784 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
785 )
217f66c6 786)
f127e61e 787#else /* if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
3bc29f0a 788LTTNG_TRACEPOINT_EVENT_CLASS(block_bio,
f62b389e
MD
789
790 TP_PROTO(struct request_queue *q, struct bio *bio),
791
792 TP_ARGS(q, bio),
793
f127e61e 794 TP_FIELDS(
cc0c32f0 795 ctf_integer(dev_t, dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0)
f127e61e
MD
796 ctf_integer(sector_t, sector, bio->bi_sector)
797 ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9)
798 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09 799 lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size)
f127e61e
MD
800 ctf_integer(pid_t, tid, current->pid)
801 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
802 )
f62b389e
MD
803)
804
805/**
806 * block_bio_backmerge - merging block operation to the end of an existing operation
807 * @q: queue holding operation
808 * @bio: new block operation to merge
809 *
810 * Merging block request @bio to the end of an existing block request
811 * in queue @q.
812 */
3bc29f0a 813LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_backmerge,
f62b389e
MD
814
815 TP_PROTO(struct request_queue *q, struct bio *bio),
816
817 TP_ARGS(q, bio)
818)
819
820/**
821 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
822 * @q: queue holding operation
823 * @bio: new block operation to merge
824 *
825 * Merging block IO operation @bio to the beginning of an existing block
826 * operation in queue @q.
827 */
3bc29f0a 828LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_frontmerge,
f62b389e
MD
829
830 TP_PROTO(struct request_queue *q, struct bio *bio),
831
832 TP_ARGS(q, bio)
833)
834
835/**
836 * block_bio_queue - putting new block IO operation in queue
837 * @q: queue holding operation
838 * @bio: new block operation
839 *
840 * About to place the block IO operation @bio into queue @q.
841 */
3bc29f0a 842LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_queue,
f62b389e
MD
843
844 TP_PROTO(struct request_queue *q, struct bio *bio),
845
846 TP_ARGS(q, bio)
847)
f127e61e 848#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
f62b389e 849
3bc29f0a 850LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq,
f62b389e
MD
851
852 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
853
854 TP_ARGS(q, bio, rw),
855
f127e61e 856 TP_FIELDS(
321e5e89 857#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
007272b3 858 ctf_integer(dev_t, dev, bio ? bio_dev(bio) : 0)
321e5e89 859#else
cc0c32f0 860 ctf_integer(dev_t, dev, bio ? bio->bi_bdev->bd_dev : 0)
321e5e89 861#endif
54c4c2e3 862#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
f127e61e
MD
863 ctf_integer(sector_t, sector, bio ? bio->bi_iter.bi_sector : 0)
864 ctf_integer(unsigned int, nr_sector,
865 bio ? bio_sectors(bio) : 0)
866 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09
MD
867 bio ? lttng_bio_op(bio) : 0,
868 bio ? lttng_bio_rw(bio) : 0,
f127e61e 869 bio ? bio->bi_iter.bi_size : 0)
54c4c2e3 870#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
871 ctf_integer(sector_t, sector, bio ? bio->bi_sector : 0)
872 ctf_integer(unsigned int, nr_sector,
873 bio ? bio->bi_size >> 9 : 0)
874 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09
MD
875 bio ? lttng_bio_op(bio) : 0,
876 bio ? lttng_bio_rw(bio) : 0,
f127e61e 877 bio ? bio->bi_size : 0)
54c4c2e3 878#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
879 ctf_integer(pid_t, tid, current->pid)
880 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
881 )
f62b389e
MD
882)
883
884/**
885 * block_getrq - get a free request entry in queue for block IO operations
886 * @q: queue for operations
007272b3 887 * @bio: pending block IO operation (can be %NULL)
f62b389e
MD
888 * @rw: low bit indicates a read (%0) or a write (%1)
889 *
890 * A request struct for queue @q has been allocated to handle the
891 * block IO operation @bio.
892 */
3bc29f0a 893LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq, block_getrq,
f62b389e
MD
894
895 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
896
897 TP_ARGS(q, bio, rw)
898)
899
900/**
901 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
902 * @q: queue for operation
007272b3 903 * @bio: pending block IO operation (can be %NULL)
f62b389e
MD
904 * @rw: low bit indicates a read (%0) or a write (%1)
905 *
906 * In the case where a request struct cannot be provided for queue @q
907 * the process needs to wait for an request struct to become
908 * available. This tracepoint event is generated each time the
909 * process goes to sleep waiting for request struct become available.
910 */
3bc29f0a 911LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq, block_sleeprq,
f62b389e
MD
912
913 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
914
915 TP_ARGS(q, bio, rw)
916)
917
918/**
919 * block_plug - keep operations requests in request queue
920 * @q: request queue to plug
921 *
922 * Plug the request queue @q. Do not allow block operation requests
923 * to be sent to the device driver. Instead, accumulate requests in
924 * the queue to improve throughput performance of the block device.
925 */
3bc29f0a 926LTTNG_TRACEPOINT_EVENT(block_plug,
f62b389e
MD
927
928 TP_PROTO(struct request_queue *q),
929
930 TP_ARGS(q),
931
f127e61e
MD
932 TP_FIELDS(
933 ctf_integer(pid_t, tid, current->pid)
934 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
935 )
f62b389e
MD
936)
937
3bc29f0a 938LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug,
f62b389e 939
7c68b363 940#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
f62b389e
MD
941 TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit),
942
943 TP_ARGS(q, depth, explicit),
7c68b363
AG
944#else
945 TP_PROTO(struct request_queue *q),
946
947 TP_ARGS(q),
948#endif
f62b389e 949
f127e61e 950 TP_FIELDS(
7c68b363 951#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
f127e61e 952 ctf_integer(int, nr_rq, depth)
7c68b363 953#else
f127e61e 954 ctf_integer(int, nr_rq, q->rq.count[READ] + q->rq.count[WRITE])
7c68b363 955#endif
f127e61e
MD
956 ctf_integer(pid_t, tid, current->pid)
957 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
958 )
f62b389e
MD
959)
960
7c68b363
AG
961#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
962/**
963 * block_unplug_timer - timed release of operations requests in queue to device driver
964 * @q: request queue to unplug
965 *
966 * Unplug the request queue @q because a timer expired and allow block
967 * operation requests to be sent to the device driver.
968 */
3bc29f0a 969LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug, block_unplug_timer,
7c68b363
AG
970
971 TP_PROTO(struct request_queue *q),
972
973 TP_ARGS(q)
974)
975#endif
976
f62b389e
MD
977/**
978 * block_unplug - release of operations requests in request queue
979 * @q: request queue to unplug
980 * @depth: number of requests just added to the queue
981 * @explicit: whether this was an explicit unplug, or one from schedule()
982 *
983 * Unplug request queue @q because device driver is scheduled to work
984 * on elements in the request queue.
985 */
7c68b363 986#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
3bc29f0a 987LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug, block_unplug,
7c68b363 988#else
3bc29f0a 989LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug, block_unplug_io,
7c68b363 990#endif
f62b389e 991
7c68b363 992#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
f62b389e
MD
993 TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit),
994
995 TP_ARGS(q, depth, explicit)
7c68b363
AG
996#else
997 TP_PROTO(struct request_queue *q),
998
999 TP_ARGS(q)
1000#endif
f62b389e
MD
1001)
1002
1003/**
1004 * block_split - split a single bio struct into two bio structs
1005 * @q: queue containing the bio
1006 * @bio: block operation being split
1007 * @new_sector: The starting sector for the new bio
1008 *
1009 * The bio request @bio in request queue @q needs to be split into two
1010 * bio requests. The newly created @bio request starts at
1011 * @new_sector. This split may be required due to hardware limitation
1012 * such as operation crossing device boundaries in a RAID system.
1013 */
3bc29f0a 1014LTTNG_TRACEPOINT_EVENT(block_split,
f62b389e
MD
1015
1016 TP_PROTO(struct request_queue *q, struct bio *bio,
1017 unsigned int new_sector),
1018
1019 TP_ARGS(q, bio, new_sector),
1020
f127e61e 1021 TP_FIELDS(
321e5e89
MD
1022#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
1023 ctf_integer(dev_t, dev, bio_dev(bio))
1024#else
cc0c32f0 1025 ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev)
321e5e89 1026#endif
54c4c2e3 1027#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
f127e61e
MD
1028 ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
1029 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09
MD
1030 lttng_bio_op(bio), lttng_bio_rw(bio),
1031 bio->bi_iter.bi_size)
54c4c2e3 1032#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
1033 ctf_integer(sector_t, sector, bio->bi_sector)
1034 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09 1035 lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size)
54c4c2e3 1036#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
1037 ctf_integer(sector_t, new_sector, new_sector)
1038 ctf_integer(pid_t, tid, current->pid)
1039 ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
1040 )
f62b389e
MD
1041)
1042
1043/**
1044 * block_bio_remap - map request for a logical device to the raw device
1045 * @q: queue holding the operation
1046 * @bio: revised operation
1047 * @dev: device for the operation
1048 * @from: original sector for the operation
1049 *
1050 * An operation for a logical device has been mapped to the
1051 * raw block device.
1052 */
7c68b363 1053#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
3bc29f0a 1054LTTNG_TRACEPOINT_EVENT(block_bio_remap,
7c68b363 1055#else
3bc29f0a 1056LTTNG_TRACEPOINT_EVENT(block_remap,
7c68b363 1057#endif
f62b389e
MD
1058
1059 TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev,
1060 sector_t from),
1061
1062 TP_ARGS(q, bio, dev, from),
1063
f127e61e 1064 TP_FIELDS(
321e5e89
MD
1065#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
1066 ctf_integer(dev_t, dev, bio_dev(bio))
1067#else
cc0c32f0 1068 ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev)
321e5e89 1069#endif
54c4c2e3 1070#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
f127e61e
MD
1071 ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
1072 ctf_integer(unsigned int, nr_sector, bio_sectors(bio))
1073 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09
MD
1074 lttng_bio_op(bio), lttng_bio_rw(bio),
1075 bio->bi_iter.bi_size)
54c4c2e3 1076#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
1077 ctf_integer(sector_t, sector, bio->bi_sector)
1078 ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9)
1079 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09 1080 lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size)
54c4c2e3 1081#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
f127e61e
MD
1082 ctf_integer(dev_t, old_dev, dev)
1083 ctf_integer(sector_t, old_sector, from)
1084 )
f62b389e
MD
1085)
1086
7c68b363 1087#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
f62b389e
MD
1088/**
1089 * block_rq_remap - map request for a block operation request
1090 * @q: queue holding the operation
1091 * @rq: block IO operation request
1092 * @dev: device for the operation
1093 * @from: original sector for the operation
1094 *
1095 * The block operation request @rq in @q has been remapped. The block
1096 * operation request @rq holds the current information and @from hold
1097 * the original sector.
1098 */
3bc29f0a 1099LTTNG_TRACEPOINT_EVENT(block_rq_remap,
f62b389e
MD
1100
1101 TP_PROTO(struct request_queue *q, struct request *rq, dev_t dev,
1102 sector_t from),
1103
1104 TP_ARGS(q, rq, dev, from),
1105
f127e61e
MD
1106 TP_FIELDS(
1107 ctf_integer(dev_t, dev, disk_devt(rq->rq_disk))
1108 ctf_integer(sector_t, sector, blk_rq_pos(rq))
1109 ctf_integer(unsigned int, nr_sector, blk_rq_sectors(rq))
1110 ctf_integer(dev_t, old_dev, dev)
1111 ctf_integer(sector_t, old_sector, from)
1112 blk_rwbs_ctf_integer(unsigned int, rwbs,
e6d2cc09 1113 lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq))
f127e61e 1114 )
f62b389e 1115)
7c68b363 1116#endif
f62b389e
MD
1117
1118#undef __print_rwbs_flags
1119#undef blk_fill_rwbs
1120
3bc29f0a 1121#endif /* LTTNG_TRACE_BLOCK_H */
f62b389e
MD
1122
1123/* This part must be outside protection */
6ec43db8 1124#include <probes/define_trace.h>
This page took 0.084018 seconds and 4 git commands to generate.