| 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #undef TRACE_SYSTEM |
| 3 | #define TRACE_SYSTEM block |
| 4 | |
| 5 | #if !defined(LTTNG_TRACE_BLOCK_H) || defined(TRACE_HEADER_MULTI_READ) |
| 6 | #define LTTNG_TRACE_BLOCK_H |
| 7 | |
| 8 | #include <probes/lttng-tracepoint-event.h> |
| 9 | #include <linux/blktrace_api.h> |
| 10 | #include <linux/blkdev.h> |
| 11 | #include <linux/trace_seq.h> |
| 12 | #include <lttng-kernel-version.h> |
| 13 | |
| 14 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) |
| 15 | #include <scsi/scsi_request.h> |
| 16 | #endif /* (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */ |
| 17 | |
| 18 | #ifndef _TRACE_BLOCK_DEF_ |
| 19 | #define _TRACE_BLOCK_DEF_ |
| 20 | |
| 21 | enum { |
| 22 | RWBS_FLAG_WRITE = (1 << 0), |
| 23 | RWBS_FLAG_DISCARD = (1 << 1), |
| 24 | RWBS_FLAG_READ = (1 << 2), |
| 25 | RWBS_FLAG_RAHEAD = (1 << 3), |
| 26 | RWBS_FLAG_BARRIER = (1 << 4), |
| 27 | RWBS_FLAG_SYNC = (1 << 5), |
| 28 | RWBS_FLAG_META = (1 << 6), |
| 29 | RWBS_FLAG_SECURE = (1 << 7), |
| 30 | RWBS_FLAG_FLUSH = (1 << 8), |
| 31 | RWBS_FLAG_FUA = (1 << 9), |
| 32 | RWBS_FLAG_PREFLUSH = (1 << 10), |
| 33 | }; |
| 34 | |
| 35 | #endif /* _TRACE_BLOCK_DEF_ */ |
| 36 | |
| 37 | #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM |
| 38 | LTTNG_TRACEPOINT_ENUM(block_rq_type, |
| 39 | TP_ENUM_VALUES( |
| 40 | ctf_enum_value("RWBS_FLAG_WRITE", RWBS_FLAG_WRITE) |
| 41 | ctf_enum_value("RWBS_FLAG_DISCARD", RWBS_FLAG_DISCARD) |
| 42 | ctf_enum_value("RWBS_FLAG_READ", RWBS_FLAG_READ) |
| 43 | ctf_enum_value("RWBS_FLAG_RAHEAD", RWBS_FLAG_RAHEAD) |
| 44 | ctf_enum_value("RWBS_FLAG_BARRIER", RWBS_FLAG_BARRIER) |
| 45 | ctf_enum_value("RWBS_FLAG_SYNC", RWBS_FLAG_SYNC) |
| 46 | ctf_enum_value("RWBS_FLAG_META", RWBS_FLAG_META) |
| 47 | ctf_enum_value("RWBS_FLAG_SECURE", RWBS_FLAG_SECURE) |
| 48 | ctf_enum_value("RWBS_FLAG_FLUSH", RWBS_FLAG_FLUSH) |
| 49 | ctf_enum_value("RWBS_FLAG_FUA", RWBS_FLAG_FUA) |
| 50 | ctf_enum_value("RWBS_FLAG_PREFLUSH", RWBS_FLAG_PREFLUSH) |
| 51 | ) |
| 52 | ) |
| 53 | #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */ |
| 54 | |
| 55 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,8,0) || \ |
| 56 | LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \ |
| 57 | LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \ |
| 58 | LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \ |
| 59 | LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,4,103,7,0,0) || \ |
| 60 | LTTNG_SLE_KERNEL_RANGE(4,4,114,94,0,0, 4,4,114,95,0,0) || \ |
| 61 | LTTNG_SLE_KERNEL_RANGE(4,4,120,94,0,0, 4,4,120,95,0,0) || \ |
| 62 | LTTNG_SLE_KERNEL_RANGE(4,4,126,94,0,0, 4,5,0,0,0,0)) |
| 63 | |
| 64 | #define lttng_req_op(rq) req_op(rq) |
| 65 | #define lttng_req_rw(rq) ((rq)->cmd_flags) |
| 66 | #define lttng_bio_op(bio) bio_op(bio) |
| 67 | #define lttng_bio_rw(bio) ((bio)->bi_opf) |
| 68 | |
| 69 | #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM |
| 70 | #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \ |
| 71 | ctf_enum(block_rq_type, type, rwbs, \ |
| 72 | (((op) == REQ_OP_WRITE || (op) == REQ_OP_WRITE_SAME) ? RWBS_FLAG_WRITE : \ |
| 73 | ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \ |
| 74 | ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \ |
| 75 | ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \ |
| 76 | ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \ |
| 77 | ( 0 )))))) \ |
| 78 | | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \ |
| 79 | | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \ |
| 80 | | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \ |
| 81 | | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \ |
| 82 | | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0)) |
| 83 | #else |
| 84 | #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \ |
| 85 | ctf_integer(type, rwbs, \ |
| 86 | (((op) == REQ_OP_WRITE || (op) == REQ_OP_WRITE_SAME) ? RWBS_FLAG_WRITE : \ |
| 87 | ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \ |
| 88 | ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \ |
| 89 | ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \ |
| 90 | ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \ |
| 91 | ( 0 )))))) \ |
| 92 | | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \ |
| 93 | | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \ |
| 94 | | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \ |
| 95 | | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \ |
| 96 | | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0)) |
| 97 | #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */ |
| 98 | |
| 99 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,1,0)) |
| 100 | |
| 101 | #define lttng_req_op(rq) |
| 102 | #define lttng_req_rw(rq) ((rq)->cmd_flags) |
| 103 | #define lttng_bio_op(bio) |
| 104 | #define lttng_bio_rw(bio) ((bio)->bi_rw) |
| 105 | |
| 106 | #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM |
| 107 | #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \ |
| 108 | ctf_enum(block_rq_type, type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ |
| 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_SYNC ? RWBS_FLAG_SYNC : 0) \ |
| 114 | | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \ |
| 115 | | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \ |
| 116 | | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \ |
| 117 | | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0)) |
| 118 | #else |
| 119 | #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \ |
| 120 | ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ |
| 121 | ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \ |
| 122 | ( (bytes) ? RWBS_FLAG_READ : \ |
| 123 | ( 0 )))) \ |
| 124 | | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \ |
| 125 | | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \ |
| 126 | | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \ |
| 127 | | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \ |
| 128 | | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \ |
| 129 | | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0)) |
| 130 | #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */ |
| 131 | |
| 132 | #else |
| 133 | |
| 134 | #define lttng_req_op(rq) |
| 135 | #define lttng_req_rw(rq) ((rq)->cmd_flags) |
| 136 | #define lttng_bio_op(bio) |
| 137 | #define lttng_bio_rw(bio) ((bio)->bi_rw) |
| 138 | |
| 139 | #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM |
| 140 | #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \ |
| 141 | ctf_enum(block_rq_type, type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ |
| 142 | ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \ |
| 143 | ( (bytes) ? RWBS_FLAG_READ : \ |
| 144 | ( 0 )))) \ |
| 145 | | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \ |
| 146 | | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \ |
| 147 | | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \ |
| 148 | | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0)) |
| 149 | #else |
| 150 | #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \ |
| 151 | ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ |
| 152 | ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \ |
| 153 | ( (bytes) ? RWBS_FLAG_READ : \ |
| 154 | ( 0 )))) \ |
| 155 | | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \ |
| 156 | | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \ |
| 157 | | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \ |
| 158 | | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0)) |
| 159 | #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */ |
| 160 | |
| 161 | #endif |
| 162 | |
| 163 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) |
| 164 | LTTNG_TRACEPOINT_EVENT_CLASS(block_buffer, |
| 165 | |
| 166 | TP_PROTO(struct buffer_head *bh), |
| 167 | |
| 168 | TP_ARGS(bh), |
| 169 | |
| 170 | TP_FIELDS ( |
| 171 | ctf_integer(dev_t, dev, bh->b_bdev->bd_dev) |
| 172 | ctf_integer(sector_t, sector, bh->b_blocknr) |
| 173 | ctf_integer(size_t, size, bh->b_size) |
| 174 | ) |
| 175 | ) |
| 176 | |
| 177 | /** |
| 178 | * block_touch_buffer - mark a buffer accessed |
| 179 | * @bh: buffer_head being touched |
| 180 | * |
| 181 | * Called from touch_buffer(). |
| 182 | */ |
| 183 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer, block_touch_buffer, |
| 184 | |
| 185 | TP_PROTO(struct buffer_head *bh), |
| 186 | |
| 187 | TP_ARGS(bh) |
| 188 | ) |
| 189 | |
| 190 | /** |
| 191 | * block_dirty_buffer - mark a buffer dirty |
| 192 | * @bh: buffer_head being dirtied |
| 193 | * |
| 194 | * Called from mark_buffer_dirty(). |
| 195 | */ |
| 196 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_buffer, block_dirty_buffer, |
| 197 | |
| 198 | TP_PROTO(struct buffer_head *bh), |
| 199 | |
| 200 | TP_ARGS(bh) |
| 201 | ) |
| 202 | #endif |
| 203 | |
| 204 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0)) |
| 205 | /* block_rq_with_error event class removed in kernel 4.12 */ |
| 206 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) |
| 207 | LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error, |
| 208 | |
| 209 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 210 | |
| 211 | TP_ARGS(q, rq), |
| 212 | |
| 213 | TP_locvar( |
| 214 | sector_t sector; |
| 215 | unsigned int nr_sector; |
| 216 | unsigned char *cmd; |
| 217 | size_t cmd_len; |
| 218 | ), |
| 219 | |
| 220 | TP_code_pre( |
| 221 | if (blk_rq_is_scsi(rq)) { |
| 222 | struct scsi_request *scsi_rq = scsi_req(rq); |
| 223 | tp_locvar->sector = 0; |
| 224 | tp_locvar->nr_sector = 0; |
| 225 | tp_locvar->cmd = scsi_rq->cmd; |
| 226 | tp_locvar->cmd_len = scsi_rq->cmd_len; |
| 227 | } else { |
| 228 | tp_locvar->sector = blk_rq_pos(rq); |
| 229 | tp_locvar->nr_sector = blk_rq_sectors(rq); |
| 230 | tp_locvar->cmd = NULL; |
| 231 | tp_locvar->cmd_len = 0; |
| 232 | } |
| 233 | ), |
| 234 | |
| 235 | TP_FIELDS( |
| 236 | ctf_integer(dev_t, dev, |
| 237 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) |
| 238 | ctf_integer(sector_t, sector, tp_locvar->sector) |
| 239 | ctf_integer(unsigned int, nr_sector, tp_locvar->nr_sector) |
| 240 | ctf_integer(int, errors, rq->errors) |
| 241 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 242 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) |
| 243 | ctf_sequence_hex(unsigned char, cmd, |
| 244 | tp_locvar->cmd, size_t, tp_locvar->cmd_len) |
| 245 | ), |
| 246 | |
| 247 | TP_code_post() |
| 248 | ) |
| 249 | #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */ |
| 250 | LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq_with_error, |
| 251 | |
| 252 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 253 | |
| 254 | TP_ARGS(q, rq), |
| 255 | |
| 256 | TP_locvar( |
| 257 | sector_t sector; |
| 258 | unsigned int nr_sector; |
| 259 | unsigned char *cmd; |
| 260 | size_t cmd_len; |
| 261 | ), |
| 262 | |
| 263 | TP_code_pre( |
| 264 | |
| 265 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { |
| 266 | tp_locvar->sector = 0; |
| 267 | tp_locvar->nr_sector = 0; |
| 268 | tp_locvar->cmd = rq->cmd; |
| 269 | tp_locvar->cmd_len = rq->cmd_len; |
| 270 | } else { |
| 271 | tp_locvar->sector = blk_rq_pos(rq); |
| 272 | tp_locvar->nr_sector = blk_rq_sectors(rq); |
| 273 | tp_locvar->cmd = NULL; |
| 274 | tp_locvar->cmd_len = 0; |
| 275 | } |
| 276 | ), |
| 277 | |
| 278 | TP_FIELDS( |
| 279 | ctf_integer(dev_t, dev, |
| 280 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) |
| 281 | ctf_integer(sector_t, sector, tp_locvar->sector) |
| 282 | ctf_integer(unsigned int, nr_sector, tp_locvar->nr_sector) |
| 283 | ctf_integer(int, errors, rq->errors) |
| 284 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 285 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) |
| 286 | ctf_sequence_hex(unsigned char, cmd, |
| 287 | tp_locvar->cmd, size_t, tp_locvar->cmd_len) |
| 288 | ), |
| 289 | |
| 290 | TP_code_post() |
| 291 | ) |
| 292 | #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */ |
| 293 | |
| 294 | #if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(4,12,0)) |
| 295 | /** |
| 296 | * block_rq_abort - abort block operation request |
| 297 | * @q: queue containing the block operation request |
| 298 | * @rq: block IO operation request |
| 299 | * |
| 300 | * Called immediately after pending block IO operation request @rq in |
| 301 | * queue @q is aborted. The fields in the operation request @rq |
| 302 | * can be examined to determine which device and sectors the pending |
| 303 | * operation would access. |
| 304 | */ |
| 305 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_abort, |
| 306 | |
| 307 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 308 | |
| 309 | TP_ARGS(q, rq) |
| 310 | ) |
| 311 | #endif |
| 312 | |
| 313 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0)) |
| 314 | /** |
| 315 | * block_rq_requeue - place block IO request back on a queue |
| 316 | * @rq: block IO operation request |
| 317 | * |
| 318 | * The block operation request @rq is being placed back into queue |
| 319 | * @q. For some reason the request was not completed and needs to be |
| 320 | * put back in the queue. |
| 321 | */ |
| 322 | LTTNG_TRACEPOINT_EVENT(block_rq_requeue, |
| 323 | |
| 324 | TP_PROTO(struct request *rq), |
| 325 | |
| 326 | TP_ARGS(rq), |
| 327 | |
| 328 | TP_FIELDS( |
| 329 | ctf_integer(dev_t, dev, |
| 330 | rq->q->disk ? disk_devt(rq->q->disk) : 0) |
| 331 | ctf_integer(sector_t, sector, blk_rq_trace_sector(rq)) |
| 332 | ctf_integer(unsigned int, nr_sector, blk_rq_trace_nr_sectors(rq)) |
| 333 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 334 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) |
| 335 | ) |
| 336 | ) |
| 337 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
| 338 | /** |
| 339 | * block_rq_requeue - place block IO request back on a queue |
| 340 | * @rq: block IO operation request |
| 341 | * |
| 342 | * The block operation request @rq is being placed back into queue |
| 343 | * @q. For some reason the request was not completed and needs to be |
| 344 | * put back in the queue. |
| 345 | */ |
| 346 | LTTNG_TRACEPOINT_EVENT(block_rq_requeue, |
| 347 | |
| 348 | TP_PROTO(struct request *rq), |
| 349 | |
| 350 | TP_ARGS(rq), |
| 351 | |
| 352 | TP_FIELDS( |
| 353 | ctf_integer(dev_t, dev, |
| 354 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) |
| 355 | ctf_integer(sector_t, sector, blk_rq_trace_sector(rq)) |
| 356 | ctf_integer(unsigned int, nr_sector, blk_rq_trace_nr_sectors(rq)) |
| 357 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 358 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) |
| 359 | ) |
| 360 | ) |
| 361 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0)) |
| 362 | /** |
| 363 | * block_rq_requeue - place block IO request back on a queue |
| 364 | * @q: queue holding operation |
| 365 | * @rq: block IO operation request |
| 366 | * |
| 367 | * The block operation request @rq is being placed back into queue |
| 368 | * @q. For some reason the request was not completed and needs to be |
| 369 | * put back in the queue. |
| 370 | */ |
| 371 | LTTNG_TRACEPOINT_EVENT(block_rq_requeue, |
| 372 | |
| 373 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 374 | |
| 375 | TP_ARGS(q, rq), |
| 376 | |
| 377 | TP_FIELDS( |
| 378 | ctf_integer(dev_t, dev, |
| 379 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) |
| 380 | ctf_integer(sector_t, sector, blk_rq_trace_sector(rq)) |
| 381 | ctf_integer(unsigned int, nr_sector, blk_rq_trace_nr_sectors(rq)) |
| 382 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 383 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) |
| 384 | ) |
| 385 | ) |
| 386 | #else |
| 387 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_requeue, |
| 388 | |
| 389 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 390 | |
| 391 | TP_ARGS(q, rq) |
| 392 | ) |
| 393 | #endif |
| 394 | |
| 395 | /** |
| 396 | * block_rq_complete - block IO operation completed by device driver |
| 397 | * @q: queue containing the block operation request |
| 398 | * @rq: block operations request |
| 399 | * @nr_bytes: number of completed bytes |
| 400 | * |
| 401 | * The block_rq_complete tracepoint event indicates that some portion |
| 402 | * of operation request has been completed by the device driver. If |
| 403 | * the @rq->bio is %NULL, then there is absolutely no additional work to |
| 404 | * do for the request. If @rq->bio is non-NULL then there is |
| 405 | * additional work required to complete the request. |
| 406 | */ |
| 407 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0)) |
| 408 | LTTNG_TRACEPOINT_EVENT(block_rq_complete, |
| 409 | |
| 410 | TP_PROTO(struct request *rq, blk_status_t error, unsigned int nr_bytes), |
| 411 | |
| 412 | TP_ARGS(rq, error, nr_bytes), |
| 413 | |
| 414 | TP_FIELDS( |
| 415 | ctf_integer(dev_t, dev, |
| 416 | rq->q->disk ? disk_devt(rq->q->disk) : 0) |
| 417 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) |
| 418 | ctf_integer(unsigned int, nr_sector, nr_bytes >> 9) |
| 419 | ctf_integer(int, error, blk_status_to_errno(error)) |
| 420 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 421 | lttng_req_op(rq), lttng_req_rw(rq), nr_bytes) |
| 422 | ) |
| 423 | ) |
| 424 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,16,0)) |
| 425 | LTTNG_TRACEPOINT_EVENT(block_rq_complete, |
| 426 | |
| 427 | TP_PROTO(struct request *rq, blk_status_t error, unsigned int nr_bytes), |
| 428 | |
| 429 | TP_ARGS(rq, error, nr_bytes), |
| 430 | |
| 431 | TP_FIELDS( |
| 432 | ctf_integer(dev_t, dev, |
| 433 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) |
| 434 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) |
| 435 | ctf_integer(unsigned int, nr_sector, nr_bytes >> 9) |
| 436 | ctf_integer(int, error, blk_status_to_errno(error)) |
| 437 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 438 | lttng_req_op(rq), lttng_req_rw(rq), nr_bytes) |
| 439 | ) |
| 440 | ) |
| 441 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0)) |
| 442 | LTTNG_TRACEPOINT_EVENT(block_rq_complete, |
| 443 | |
| 444 | TP_PROTO(struct request *rq, int error, unsigned int nr_bytes), |
| 445 | |
| 446 | TP_ARGS(rq, error, nr_bytes), |
| 447 | |
| 448 | TP_FIELDS( |
| 449 | ctf_integer(dev_t, dev, |
| 450 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) |
| 451 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) |
| 452 | ctf_integer(unsigned int, nr_sector, nr_bytes >> 9) |
| 453 | ctf_integer(int, error, error) |
| 454 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 455 | lttng_req_op(rq), lttng_req_rw(rq), nr_bytes) |
| 456 | ) |
| 457 | ) |
| 458 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) |
| 459 | LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete, |
| 460 | |
| 461 | TP_PROTO(struct request_queue *q, struct request *rq, |
| 462 | unsigned int nr_bytes), |
| 463 | |
| 464 | TP_ARGS(q, rq, nr_bytes), |
| 465 | |
| 466 | TP_locvar( |
| 467 | unsigned char *cmd; |
| 468 | size_t cmd_len; |
| 469 | ), |
| 470 | |
| 471 | TP_code_pre( |
| 472 | if (blk_rq_is_scsi(rq)) { |
| 473 | struct scsi_request *scsi_rq = scsi_req(rq); |
| 474 | tp_locvar->cmd = scsi_rq->cmd; |
| 475 | tp_locvar->cmd_len = scsi_rq->cmd_len; |
| 476 | } else { |
| 477 | tp_locvar->cmd = NULL; |
| 478 | tp_locvar->cmd_len = 0; |
| 479 | } |
| 480 | ), |
| 481 | |
| 482 | TP_FIELDS( |
| 483 | ctf_integer(dev_t, dev, |
| 484 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) |
| 485 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) |
| 486 | ctf_integer(unsigned int, nr_sector, nr_bytes >> 9) |
| 487 | ctf_integer(int, errors, rq->errors) |
| 488 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 489 | lttng_req_op(rq), lttng_req_rw(rq), nr_bytes) |
| 490 | ctf_sequence_hex(unsigned char, cmd, |
| 491 | tp_locvar->cmd, size_t, tp_locvar->cmd_len) |
| 492 | ), |
| 493 | |
| 494 | TP_code_post() |
| 495 | ) |
| 496 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,5) \ |
| 497 | || LTTNG_KERNEL_RANGE(3,12,21, 3,13,0) \ |
| 498 | || LTTNG_KERNEL_RANGE(3,10,41, 3,11,0) \ |
| 499 | || LTTNG_KERNEL_RANGE(3,4,91, 3,5,0) \ |
| 500 | || LTTNG_KERNEL_RANGE(3,2,58, 3,3,0) \ |
| 501 | || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,28, 3,14,0,0) \ |
| 502 | || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0)) |
| 503 | |
| 504 | LTTNG_TRACEPOINT_EVENT_CODE(block_rq_complete, |
| 505 | |
| 506 | TP_PROTO(struct request_queue *q, struct request *rq, |
| 507 | unsigned int nr_bytes), |
| 508 | |
| 509 | TP_ARGS(q, rq, nr_bytes), |
| 510 | |
| 511 | TP_locvar( |
| 512 | unsigned char *cmd; |
| 513 | size_t cmd_len; |
| 514 | ), |
| 515 | |
| 516 | TP_code_pre( |
| 517 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { |
| 518 | tp_locvar->cmd = rq->cmd; |
| 519 | tp_locvar->cmd_len = rq->cmd_len; |
| 520 | } else { |
| 521 | tp_locvar->cmd = NULL; |
| 522 | tp_locvar->cmd_len = 0; |
| 523 | } |
| 524 | ), |
| 525 | |
| 526 | TP_FIELDS( |
| 527 | ctf_integer(dev_t, dev, |
| 528 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) |
| 529 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) |
| 530 | ctf_integer(unsigned int, nr_sector, nr_bytes >> 9) |
| 531 | ctf_integer(int, errors, rq->errors) |
| 532 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 533 | lttng_req_op(rq), lttng_req_rw(rq), nr_bytes) |
| 534 | ctf_sequence_hex(unsigned char, cmd, |
| 535 | tp_locvar->cmd, size_t, tp_locvar->cmd_len) |
| 536 | ), |
| 537 | |
| 538 | TP_code_post() |
| 539 | ) |
| 540 | |
| 541 | #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,15,0)) */ |
| 542 | |
| 543 | /** |
| 544 | * block_rq_complete - block IO operation completed by device driver |
| 545 | * @q: queue containing the block operation request |
| 546 | * @rq: block operations request |
| 547 | * |
| 548 | * The block_rq_complete tracepoint event indicates that some portion |
| 549 | * of operation request has been completed by the device driver. If |
| 550 | * the @rq->bio is %NULL, then there is absolutely no additional work to |
| 551 | * do for the request. If @rq->bio is non-NULL then there is |
| 552 | * additional work required to complete the request. |
| 553 | */ |
| 554 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_complete, |
| 555 | |
| 556 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 557 | |
| 558 | TP_ARGS(q, rq) |
| 559 | ) |
| 560 | |
| 561 | #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,15,0)) */ |
| 562 | |
| 563 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0)) |
| 564 | LTTNG_TRACEPOINT_EVENT_CLASS(block_rq, |
| 565 | |
| 566 | TP_PROTO(struct request *rq), |
| 567 | |
| 568 | TP_ARGS(rq), |
| 569 | |
| 570 | TP_FIELDS( |
| 571 | ctf_integer(dev_t, dev, |
| 572 | rq->q->disk ? disk_devt(rq->q->disk) : 0) |
| 573 | ctf_integer(sector_t, sector, blk_rq_trace_sector(rq)) |
| 574 | ctf_integer(unsigned int, nr_sector, blk_rq_trace_nr_sectors(rq)) |
| 575 | ctf_integer(unsigned int, bytes, blk_rq_bytes(rq)) |
| 576 | ctf_integer(pid_t, tid, current->pid) |
| 577 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 578 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) |
| 579 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 580 | ) |
| 581 | ) |
| 582 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
| 583 | LTTNG_TRACEPOINT_EVENT_CLASS(block_rq, |
| 584 | |
| 585 | TP_PROTO(struct request *rq), |
| 586 | |
| 587 | TP_ARGS(rq), |
| 588 | |
| 589 | TP_FIELDS( |
| 590 | ctf_integer(dev_t, dev, |
| 591 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) |
| 592 | ctf_integer(sector_t, sector, blk_rq_trace_sector(rq)) |
| 593 | ctf_integer(unsigned int, nr_sector, blk_rq_trace_nr_sectors(rq)) |
| 594 | ctf_integer(unsigned int, bytes, blk_rq_bytes(rq)) |
| 595 | ctf_integer(pid_t, tid, current->pid) |
| 596 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 597 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) |
| 598 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 599 | ) |
| 600 | ) |
| 601 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0)) |
| 602 | LTTNG_TRACEPOINT_EVENT_CLASS(block_rq, |
| 603 | |
| 604 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 605 | |
| 606 | TP_ARGS(q, rq), |
| 607 | |
| 608 | TP_FIELDS( |
| 609 | ctf_integer(dev_t, dev, |
| 610 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) |
| 611 | ctf_integer(sector_t, sector, blk_rq_trace_sector(rq)) |
| 612 | ctf_integer(unsigned int, nr_sector, blk_rq_trace_nr_sectors(rq)) |
| 613 | ctf_integer(unsigned int, bytes, blk_rq_bytes(rq)) |
| 614 | ctf_integer(pid_t, tid, current->pid) |
| 615 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 616 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) |
| 617 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 618 | ) |
| 619 | ) |
| 620 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) |
| 621 | LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq, |
| 622 | |
| 623 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 624 | |
| 625 | TP_ARGS(q, rq), |
| 626 | |
| 627 | TP_locvar( |
| 628 | sector_t sector; |
| 629 | unsigned int nr_sector; |
| 630 | unsigned int bytes; |
| 631 | unsigned char *cmd; |
| 632 | size_t cmd_len; |
| 633 | ), |
| 634 | |
| 635 | TP_code_pre( |
| 636 | if (blk_rq_is_scsi(rq)) { |
| 637 | struct scsi_request *scsi_rq = scsi_req(rq); |
| 638 | tp_locvar->sector = 0; |
| 639 | tp_locvar->nr_sector = 0; |
| 640 | tp_locvar->bytes = scsi_rq->resid_len; |
| 641 | tp_locvar->cmd = scsi_rq->cmd; |
| 642 | tp_locvar->cmd_len = scsi_rq->cmd_len; |
| 643 | } else { |
| 644 | tp_locvar->sector = blk_rq_pos(rq); |
| 645 | tp_locvar->nr_sector = blk_rq_sectors(rq); |
| 646 | tp_locvar->bytes = 0; |
| 647 | tp_locvar->cmd = NULL; |
| 648 | tp_locvar->cmd_len = 0; |
| 649 | } |
| 650 | ), |
| 651 | |
| 652 | TP_FIELDS( |
| 653 | ctf_integer(dev_t, dev, |
| 654 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) |
| 655 | ctf_integer(sector_t, sector, tp_locvar->sector) |
| 656 | ctf_integer(unsigned int, nr_sector, tp_locvar->nr_sector) |
| 657 | ctf_integer(unsigned int, bytes, tp_locvar->bytes) |
| 658 | ctf_integer(pid_t, tid, current->pid) |
| 659 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 660 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) |
| 661 | ctf_sequence_hex(unsigned char, cmd, |
| 662 | tp_locvar->cmd, size_t, tp_locvar->cmd_len) |
| 663 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 664 | ), |
| 665 | |
| 666 | TP_code_post() |
| 667 | ) |
| 668 | #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */ |
| 669 | LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq, |
| 670 | |
| 671 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 672 | |
| 673 | TP_ARGS(q, rq), |
| 674 | |
| 675 | TP_locvar( |
| 676 | sector_t sector; |
| 677 | unsigned int nr_sector; |
| 678 | unsigned int bytes; |
| 679 | unsigned char *cmd; |
| 680 | size_t cmd_len; |
| 681 | ), |
| 682 | |
| 683 | TP_code_pre( |
| 684 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { |
| 685 | tp_locvar->sector = 0; |
| 686 | tp_locvar->nr_sector = 0; |
| 687 | tp_locvar->bytes = blk_rq_bytes(rq); |
| 688 | tp_locvar->cmd = rq->cmd; |
| 689 | tp_locvar->cmd_len = rq->cmd_len; |
| 690 | } else { |
| 691 | tp_locvar->sector = blk_rq_pos(rq); |
| 692 | tp_locvar->nr_sector = blk_rq_sectors(rq); |
| 693 | tp_locvar->bytes = 0; |
| 694 | tp_locvar->cmd = NULL; |
| 695 | tp_locvar->cmd_len = 0; |
| 696 | } |
| 697 | ), |
| 698 | |
| 699 | TP_FIELDS( |
| 700 | ctf_integer(dev_t, dev, |
| 701 | rq->rq_disk ? disk_devt(rq->rq_disk) : 0) |
| 702 | ctf_integer(sector_t, sector, tp_locvar->sector) |
| 703 | ctf_integer(unsigned int, nr_sector, tp_locvar->nr_sector) |
| 704 | ctf_integer(unsigned int, bytes, tp_locvar->bytes) |
| 705 | ctf_integer(pid_t, tid, current->pid) |
| 706 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 707 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) |
| 708 | ctf_sequence_hex(unsigned char, cmd, |
| 709 | tp_locvar->cmd, size_t, tp_locvar->cmd_len) |
| 710 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 711 | ), |
| 712 | |
| 713 | TP_code_post() |
| 714 | ) |
| 715 | #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */ |
| 716 | |
| 717 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
| 718 | /** |
| 719 | * block_rq_insert - insert block operation request into queue |
| 720 | * @rq: block IO operation request |
| 721 | * |
| 722 | * Called immediately before block operation request @rq is inserted |
| 723 | * into queue @q. The fields in the operation request @rq struct can |
| 724 | * be examined to determine which device and sectors the pending |
| 725 | * operation would access. |
| 726 | */ |
| 727 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_insert, |
| 728 | |
| 729 | TP_PROTO(struct request *rq), |
| 730 | |
| 731 | TP_ARGS(rq) |
| 732 | ) |
| 733 | #else |
| 734 | /** |
| 735 | * block_rq_insert - insert block operation request into queue |
| 736 | * @q: target queue |
| 737 | * @rq: block IO operation request |
| 738 | * |
| 739 | * Called immediately before block operation request @rq is inserted |
| 740 | * into queue @q. The fields in the operation request @rq struct can |
| 741 | * be examined to determine which device and sectors the pending |
| 742 | * operation would access. |
| 743 | */ |
| 744 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_insert, |
| 745 | |
| 746 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 747 | |
| 748 | TP_ARGS(q, rq) |
| 749 | ) |
| 750 | #endif |
| 751 | |
| 752 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
| 753 | /** |
| 754 | * block_rq_issue - issue pending block IO request operation to device driver |
| 755 | * @rq: block IO operation operation request |
| 756 | * |
| 757 | * Called when block operation request @rq from queue @q is sent to a |
| 758 | * device driver for processing. |
| 759 | */ |
| 760 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_issue, |
| 761 | |
| 762 | TP_PROTO(struct request *rq), |
| 763 | |
| 764 | TP_ARGS(rq) |
| 765 | ) |
| 766 | #else |
| 767 | /** |
| 768 | * block_rq_issue - issue pending block IO request operation to device driver |
| 769 | * @q: queue holding operation |
| 770 | * @rq: block IO operation operation request |
| 771 | * |
| 772 | * Called when block operation request @rq from queue @q is sent to a |
| 773 | * device driver for processing. |
| 774 | */ |
| 775 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_issue, |
| 776 | |
| 777 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 778 | |
| 779 | TP_ARGS(q, rq) |
| 780 | ) |
| 781 | #endif |
| 782 | |
| 783 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
| 784 | /** |
| 785 | * block_rq_merge - merge request with another one in the elevator |
| 786 | * @rq: block IO operation operation request |
| 787 | * |
| 788 | * Called when block operation request @rq from queue @q is merged to another |
| 789 | * request queued in the elevator. |
| 790 | */ |
| 791 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_merge, |
| 792 | |
| 793 | TP_PROTO(struct request *rq), |
| 794 | |
| 795 | TP_ARGS(rq) |
| 796 | ) |
| 797 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,9,0)) |
| 798 | /** |
| 799 | * block_rq_merge - merge request with another one in the elevator |
| 800 | * @q: queue holding operation |
| 801 | * @rq: block IO operation operation request |
| 802 | * |
| 803 | * Called when block operation request @rq from queue @q is merged to another |
| 804 | * request queued in the elevator. |
| 805 | */ |
| 806 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_merge, |
| 807 | |
| 808 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 809 | |
| 810 | TP_ARGS(q, rq) |
| 811 | ) |
| 812 | #endif |
| 813 | |
| 814 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,8,0) || \ |
| 815 | LTTNG_RHEL_KERNEL_RANGE(4,18,0,305,0,0, 4,19,0,0,0,0)) |
| 816 | |
| 817 | /** |
| 818 | * block_bio_complete - completed all work on the block operation |
| 819 | * @q: queue holding the block operation |
| 820 | * @bio: block operation completed |
| 821 | * @error: io error value |
| 822 | * |
| 823 | * This tracepoint indicates there is no further work to do on this |
| 824 | * block IO operation @bio. |
| 825 | */ |
| 826 | LTTNG_TRACEPOINT_EVENT(block_bio_complete, |
| 827 | |
| 828 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 829 | |
| 830 | TP_ARGS(q, bio), |
| 831 | |
| 832 | TP_FIELDS( |
| 833 | ctf_integer(dev_t, dev, bio_dev(bio)) |
| 834 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
| 835 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) |
| 836 | ctf_integer(int, error, blk_status_to_errno(bio->bi_status)) |
| 837 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 838 | lttng_bio_op(bio), lttng_bio_rw(bio), |
| 839 | bio->bi_iter.bi_size) |
| 840 | ) |
| 841 | ) |
| 842 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) |
| 843 | /** |
| 844 | * block_bio_complete - completed all work on the block operation |
| 845 | * @q: queue holding the block operation |
| 846 | * @bio: block operation completed |
| 847 | * @error: io error value |
| 848 | * |
| 849 | * This tracepoint indicates there is no further work to do on this |
| 850 | * block IO operation @bio. |
| 851 | */ |
| 852 | LTTNG_TRACEPOINT_EVENT(block_bio_complete, |
| 853 | |
| 854 | TP_PROTO(struct request_queue *q, struct bio *bio, int error), |
| 855 | |
| 856 | TP_ARGS(q, bio, error), |
| 857 | |
| 858 | TP_FIELDS( |
| 859 | ctf_integer(dev_t, dev, bio_dev(bio)) |
| 860 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
| 861 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) |
| 862 | ctf_integer(int, error, error) |
| 863 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 864 | lttng_bio_op(bio), lttng_bio_rw(bio), |
| 865 | bio->bi_iter.bi_size) |
| 866 | ) |
| 867 | ) |
| 868 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) |
| 869 | /** |
| 870 | * block_bio_complete - completed all work on the block operation |
| 871 | * @q: queue holding the block operation |
| 872 | * @bio: block operation completed |
| 873 | * @error: io error value |
| 874 | * |
| 875 | * This tracepoint indicates there is no further work to do on this |
| 876 | * block IO operation @bio. |
| 877 | */ |
| 878 | LTTNG_TRACEPOINT_EVENT(block_bio_complete, |
| 879 | |
| 880 | TP_PROTO(struct request_queue *q, struct bio *bio, int error), |
| 881 | |
| 882 | TP_ARGS(q, bio, error), |
| 883 | |
| 884 | TP_FIELDS( |
| 885 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
| 886 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
| 887 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) |
| 888 | ctf_integer(int, error, error) |
| 889 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 890 | lttng_bio_op(bio), lttng_bio_rw(bio), |
| 891 | bio->bi_iter.bi_size) |
| 892 | ) |
| 893 | ) |
| 894 | #else |
| 895 | /** |
| 896 | * block_bio_complete - completed all work on the block operation |
| 897 | * @q: queue holding the block operation |
| 898 | * @bio: block operation completed |
| 899 | * @error: io error value |
| 900 | * |
| 901 | * This tracepoint indicates there is no further work to do on this |
| 902 | * block IO operation @bio. |
| 903 | */ |
| 904 | LTTNG_TRACEPOINT_EVENT(block_bio_complete, |
| 905 | |
| 906 | TP_PROTO(struct request_queue *q, struct bio *bio, int error), |
| 907 | |
| 908 | TP_ARGS(q, bio, error), |
| 909 | |
| 910 | TP_FIELDS( |
| 911 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
| 912 | ctf_integer(sector_t, sector, bio->bi_sector) |
| 913 | ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) |
| 914 | ctf_integer(int, error, error) |
| 915 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 916 | lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size) |
| 917 | ) |
| 918 | ) |
| 919 | #endif |
| 920 | |
| 921 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
| 922 | LTTNG_TRACEPOINT_EVENT_CLASS(block_bio, |
| 923 | |
| 924 | TP_PROTO(struct bio *bio), |
| 925 | |
| 926 | TP_ARGS(bio), |
| 927 | |
| 928 | TP_FIELDS( |
| 929 | ctf_integer(dev_t, dev, bio_dev(bio)) |
| 930 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
| 931 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) |
| 932 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 933 | lttng_bio_op(bio), lttng_bio_rw(bio), |
| 934 | bio->bi_iter.bi_size) |
| 935 | ctf_integer(pid_t, tid, current->pid) |
| 936 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 937 | ) |
| 938 | ) |
| 939 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) |
| 940 | LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge, |
| 941 | |
| 942 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), |
| 943 | |
| 944 | TP_ARGS(q, rq, bio), |
| 945 | |
| 946 | TP_FIELDS( |
| 947 | ctf_integer(dev_t, dev, bio_dev(bio)) |
| 948 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
| 949 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) |
| 950 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 951 | lttng_bio_op(bio), lttng_bio_rw(bio), |
| 952 | bio->bi_iter.bi_size) |
| 953 | ctf_integer(pid_t, tid, current->pid) |
| 954 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 955 | ) |
| 956 | ) |
| 957 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) |
| 958 | LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge, |
| 959 | |
| 960 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), |
| 961 | |
| 962 | TP_ARGS(q, rq, bio), |
| 963 | |
| 964 | TP_FIELDS( |
| 965 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
| 966 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
| 967 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) |
| 968 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 969 | lttng_bio_op(bio), lttng_bio_rw(bio), |
| 970 | bio->bi_iter.bi_size) |
| 971 | ctf_integer(pid_t, tid, current->pid) |
| 972 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 973 | ) |
| 974 | ) |
| 975 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) |
| 976 | LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge, |
| 977 | |
| 978 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), |
| 979 | |
| 980 | TP_ARGS(q, rq, bio), |
| 981 | |
| 982 | TP_FIELDS( |
| 983 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
| 984 | ctf_integer(sector_t, sector, bio->bi_sector) |
| 985 | ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) |
| 986 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 987 | lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size) |
| 988 | ctf_integer(pid_t, tid, current->pid) |
| 989 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 990 | ) |
| 991 | ) |
| 992 | #endif |
| 993 | |
| 994 | |
| 995 | |
| 996 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
| 997 | /** |
| 998 | * block_bio_bounce - used bounce buffer when processing block operation |
| 999 | * @bio: block operation |
| 1000 | * |
| 1001 | * A bounce buffer was used to handle the block operation @bio in @q. |
| 1002 | * This occurs when hardware limitations prevent a direct transfer of |
| 1003 | * data between the @bio data memory area and the IO device. Use of a |
| 1004 | * bounce buffer requires extra copying of data and decreases |
| 1005 | * performance. |
| 1006 | */ |
| 1007 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_bounce, |
| 1008 | |
| 1009 | TP_PROTO(struct bio *bio), |
| 1010 | |
| 1011 | TP_ARGS(bio) |
| 1012 | ) |
| 1013 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) |
| 1014 | /** |
| 1015 | * block_bio_bounce - used bounce buffer when processing block operation |
| 1016 | * @q: queue holding the block operation |
| 1017 | * @bio: block operation |
| 1018 | * |
| 1019 | * A bounce buffer was used to handle the block operation @bio in @q. |
| 1020 | * This occurs when hardware limitations prevent a direct transfer of |
| 1021 | * data between the @bio data memory area and the IO device. Use of a |
| 1022 | * bounce buffer requires extra copying of data and decreases |
| 1023 | * performance. |
| 1024 | */ |
| 1025 | LTTNG_TRACEPOINT_EVENT(block_bio_bounce, |
| 1026 | |
| 1027 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 1028 | |
| 1029 | TP_ARGS(q, bio), |
| 1030 | |
| 1031 | TP_FIELDS( |
| 1032 | ctf_integer(dev_t, dev, bio_dev(bio)) |
| 1033 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
| 1034 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) |
| 1035 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 1036 | lttng_bio_op(bio), lttng_bio_rw(bio), |
| 1037 | bio->bi_iter.bi_size) |
| 1038 | ctf_integer(pid_t, tid, current->pid) |
| 1039 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 1040 | ) |
| 1041 | ) |
| 1042 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) |
| 1043 | LTTNG_TRACEPOINT_EVENT(block_bio_bounce, |
| 1044 | |
| 1045 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 1046 | |
| 1047 | TP_ARGS(q, bio), |
| 1048 | |
| 1049 | TP_FIELDS( |
| 1050 | ctf_integer(dev_t, dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0) |
| 1051 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
| 1052 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) |
| 1053 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 1054 | lttng_bio_op(bio), lttng_bio_rw(bio), |
| 1055 | bio->bi_iter.bi_size) |
| 1056 | ctf_integer(pid_t, tid, current->pid) |
| 1057 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 1058 | ) |
| 1059 | ) |
| 1060 | #else |
| 1061 | LTTNG_TRACEPOINT_EVENT(block_bio_bounce, |
| 1062 | |
| 1063 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 1064 | |
| 1065 | TP_ARGS(q, bio), |
| 1066 | |
| 1067 | TP_FIELDS( |
| 1068 | ctf_integer(dev_t, dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0) |
| 1069 | ctf_integer(sector_t, sector, bio->bi_sector) |
| 1070 | ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) |
| 1071 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 1072 | lttng_bio_op(bio), lttng_bio_rw(bio), |
| 1073 | bio->bi_size) |
| 1074 | ctf_integer(pid_t, tid, current->pid) |
| 1075 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 1076 | ) |
| 1077 | ) |
| 1078 | #endif |
| 1079 | |
| 1080 | |
| 1081 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
| 1082 | /** |
| 1083 | * block_bio_backmerge - merging block operation to the end of an existing operation |
| 1084 | * @bio: new block operation to merge |
| 1085 | * |
| 1086 | * Merging block request @bio to the end of an existing block request. |
| 1087 | */ |
| 1088 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_backmerge, |
| 1089 | |
| 1090 | TP_PROTO(struct bio *bio), |
| 1091 | |
| 1092 | TP_ARGS(bio) |
| 1093 | ) |
| 1094 | |
| 1095 | /** |
| 1096 | * block_bio_frontmerge - merging block operation to the beginning of an existing operation |
| 1097 | * @bio: new block operation to merge |
| 1098 | * |
| 1099 | * Merging block IO operation @bio to the beginning of an existing block request. |
| 1100 | */ |
| 1101 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_frontmerge, |
| 1102 | |
| 1103 | TP_PROTO(struct bio *bio), |
| 1104 | |
| 1105 | TP_ARGS(bio) |
| 1106 | ) |
| 1107 | |
| 1108 | /** |
| 1109 | * block_bio_queue - putting new block IO operation in queue |
| 1110 | * @bio: new block operation |
| 1111 | * |
| 1112 | * About to place the block IO operation @bio into queue @q. |
| 1113 | */ |
| 1114 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_queue, |
| 1115 | |
| 1116 | TP_PROTO(struct bio *bio), |
| 1117 | |
| 1118 | TP_ARGS(bio) |
| 1119 | ) |
| 1120 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) |
| 1121 | /** |
| 1122 | * block_bio_backmerge - merging block operation to the end of an existing operation |
| 1123 | * @q: queue holding operation |
| 1124 | * @rq: request bio is being merged into |
| 1125 | * @bio: new block operation to merge |
| 1126 | * |
| 1127 | * Merging block request @bio to the end of an existing block request |
| 1128 | * in queue @q. |
| 1129 | */ |
| 1130 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge, block_bio_backmerge, |
| 1131 | |
| 1132 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), |
| 1133 | |
| 1134 | TP_ARGS(q, rq, bio) |
| 1135 | ) |
| 1136 | |
| 1137 | /** |
| 1138 | * block_bio_frontmerge - merging block operation to the beginning of an existing operation |
| 1139 | * @q: queue holding operation |
| 1140 | * @rq: request bio is being merged into |
| 1141 | * @bio: new block operation to merge |
| 1142 | * |
| 1143 | * Merging block IO operation @bio to the beginning of an existing block |
| 1144 | * operation in queue @q. |
| 1145 | */ |
| 1146 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio_merge, block_bio_frontmerge, |
| 1147 | |
| 1148 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), |
| 1149 | |
| 1150 | TP_ARGS(q, rq, bio) |
| 1151 | ) |
| 1152 | |
| 1153 | /** |
| 1154 | * block_bio_queue - putting new block IO operation in queue |
| 1155 | * @q: queue holding operation |
| 1156 | * @bio: new block operation |
| 1157 | * |
| 1158 | * About to place the block IO operation @bio into queue @q. |
| 1159 | */ |
| 1160 | LTTNG_TRACEPOINT_EVENT(block_bio_queue, |
| 1161 | |
| 1162 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 1163 | |
| 1164 | TP_ARGS(q, bio), |
| 1165 | |
| 1166 | TP_FIELDS( |
| 1167 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) |
| 1168 | ctf_integer(dev_t, dev, bio_dev(bio)) |
| 1169 | #else |
| 1170 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
| 1171 | #endif |
| 1172 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) |
| 1173 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
| 1174 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) |
| 1175 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 1176 | lttng_bio_op(bio), lttng_bio_rw(bio), |
| 1177 | bio->bi_iter.bi_size) |
| 1178 | #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */ |
| 1179 | ctf_integer(sector_t, sector, bio->bi_sector) |
| 1180 | ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) |
| 1181 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 1182 | lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size) |
| 1183 | #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */ |
| 1184 | ctf_integer(pid_t, tid, current->pid) |
| 1185 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 1186 | ) |
| 1187 | ) |
| 1188 | #else /* if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) */ |
| 1189 | LTTNG_TRACEPOINT_EVENT_CLASS(block_bio, |
| 1190 | |
| 1191 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 1192 | |
| 1193 | TP_ARGS(q, bio), |
| 1194 | |
| 1195 | TP_FIELDS( |
| 1196 | ctf_integer(dev_t, dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0) |
| 1197 | ctf_integer(sector_t, sector, bio->bi_sector) |
| 1198 | ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) |
| 1199 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 1200 | lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size) |
| 1201 | ctf_integer(pid_t, tid, current->pid) |
| 1202 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 1203 | ) |
| 1204 | ) |
| 1205 | |
| 1206 | /** |
| 1207 | * block_bio_backmerge - merging block operation to the end of an existing operation |
| 1208 | * @q: queue holding operation |
| 1209 | * @bio: new block operation to merge |
| 1210 | * |
| 1211 | * Merging block request @bio to the end of an existing block request |
| 1212 | * in queue @q. |
| 1213 | */ |
| 1214 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_backmerge, |
| 1215 | |
| 1216 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 1217 | |
| 1218 | TP_ARGS(q, bio) |
| 1219 | ) |
| 1220 | |
| 1221 | /** |
| 1222 | * block_bio_frontmerge - merging block operation to the beginning of an existing operation |
| 1223 | * @q: queue holding operation |
| 1224 | * @bio: new block operation to merge |
| 1225 | * |
| 1226 | * Merging block IO operation @bio to the beginning of an existing block |
| 1227 | * operation in queue @q. |
| 1228 | */ |
| 1229 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_frontmerge, |
| 1230 | |
| 1231 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 1232 | |
| 1233 | TP_ARGS(q, bio) |
| 1234 | ) |
| 1235 | |
| 1236 | /** |
| 1237 | * block_bio_queue - putting new block IO operation in queue |
| 1238 | * @q: queue holding operation |
| 1239 | * @bio: new block operation |
| 1240 | * |
| 1241 | * About to place the block IO operation @bio into queue @q. |
| 1242 | */ |
| 1243 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_bio_queue, |
| 1244 | |
| 1245 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 1246 | |
| 1247 | TP_ARGS(q, bio) |
| 1248 | ) |
| 1249 | #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) */ |
| 1250 | |
| 1251 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
| 1252 | /** |
| 1253 | * block_getrq - get a free request entry in queue for block IO operations |
| 1254 | * @bio: pending block IO operation (can be %NULL) |
| 1255 | * |
| 1256 | * A request struct has been allocated to handle the block IO operation @bio. |
| 1257 | */ |
| 1258 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_bio, block_getrq, |
| 1259 | |
| 1260 | TP_PROTO(struct bio *bio), |
| 1261 | |
| 1262 | TP_ARGS(bio) |
| 1263 | ) |
| 1264 | #else |
| 1265 | LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq, |
| 1266 | |
| 1267 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), |
| 1268 | |
| 1269 | TP_ARGS(q, bio, rw), |
| 1270 | |
| 1271 | TP_FIELDS( |
| 1272 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) |
| 1273 | ctf_integer(dev_t, dev, bio ? bio_dev(bio) : 0) |
| 1274 | #else |
| 1275 | ctf_integer(dev_t, dev, bio ? bio->bi_bdev->bd_dev : 0) |
| 1276 | #endif |
| 1277 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) |
| 1278 | ctf_integer(sector_t, sector, bio ? bio->bi_iter.bi_sector : 0) |
| 1279 | ctf_integer(unsigned int, nr_sector, |
| 1280 | bio ? bio_sectors(bio) : 0) |
| 1281 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 1282 | bio ? lttng_bio_op(bio) : 0, |
| 1283 | bio ? lttng_bio_rw(bio) : 0, |
| 1284 | bio ? bio->bi_iter.bi_size : 0) |
| 1285 | #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */ |
| 1286 | ctf_integer(sector_t, sector, bio ? bio->bi_sector : 0) |
| 1287 | ctf_integer(unsigned int, nr_sector, |
| 1288 | bio ? bio->bi_size >> 9 : 0) |
| 1289 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 1290 | bio ? lttng_bio_op(bio) : 0, |
| 1291 | bio ? lttng_bio_rw(bio) : 0, |
| 1292 | bio ? bio->bi_size : 0) |
| 1293 | #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) */ |
| 1294 | ctf_integer(pid_t, tid, current->pid) |
| 1295 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 1296 | ) |
| 1297 | ) |
| 1298 | |
| 1299 | /** |
| 1300 | * block_getrq - get a free request entry in queue for block IO operations |
| 1301 | * @q: queue for operations |
| 1302 | * @bio: pending block IO operation (can be %NULL) |
| 1303 | * @rw: low bit indicates a read (%0) or a write (%1) |
| 1304 | * |
| 1305 | * A request struct for queue @q has been allocated to handle the |
| 1306 | * block IO operation @bio. |
| 1307 | */ |
| 1308 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq, block_getrq, |
| 1309 | |
| 1310 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), |
| 1311 | |
| 1312 | TP_ARGS(q, bio, rw) |
| 1313 | ) |
| 1314 | |
| 1315 | /** |
| 1316 | * block_sleeprq - waiting to get a free request entry in queue for block IO operation |
| 1317 | * @q: queue for operation |
| 1318 | * @bio: pending block IO operation (can be %NULL) |
| 1319 | * @rw: low bit indicates a read (%0) or a write (%1) |
| 1320 | * |
| 1321 | * In the case where a request struct cannot be provided for queue @q |
| 1322 | * the process needs to wait for an request struct to become |
| 1323 | * available. This tracepoint event is generated each time the |
| 1324 | * process goes to sleep waiting for request struct become available. |
| 1325 | */ |
| 1326 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_get_rq, block_sleeprq, |
| 1327 | |
| 1328 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), |
| 1329 | |
| 1330 | TP_ARGS(q, bio, rw) |
| 1331 | ) |
| 1332 | #endif |
| 1333 | |
| 1334 | /** |
| 1335 | * block_plug - keep operations requests in request queue |
| 1336 | * @q: request queue to plug |
| 1337 | * |
| 1338 | * Plug the request queue @q. Do not allow block operation requests |
| 1339 | * to be sent to the device driver. Instead, accumulate requests in |
| 1340 | * the queue to improve throughput performance of the block device. |
| 1341 | */ |
| 1342 | LTTNG_TRACEPOINT_EVENT(block_plug, |
| 1343 | |
| 1344 | TP_PROTO(struct request_queue *q), |
| 1345 | |
| 1346 | TP_ARGS(q), |
| 1347 | |
| 1348 | TP_FIELDS( |
| 1349 | ctf_integer(pid_t, tid, current->pid) |
| 1350 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 1351 | ) |
| 1352 | ) |
| 1353 | |
| 1354 | LTTNG_TRACEPOINT_EVENT_CLASS(block_unplug, |
| 1355 | |
| 1356 | TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit), |
| 1357 | |
| 1358 | TP_ARGS(q, depth, explicit), |
| 1359 | |
| 1360 | TP_FIELDS( |
| 1361 | ctf_integer(int, nr_rq, depth) |
| 1362 | ctf_integer(pid_t, tid, current->pid) |
| 1363 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 1364 | ) |
| 1365 | ) |
| 1366 | |
| 1367 | /** |
| 1368 | * block_unplug - release of operations requests in request queue |
| 1369 | * @q: request queue to unplug |
| 1370 | * @depth: number of requests just added to the queue |
| 1371 | * @explicit: whether this was an explicit unplug, or one from schedule() |
| 1372 | * |
| 1373 | * Unplug request queue @q because device driver is scheduled to work |
| 1374 | * on elements in the request queue. |
| 1375 | */ |
| 1376 | LTTNG_TRACEPOINT_EVENT_INSTANCE(block_unplug, block_unplug, |
| 1377 | |
| 1378 | TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit), |
| 1379 | |
| 1380 | TP_ARGS(q, depth, explicit) |
| 1381 | ) |
| 1382 | |
| 1383 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
| 1384 | /** |
| 1385 | * block_split - split a single bio struct into two bio structs |
| 1386 | * @bio: block operation being split |
| 1387 | * @new_sector: The starting sector for the new bio |
| 1388 | * |
| 1389 | * The bio request @bio needs to be split into two bio requests. The newly |
| 1390 | * created @bio request starts at @new_sector. This split may be required due to |
| 1391 | * hardware limitations such as operation crossing device boundaries in a RAID |
| 1392 | * system. |
| 1393 | */ |
| 1394 | LTTNG_TRACEPOINT_EVENT(block_split, |
| 1395 | |
| 1396 | TP_PROTO(struct bio *bio, unsigned int new_sector), |
| 1397 | |
| 1398 | TP_ARGS(bio, new_sector), |
| 1399 | |
| 1400 | TP_FIELDS( |
| 1401 | ctf_integer(dev_t, dev, bio_dev(bio)) |
| 1402 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
| 1403 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 1404 | lttng_bio_op(bio), lttng_bio_rw(bio), |
| 1405 | bio->bi_iter.bi_size) |
| 1406 | ctf_integer(sector_t, new_sector, new_sector) |
| 1407 | ctf_integer(pid_t, tid, current->pid) |
| 1408 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 1409 | ) |
| 1410 | ) |
| 1411 | |
| 1412 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) |
| 1413 | /** |
| 1414 | * block_split - split a single bio struct into two bio structs |
| 1415 | * @q: queue containing the bio |
| 1416 | * @bio: block operation being split |
| 1417 | * @new_sector: The starting sector for the new bio |
| 1418 | * |
| 1419 | * The bio request @bio in request queue @q needs to be split into two |
| 1420 | * bio requests. The newly created @bio request starts at |
| 1421 | * @new_sector. This split may be required due to hardware limitation |
| 1422 | * such as operation crossing device boundaries in a RAID system. |
| 1423 | */ |
| 1424 | LTTNG_TRACEPOINT_EVENT(block_split, |
| 1425 | |
| 1426 | TP_PROTO(struct request_queue *q, struct bio *bio, |
| 1427 | unsigned int new_sector), |
| 1428 | |
| 1429 | TP_ARGS(q, bio, new_sector), |
| 1430 | |
| 1431 | TP_FIELDS( |
| 1432 | ctf_integer(dev_t, dev, bio_dev(bio)) |
| 1433 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
| 1434 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 1435 | lttng_bio_op(bio), lttng_bio_rw(bio), |
| 1436 | bio->bi_iter.bi_size) |
| 1437 | ctf_integer(sector_t, new_sector, new_sector) |
| 1438 | ctf_integer(pid_t, tid, current->pid) |
| 1439 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 1440 | ) |
| 1441 | ) |
| 1442 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) |
| 1443 | LTTNG_TRACEPOINT_EVENT(block_split, |
| 1444 | |
| 1445 | TP_PROTO(struct request_queue *q, struct bio *bio, |
| 1446 | unsigned int new_sector), |
| 1447 | |
| 1448 | TP_ARGS(q, bio, new_sector), |
| 1449 | |
| 1450 | TP_FIELDS( |
| 1451 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
| 1452 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
| 1453 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 1454 | lttng_bio_op(bio), lttng_bio_rw(bio), |
| 1455 | bio->bi_iter.bi_size) |
| 1456 | ctf_integer(sector_t, new_sector, new_sector) |
| 1457 | ctf_integer(pid_t, tid, current->pid) |
| 1458 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 1459 | ) |
| 1460 | ) |
| 1461 | #else |
| 1462 | LTTNG_TRACEPOINT_EVENT(block_split, |
| 1463 | |
| 1464 | TP_PROTO(struct request_queue *q, struct bio *bio, |
| 1465 | unsigned int new_sector), |
| 1466 | |
| 1467 | TP_ARGS(q, bio, new_sector), |
| 1468 | |
| 1469 | TP_FIELDS( |
| 1470 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
| 1471 | ctf_integer(sector_t, sector, bio->bi_sector) |
| 1472 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 1473 | lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size) |
| 1474 | ctf_integer(sector_t, new_sector, new_sector) |
| 1475 | ctf_integer(pid_t, tid, current->pid) |
| 1476 | ctf_array_text(char, comm, current->comm, TASK_COMM_LEN) |
| 1477 | ) |
| 1478 | ) |
| 1479 | #endif |
| 1480 | |
| 1481 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
| 1482 | /** |
| 1483 | * block_bio_remap - map request for a logical device to the raw device |
| 1484 | * @bio: revised operation |
| 1485 | * @dev: original device for the operation |
| 1486 | * @from: original sector for the operation |
| 1487 | * |
| 1488 | * An operation for a logical device has been mapped to the |
| 1489 | * raw block device. |
| 1490 | */ |
| 1491 | LTTNG_TRACEPOINT_EVENT(block_bio_remap, |
| 1492 | |
| 1493 | TP_PROTO(struct bio *bio, dev_t dev, sector_t from), |
| 1494 | |
| 1495 | TP_ARGS(bio, dev, from), |
| 1496 | |
| 1497 | TP_FIELDS( |
| 1498 | ctf_integer(dev_t, dev, bio_dev(bio)) |
| 1499 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
| 1500 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) |
| 1501 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 1502 | lttng_bio_op(bio), lttng_bio_rw(bio), |
| 1503 | bio->bi_iter.bi_size) |
| 1504 | ctf_integer(dev_t, old_dev, dev) |
| 1505 | ctf_integer(sector_t, old_sector, from) |
| 1506 | ) |
| 1507 | ) |
| 1508 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) |
| 1509 | /** |
| 1510 | * block_bio_remap - map request for a logical device to the raw device |
| 1511 | * @q: queue holding the operation |
| 1512 | * @bio: revised operation |
| 1513 | * @dev: device for the operation |
| 1514 | * @from: original sector for the operation |
| 1515 | * |
| 1516 | * An operation for a logical device has been mapped to the |
| 1517 | * raw block device. |
| 1518 | */ |
| 1519 | LTTNG_TRACEPOINT_EVENT(block_bio_remap, |
| 1520 | |
| 1521 | TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev, |
| 1522 | sector_t from), |
| 1523 | |
| 1524 | TP_ARGS(q, bio, dev, from), |
| 1525 | |
| 1526 | TP_FIELDS( |
| 1527 | ctf_integer(dev_t, dev, bio_dev(bio)) |
| 1528 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
| 1529 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) |
| 1530 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 1531 | lttng_bio_op(bio), lttng_bio_rw(bio), |
| 1532 | bio->bi_iter.bi_size) |
| 1533 | ctf_integer(dev_t, old_dev, dev) |
| 1534 | ctf_integer(sector_t, old_sector, from) |
| 1535 | ) |
| 1536 | ) |
| 1537 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) |
| 1538 | LTTNG_TRACEPOINT_EVENT(block_bio_remap, |
| 1539 | |
| 1540 | TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev, |
| 1541 | sector_t from), |
| 1542 | |
| 1543 | TP_ARGS(q, bio, dev, from), |
| 1544 | |
| 1545 | TP_FIELDS( |
| 1546 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
| 1547 | ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) |
| 1548 | ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) |
| 1549 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 1550 | lttng_bio_op(bio), lttng_bio_rw(bio), |
| 1551 | bio->bi_iter.bi_size) |
| 1552 | ctf_integer(dev_t, old_dev, dev) |
| 1553 | ctf_integer(sector_t, old_sector, from) |
| 1554 | ) |
| 1555 | ) |
| 1556 | #else |
| 1557 | LTTNG_TRACEPOINT_EVENT(block_bio_remap, |
| 1558 | |
| 1559 | TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev, |
| 1560 | sector_t from), |
| 1561 | |
| 1562 | TP_ARGS(q, bio, dev, from), |
| 1563 | |
| 1564 | TP_FIELDS( |
| 1565 | ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) |
| 1566 | ctf_integer(sector_t, sector, bio->bi_sector) |
| 1567 | ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) |
| 1568 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 1569 | lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size) |
| 1570 | ctf_integer(dev_t, old_dev, dev) |
| 1571 | ctf_integer(sector_t, old_sector, from) |
| 1572 | ) |
| 1573 | ) |
| 1574 | #endif |
| 1575 | |
| 1576 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0)) |
| 1577 | /** |
| 1578 | * block_rq_remap - map request for a block operation request |
| 1579 | * @rq: block IO operation request |
| 1580 | * @dev: device for the operation |
| 1581 | * @from: original sector for the operation |
| 1582 | * |
| 1583 | * The block operation request @rq in @q has been remapped. The block |
| 1584 | * operation request @rq holds the current information and @from hold |
| 1585 | * the original sector. |
| 1586 | */ |
| 1587 | LTTNG_TRACEPOINT_EVENT(block_rq_remap, |
| 1588 | |
| 1589 | TP_PROTO(struct request *rq, dev_t dev, sector_t from), |
| 1590 | |
| 1591 | TP_ARGS(rq, dev, from), |
| 1592 | |
| 1593 | TP_FIELDS( |
| 1594 | ctf_integer(dev_t, dev, disk_devt(rq->q->disk)) |
| 1595 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) |
| 1596 | ctf_integer(unsigned int, nr_sector, blk_rq_sectors(rq)) |
| 1597 | ctf_integer(dev_t, old_dev, dev) |
| 1598 | ctf_integer(sector_t, old_sector, from) |
| 1599 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 1600 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) |
| 1601 | ) |
| 1602 | ) |
| 1603 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
| 1604 | /** |
| 1605 | * block_rq_remap - map request for a block operation request |
| 1606 | * @rq: block IO operation request |
| 1607 | * @dev: device for the operation |
| 1608 | * @from: original sector for the operation |
| 1609 | * |
| 1610 | * The block operation request @rq in @q has been remapped. The block |
| 1611 | * operation request @rq holds the current information and @from hold |
| 1612 | * the original sector. |
| 1613 | */ |
| 1614 | LTTNG_TRACEPOINT_EVENT(block_rq_remap, |
| 1615 | |
| 1616 | TP_PROTO(struct request *rq, dev_t dev, sector_t from), |
| 1617 | |
| 1618 | TP_ARGS(rq, dev, from), |
| 1619 | |
| 1620 | TP_FIELDS( |
| 1621 | ctf_integer(dev_t, dev, disk_devt(rq->rq_disk)) |
| 1622 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) |
| 1623 | ctf_integer(unsigned int, nr_sector, blk_rq_sectors(rq)) |
| 1624 | ctf_integer(dev_t, old_dev, dev) |
| 1625 | ctf_integer(sector_t, old_sector, from) |
| 1626 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 1627 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) |
| 1628 | ) |
| 1629 | ) |
| 1630 | #else |
| 1631 | /** |
| 1632 | * block_rq_remap - map request for a block operation request |
| 1633 | * @q: queue holding the operation |
| 1634 | * @rq: block IO operation request |
| 1635 | * @dev: device for the operation |
| 1636 | * @from: original sector for the operation |
| 1637 | * |
| 1638 | * The block operation request @rq in @q has been remapped. The block |
| 1639 | * operation request @rq holds the current information and @from hold |
| 1640 | * the original sector. |
| 1641 | */ |
| 1642 | LTTNG_TRACEPOINT_EVENT(block_rq_remap, |
| 1643 | |
| 1644 | TP_PROTO(struct request_queue *q, struct request *rq, dev_t dev, |
| 1645 | sector_t from), |
| 1646 | |
| 1647 | TP_ARGS(q, rq, dev, from), |
| 1648 | |
| 1649 | TP_FIELDS( |
| 1650 | ctf_integer(dev_t, dev, disk_devt(rq->rq_disk)) |
| 1651 | ctf_integer(sector_t, sector, blk_rq_pos(rq)) |
| 1652 | ctf_integer(unsigned int, nr_sector, blk_rq_sectors(rq)) |
| 1653 | ctf_integer(dev_t, old_dev, dev) |
| 1654 | ctf_integer(sector_t, old_sector, from) |
| 1655 | blk_rwbs_ctf_integer(unsigned int, rwbs, |
| 1656 | lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq)) |
| 1657 | ) |
| 1658 | ) |
| 1659 | #endif |
| 1660 | |
| 1661 | #undef __print_rwbs_flags |
| 1662 | #undef blk_fill_rwbs |
| 1663 | |
| 1664 | #endif /* LTTNG_TRACE_BLOCK_H */ |
| 1665 | |
| 1666 | /* This part must be outside protection */ |
| 1667 | #include <probes/define_trace.h> |