| 1 | #undef TRACE_SYSTEM |
| 2 | #define TRACE_SYSTEM block |
| 3 | |
| 4 | #if !defined(LTTNG_TRACE_BLOCK_H) || defined(TRACE_HEADER_MULTI_READ) |
| 5 | #define LTTNG_TRACE_BLOCK_H |
| 6 | |
| 7 | #include <probes/lttng-tracepoint-event.h> |
| 8 | #include <linux/blktrace_api.h> |
| 9 | #include <linux/blkdev.h> |
| 10 | #include <linux/trace_seq.h> |
| 11 | #include <linux/version.h> |
| 12 | |
| 13 | #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 | |
| 17 | #ifndef _TRACE_BLOCK_DEF_ |
| 18 | #define _TRACE_BLOCK_DEF_ |
| 19 | |
| 20 | enum { |
| 21 | RWBS_FLAG_WRITE = (1 << 0), |
| 22 | RWBS_FLAG_DISCARD = (1 << 1), |
| 23 | RWBS_FLAG_READ = (1 << 2), |
| 24 | RWBS_FLAG_RAHEAD = (1 << 3), |
| 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), |
| 31 | RWBS_FLAG_PREFLUSH = (1 << 10), |
| 32 | }; |
| 33 | |
| 34 | #endif /* _TRACE_BLOCK_DEF_ */ |
| 35 | |
| 36 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0) || \ |
| 37 | LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,114,92,0,0)) |
| 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)) |
| 59 | |
| 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) \ |
| 66 | ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ |
| 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 | |
| 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) \ |
| 85 | ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ |
| 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 | |
| 94 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) |
| 95 | |
| 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) \ |
| 102 | ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ |
| 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 | |
| 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) \ |
| 120 | ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ |
| 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 | |
| 131 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 132 | LTTNG_TRACEPOINT_EVENT_CLASS(block_buffer, |
| 133 | |
| 134 | TP_PROTO(struct buffer_head *bh), |
| 135 | |
| 136 | TP_ARGS(bh), |
| 137 | |
| 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) |
| 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 | */ |
| 151 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer, block_touch_buffer, |
| 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 | */ |
| 164 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer, block_dirty_buffer, |
| 165 | |
| 166 | TP_PROTO(struct buffer_head *bh), |
| 167 | |
| 168 | TP_ARGS(bh) |
| 169 | ) |
| 170 | #endif |
| 171 | |
| 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)) |
| 175 | LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error, |
| 176 | |
| 177 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 178 | |
| 179 | TP_ARGS(q, rq), |
| 180 | |
| 181 | TP_locvar( |
| 182 | sector_t sector; |
| 183 | unsigned int nr_sector; |
| 184 | unsigned char *cmd; |
| 185 | size_t cmd_len; |
| 186 | ), |
| 187 | |
| 188 | TP_code_pre( |
| 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)) */ |
| 218 | LTTNG_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 | |
| 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 | } |
| 244 | ), |
| 245 | |
| 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, |
| 253 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) |
| 254 | ctf_sequence_hex(unsigned char, cmd, |
| 255 | tp_locvar->cmd, size_t, tp_locvar->cmd_len) |
| 256 | ), |
| 257 | |
| 258 | TP_code_post() |
| 259 | ) |
| 260 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */ |
| 261 | |
| 262 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0)) |
| 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 | */ |
| 273 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_abort, |
| 274 | |
| 275 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 276 | |
| 277 | TP_ARGS(q, rq) |
| 278 | ) |
| 279 | #endif |
| 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 | */ |
| 290 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)) |
| 291 | LTTNG_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 |
| 307 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_requeue, |
| 308 | |
| 309 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 310 | |
| 311 | TP_ARGS(q, rq) |
| 312 | ) |
| 313 | #endif |
| 314 | |
| 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 | */ |
| 327 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)) |
| 328 | LTTNG_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)) |
| 345 | LTTNG_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 | |
| 390 | LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete, |
| 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 | |
| 397 | TP_locvar( |
| 398 | unsigned char *cmd; |
| 399 | size_t cmd_len; |
| 400 | ), |
| 401 | |
| 402 | TP_code_pre( |
| 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 | } |
| 410 | ), |
| 411 | |
| 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, |
| 419 | lttng_req_op(rq), lttng_req_rw(rq), nr_bytes) |
| 420 | ctf_sequence_hex(unsigned char, cmd, |
| 421 | tp_locvar->cmd, size_t, tp_locvar->cmd_len) |
| 422 | ), |
| 423 | |
| 424 | TP_code_post() |
| 425 | ) |
| 426 | |
| 427 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */ |
| 428 | |
| 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 | */ |
| 440 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_complete, |
| 441 | |
| 442 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 443 | |
| 444 | TP_ARGS(q, rq) |
| 445 | ) |
| 446 | |
| 447 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */ |
| 448 | |
| 449 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)) |
| 450 | LTTNG_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)) |
| 469 | LTTNG_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)) */ |
| 517 | LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq, |
| 518 | |
| 519 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 520 | |
| 521 | TP_ARGS(q, rq), |
| 522 | |
| 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; |
| 529 | ), |
| 530 | |
| 531 | TP_code_pre( |
| 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 | } |
| 545 | ), |
| 546 | |
| 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, |
| 555 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) |
| 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) |
| 559 | ), |
| 560 | |
| 561 | TP_code_post() |
| 562 | ) |
| 563 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */ |
| 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 | */ |
| 575 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_insert, |
| 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 | */ |
| 590 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_issue, |
| 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 | */ |
| 608 | LTTNG_TRACEPOINT_EVENT(block_bio_bounce, |
| 609 | |
| 610 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 611 | |
| 612 | TP_ARGS(q, bio), |
| 613 | |
| 614 | TP_FIELDS( |
| 615 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)) |
| 616 | ctf_integer(dev_t, dev, bio_dev(bio)) |
| 617 | #else |
| 618 | ctf_integer(dev_t, dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0) |
| 619 | #endif |
| 620 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 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, |
| 624 | lttng_bio_op(bio), lttng_bio_rw(bio), |
| 625 | bio->bi_iter.bi_size) |
| 626 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
| 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, |
| 630 | lttng_bio_op(bio), lttng_bio_rw(bio), |
| 631 | bio->bi_size) |
| 632 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
| 633 | ctf_integer(pid_t, tid, current->pid) |
| 634 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 635 | ) |
| 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 | */ |
| 647 | LTTNG_TRACEPOINT_EVENT(block_bio_complete, |
| 648 | |
| 649 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 650 | TP_PROTO(struct request_queue *q, struct bio *bio, int error), |
| 651 | |
| 652 | TP_ARGS(q, bio, error), |
| 653 | #else |
| 654 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 655 | |
| 656 | TP_ARGS(q, bio), |
| 657 | #endif |
| 658 | |
| 659 | TP_FIELDS( |
| 660 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)) |
| 661 | ctf_integer(dev_t, dev, bio_dev(bio)) |
| 662 | #else |
| 663 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
| 664 | #endif |
| 665 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 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, |
| 670 | lttng_bio_op(bio), lttng_bio_rw(bio), |
| 671 | bio->bi_iter.bi_size) |
| 672 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
| 673 | ctf_integer(sector_t, sector, bio->bi_sector) |
| 674 | ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) |
| 675 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 676 | ctf_integer(int, error, error) |
| 677 | #else |
| 678 | ctf_integer(int, error, 0) |
| 679 | #endif |
| 680 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 681 | lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size) |
| 682 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
| 683 | ) |
| 684 | ) |
| 685 | |
| 686 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 687 | LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge, |
| 688 | |
| 689 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), |
| 690 | |
| 691 | TP_ARGS(q, rq, bio), |
| 692 | |
| 693 | TP_FIELDS( |
| 694 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)) |
| 695 | ctf_integer(dev_t, dev, bio_dev(bio)) |
| 696 | #else |
| 697 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
| 698 | #endif |
| 699 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 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, |
| 703 | lttng_bio_op(bio), lttng_bio_rw(bio), |
| 704 | bio->bi_iter.bi_size) |
| 705 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
| 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, |
| 709 | lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size) |
| 710 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
| 711 | ctf_integer(pid_t, tid, current->pid) |
| 712 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 713 | ) |
| 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 | */ |
| 724 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge, block_bio_backmerge, |
| 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 | */ |
| 739 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge, block_bio_frontmerge, |
| 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 | */ |
| 753 | LTTNG_TRACEPOINT_EVENT(block_bio_queue, |
| 754 | |
| 755 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 756 | |
| 757 | TP_ARGS(q, bio), |
| 758 | |
| 759 | TP_FIELDS( |
| 760 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)) |
| 761 | ctf_integer(dev_t, dev, bio_dev(bio)) |
| 762 | #else |
| 763 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
| 764 | #endif |
| 765 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 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, |
| 769 | lttng_bio_op(bio), lttng_bio_rw(bio), |
| 770 | bio->bi_iter.bi_size) |
| 771 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
| 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, |
| 775 | lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size) |
| 776 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
| 777 | ctf_integer(pid_t, tid, current->pid) |
| 778 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 779 | ) |
| 780 | ) |
| 781 | #else /* if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */ |
| 782 | LTTNG_TRACEPOINT_EVENT_CLASS(block_bio, |
| 783 | |
| 784 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 785 | |
| 786 | TP_ARGS(q, bio), |
| 787 | |
| 788 | TP_FIELDS( |
| 789 | ctf_integer(dev_t, dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0) |
| 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, |
| 793 | lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size) |
| 794 | ctf_integer(pid_t, tid, current->pid) |
| 795 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 796 | ) |
| 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 | */ |
| 807 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_backmerge, |
| 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 | */ |
| 822 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_frontmerge, |
| 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 | */ |
| 836 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_queue, |
| 837 | |
| 838 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 839 | |
| 840 | TP_ARGS(q, bio) |
| 841 | ) |
| 842 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */ |
| 843 | |
| 844 | LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq, |
| 845 | |
| 846 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), |
| 847 | |
| 848 | TP_ARGS(q, bio, rw), |
| 849 | |
| 850 | TP_FIELDS( |
| 851 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)) |
| 852 | ctf_integer(dev_t, dev, bio ? bio_dev(bio) : 0) |
| 853 | #else |
| 854 | ctf_integer(dev_t, dev, bio ? bio->bi_bdev->bd_dev : 0) |
| 855 | #endif |
| 856 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 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, |
| 861 | bio ? lttng_bio_op(bio) : 0, |
| 862 | bio ? lttng_bio_rw(bio) : 0, |
| 863 | bio ? bio->bi_iter.bi_size : 0) |
| 864 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
| 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, |
| 869 | bio ? lttng_bio_op(bio) : 0, |
| 870 | bio ? lttng_bio_rw(bio) : 0, |
| 871 | bio ? bio->bi_size : 0) |
| 872 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
| 873 | ctf_integer(pid_t, tid, current->pid) |
| 874 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 875 | ) |
| 876 | ) |
| 877 | |
| 878 | /** |
| 879 | * block_getrq - get a free request entry in queue for block IO operations |
| 880 | * @q: queue for operations |
| 881 | * @bio: pending block IO operation (can be %NULL) |
| 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 | */ |
| 887 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq, block_getrq, |
| 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 |
| 897 | * @bio: pending block IO operation (can be %NULL) |
| 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 | */ |
| 905 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq, block_sleeprq, |
| 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 | */ |
| 920 | LTTNG_TRACEPOINT_EVENT(block_plug, |
| 921 | |
| 922 | TP_PROTO(struct request_queue *q), |
| 923 | |
| 924 | TP_ARGS(q), |
| 925 | |
| 926 | TP_FIELDS( |
| 927 | ctf_integer(pid_t, tid, current->pid) |
| 928 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 929 | ) |
| 930 | ) |
| 931 | |
| 932 | LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug, |
| 933 | |
| 934 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) |
| 935 | TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit), |
| 936 | |
| 937 | TP_ARGS(q, depth, explicit), |
| 938 | #else |
| 939 | TP_PROTO(struct request_queue *q), |
| 940 | |
| 941 | TP_ARGS(q), |
| 942 | #endif |
| 943 | |
| 944 | TP_FIELDS( |
| 945 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) |
| 946 | ctf_integer(int, nr_rq, depth) |
| 947 | #else |
| 948 | ctf_integer(int, nr_rq, q->rq.count[READ] + q->rq.count[WRITE]) |
| 949 | #endif |
| 950 | ctf_integer(pid_t, tid, current->pid) |
| 951 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 952 | ) |
| 953 | ) |
| 954 | |
| 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 | */ |
| 963 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug, block_unplug_timer, |
| 964 | |
| 965 | TP_PROTO(struct request_queue *q), |
| 966 | |
| 967 | TP_ARGS(q) |
| 968 | ) |
| 969 | #endif |
| 970 | |
| 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 | */ |
| 980 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) |
| 981 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug, block_unplug, |
| 982 | #else |
| 983 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug, block_unplug_io, |
| 984 | #endif |
| 985 | |
| 986 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) |
| 987 | TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit), |
| 988 | |
| 989 | TP_ARGS(q, depth, explicit) |
| 990 | #else |
| 991 | TP_PROTO(struct request_queue *q), |
| 992 | |
| 993 | TP_ARGS(q) |
| 994 | #endif |
| 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 | */ |
| 1008 | LTTNG_TRACEPOINT_EVENT(block_split, |
| 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 | |
| 1015 | TP_FIELDS( |
| 1016 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)) |
| 1017 | ctf_integer(dev_t, dev, bio_dev(bio)) |
| 1018 | #else |
| 1019 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
| 1020 | #endif |
| 1021 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 1022 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
| 1023 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 1024 | lttng_bio_op(bio), lttng_bio_rw(bio), |
| 1025 | bio->bi_iter.bi_size) |
| 1026 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
| 1027 | ctf_integer(sector_t, sector, bio->bi_sector) |
| 1028 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 1029 | lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size) |
| 1030 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
| 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 | ) |
| 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 | */ |
| 1047 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 1048 | LTTNG_TRACEPOINT_EVENT(block_bio_remap, |
| 1049 | #else |
| 1050 | LTTNG_TRACEPOINT_EVENT(block_remap, |
| 1051 | #endif |
| 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 | |
| 1058 | TP_FIELDS( |
| 1059 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)) |
| 1060 | ctf_integer(dev_t, dev, bio_dev(bio)) |
| 1061 | #else |
| 1062 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
| 1063 | #endif |
| 1064 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 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, |
| 1068 | lttng_bio_op(bio), lttng_bio_rw(bio), |
| 1069 | bio->bi_iter.bi_size) |
| 1070 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
| 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, |
| 1074 | lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size) |
| 1075 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ |
| 1076 | ctf_integer(dev_t, old_dev, dev) |
| 1077 | ctf_integer(sector_t, old_sector, from) |
| 1078 | ) |
| 1079 | ) |
| 1080 | |
| 1081 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) |
| 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 | */ |
| 1093 | LTTNG_TRACEPOINT_EVENT(block_rq_remap, |
| 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 | |
| 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, |
| 1107 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) |
| 1108 | ) |
| 1109 | ) |
| 1110 | #endif |
| 1111 | |
| 1112 | #undef __print_rwbs_flags |
| 1113 | #undef blk_fill_rwbs |
| 1114 | |
| 1115 | #endif /* LTTNG_TRACE_BLOCK_H */ |
| 1116 | |
| 1117 | /* This part must be outside protection */ |
| 1118 | #include <probes/define_trace.h> |