| 1 | #undef TRACE_SYSTEM |
| 2 | #define TRACE_SYSTEM block |
| 3 | |
| 4 | #if !defined(_TRACE_BLOCK_H) || defined(TRACE_HEADER_MULTI_READ) |
| 5 | #define _TRACE_BLOCK_H |
| 6 | |
| 7 | #include <linux/blktrace_api.h> |
| 8 | #include <linux/blkdev.h> |
| 9 | #include <linux/tracepoint.h> |
| 10 | #include <linux/trace_seq.h> |
| 11 | |
| 12 | #ifndef _TRACE_BLOCK_DEF_ |
| 13 | #define _TRACE_BLOCK_DEF_ |
| 14 | |
| 15 | #define __blk_dump_cmd(cmd, len) "<unknown>" |
| 16 | |
| 17 | enum { |
| 18 | RWBS_FLAG_WRITE = (1 << 0), |
| 19 | RWBS_FLAG_DISCARD = (1 << 1), |
| 20 | RWBS_FLAG_READ = (1 << 2), |
| 21 | RWBS_FLAG_RAHEAD = (1 << 3), |
| 22 | RWBS_FLAG_SYNC = (1 << 4), |
| 23 | RWBS_FLAG_META = (1 << 5), |
| 24 | RWBS_FLAG_SECURE = (1 << 6), |
| 25 | }; |
| 26 | |
| 27 | #endif /* _TRACE_BLOCK_DEF_ */ |
| 28 | |
| 29 | #define __print_rwbs_flags(rwbs) \ |
| 30 | __print_flags(rwbs, "", \ |
| 31 | { RWBS_FLAG_WRITE, "W" }, \ |
| 32 | { RWBS_FLAG_DISCARD, "D" }, \ |
| 33 | { RWBS_FLAG_READ, "R" }, \ |
| 34 | { RWBS_FLAG_RAHEAD, "A" }, \ |
| 35 | { RWBS_FLAG_SYNC, "S" }, \ |
| 36 | { RWBS_FLAG_META, "M" }, \ |
| 37 | { RWBS_FLAG_SECURE, "E" }) |
| 38 | |
| 39 | #define blk_fill_rwbs(rwbs, rw, bytes) \ |
| 40 | tp_assign(rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \ |
| 41 | ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \ |
| 42 | ( (bytes) ? RWBS_FLAG_READ : \ |
| 43 | ( 0 )))) \ |
| 44 | | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \ |
| 45 | | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \ |
| 46 | | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \ |
| 47 | | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0)) |
| 48 | |
| 49 | DECLARE_EVENT_CLASS(block_rq_with_error, |
| 50 | |
| 51 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 52 | |
| 53 | TP_ARGS(q, rq), |
| 54 | |
| 55 | TP_STRUCT__entry( |
| 56 | __field( dev_t, dev ) |
| 57 | __field( sector_t, sector ) |
| 58 | __field( unsigned int, nr_sector ) |
| 59 | __field( int, errors ) |
| 60 | __field( unsigned int, rwbs ) |
| 61 | __dynamic_array_hex( unsigned char, cmd, |
| 62 | (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? |
| 63 | rq->cmd_len : 0) |
| 64 | ), |
| 65 | |
| 66 | TP_fast_assign( |
| 67 | tp_assign(dev, rq->rq_disk ? disk_devt(rq->rq_disk) : 0) |
| 68 | tp_assign(sector, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? |
| 69 | 0 : blk_rq_pos(rq)) |
| 70 | tp_assign(nr_sector, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? |
| 71 | 0 : blk_rq_sectors(rq)) |
| 72 | tp_assign(errors, rq->errors) |
| 73 | blk_fill_rwbs(rwbs, rq->cmd_flags, blk_rq_bytes(rq)) |
| 74 | tp_memcpy_dyn(cmd, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? |
| 75 | rq->cmd : NULL); |
| 76 | ), |
| 77 | |
| 78 | TP_printk("%d,%d %s (%s) %llu + %u [%d]", |
| 79 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 80 | __print_rwbs_flags(__entry->rwbs), |
| 81 | __blk_dump_cmd(__get_dynamic_array(cmd), |
| 82 | __get_dynamic_array_len(cmd)), |
| 83 | (unsigned long long)__entry->sector, |
| 84 | __entry->nr_sector, __entry->errors) |
| 85 | ) |
| 86 | |
| 87 | /** |
| 88 | * block_rq_abort - abort block operation request |
| 89 | * @q: queue containing the block operation request |
| 90 | * @rq: block IO operation request |
| 91 | * |
| 92 | * Called immediately after pending block IO operation request @rq in |
| 93 | * queue @q is aborted. The fields in the operation request @rq |
| 94 | * can be examined to determine which device and sectors the pending |
| 95 | * operation would access. |
| 96 | */ |
| 97 | DEFINE_EVENT(block_rq_with_error, block_rq_abort, |
| 98 | |
| 99 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 100 | |
| 101 | TP_ARGS(q, rq) |
| 102 | ) |
| 103 | |
| 104 | /** |
| 105 | * block_rq_requeue - place block IO request back on a queue |
| 106 | * @q: queue holding operation |
| 107 | * @rq: block IO operation request |
| 108 | * |
| 109 | * The block operation request @rq is being placed back into queue |
| 110 | * @q. For some reason the request was not completed and needs to be |
| 111 | * put back in the queue. |
| 112 | */ |
| 113 | DEFINE_EVENT(block_rq_with_error, block_rq_requeue, |
| 114 | |
| 115 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 116 | |
| 117 | TP_ARGS(q, rq) |
| 118 | ) |
| 119 | |
| 120 | /** |
| 121 | * block_rq_complete - block IO operation completed by device driver |
| 122 | * @q: queue containing the block operation request |
| 123 | * @rq: block operations request |
| 124 | * |
| 125 | * The block_rq_complete tracepoint event indicates that some portion |
| 126 | * of operation request has been completed by the device driver. If |
| 127 | * the @rq->bio is %NULL, then there is absolutely no additional work to |
| 128 | * do for the request. If @rq->bio is non-NULL then there is |
| 129 | * additional work required to complete the request. |
| 130 | */ |
| 131 | DEFINE_EVENT(block_rq_with_error, block_rq_complete, |
| 132 | |
| 133 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 134 | |
| 135 | TP_ARGS(q, rq) |
| 136 | ) |
| 137 | |
| 138 | DECLARE_EVENT_CLASS(block_rq, |
| 139 | |
| 140 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 141 | |
| 142 | TP_ARGS(q, rq), |
| 143 | |
| 144 | TP_STRUCT__entry( |
| 145 | __field( dev_t, dev ) |
| 146 | __field( sector_t, sector ) |
| 147 | __field( unsigned int, nr_sector ) |
| 148 | __field( unsigned int, bytes ) |
| 149 | __field( unsigned int, rwbs ) |
| 150 | __array_text( char, comm, TASK_COMM_LEN ) |
| 151 | __dynamic_array_hex( unsigned char, cmd, |
| 152 | (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? |
| 153 | rq->cmd_len : 0) |
| 154 | ), |
| 155 | |
| 156 | TP_fast_assign( |
| 157 | tp_assign(dev, rq->rq_disk ? disk_devt(rq->rq_disk) : 0) |
| 158 | tp_assign(sector, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? |
| 159 | 0 : blk_rq_pos(rq)) |
| 160 | tp_assign(nr_sector, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? |
| 161 | 0 : blk_rq_sectors(rq)) |
| 162 | tp_assign(bytes, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? |
| 163 | blk_rq_bytes(rq) : 0) |
| 164 | blk_fill_rwbs(rwbs, rq->cmd_flags, blk_rq_bytes(rq)) |
| 165 | tp_memcpy_dyn(cmd, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? |
| 166 | rq->cmd : NULL); |
| 167 | tp_memcpy(comm, current->comm, TASK_COMM_LEN) |
| 168 | ), |
| 169 | |
| 170 | TP_printk("%d,%d %s %u (%s) %llu + %u [%s]", |
| 171 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 172 | __print_rwbs_flags(__entry->rwbs), |
| 173 | __entry->bytes, |
| 174 | __blk_dump_cmd(__get_dynamic_array(cmd), |
| 175 | __get_dynamic_array_len(cmd)), |
| 176 | (unsigned long long)__entry->sector, |
| 177 | __entry->nr_sector, __entry->comm) |
| 178 | ) |
| 179 | |
| 180 | /** |
| 181 | * block_rq_insert - insert block operation request into queue |
| 182 | * @q: target queue |
| 183 | * @rq: block IO operation request |
| 184 | * |
| 185 | * Called immediately before block operation request @rq is inserted |
| 186 | * into queue @q. The fields in the operation request @rq struct can |
| 187 | * be examined to determine which device and sectors the pending |
| 188 | * operation would access. |
| 189 | */ |
| 190 | DEFINE_EVENT(block_rq, block_rq_insert, |
| 191 | |
| 192 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 193 | |
| 194 | TP_ARGS(q, rq) |
| 195 | ) |
| 196 | |
| 197 | /** |
| 198 | * block_rq_issue - issue pending block IO request operation to device driver |
| 199 | * @q: queue holding operation |
| 200 | * @rq: block IO operation operation request |
| 201 | * |
| 202 | * Called when block operation request @rq from queue @q is sent to a |
| 203 | * device driver for processing. |
| 204 | */ |
| 205 | DEFINE_EVENT(block_rq, block_rq_issue, |
| 206 | |
| 207 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 208 | |
| 209 | TP_ARGS(q, rq) |
| 210 | ) |
| 211 | |
| 212 | /** |
| 213 | * block_bio_bounce - used bounce buffer when processing block operation |
| 214 | * @q: queue holding the block operation |
| 215 | * @bio: block operation |
| 216 | * |
| 217 | * A bounce buffer was used to handle the block operation @bio in @q. |
| 218 | * This occurs when hardware limitations prevent a direct transfer of |
| 219 | * data between the @bio data memory area and the IO device. Use of a |
| 220 | * bounce buffer requires extra copying of data and decreases |
| 221 | * performance. |
| 222 | */ |
| 223 | TRACE_EVENT(block_bio_bounce, |
| 224 | |
| 225 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 226 | |
| 227 | TP_ARGS(q, bio), |
| 228 | |
| 229 | TP_STRUCT__entry( |
| 230 | __field( dev_t, dev ) |
| 231 | __field( sector_t, sector ) |
| 232 | __field( unsigned int, nr_sector ) |
| 233 | __field( unsigned int, rwbs ) |
| 234 | __array_text( char, comm, TASK_COMM_LEN ) |
| 235 | ), |
| 236 | |
| 237 | TP_fast_assign( |
| 238 | tp_assign(dev, bio->bi_bdev ? |
| 239 | bio->bi_bdev->bd_dev : 0) |
| 240 | tp_assign(sector, bio->bi_sector) |
| 241 | tp_assign(nr_sector, bio->bi_size >> 9) |
| 242 | blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size) |
| 243 | tp_memcpy(comm, current->comm, TASK_COMM_LEN) |
| 244 | ), |
| 245 | |
| 246 | TP_printk("%d,%d %s %llu + %u [%s]", |
| 247 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 248 | __print_rwbs_flags(__entry->rwbs), |
| 249 | (unsigned long long)__entry->sector, |
| 250 | __entry->nr_sector, __entry->comm) |
| 251 | ) |
| 252 | |
| 253 | /** |
| 254 | * block_bio_complete - completed all work on the block operation |
| 255 | * @q: queue holding the block operation |
| 256 | * @bio: block operation completed |
| 257 | * @error: io error value |
| 258 | * |
| 259 | * This tracepoint indicates there is no further work to do on this |
| 260 | * block IO operation @bio. |
| 261 | */ |
| 262 | TRACE_EVENT(block_bio_complete, |
| 263 | |
| 264 | TP_PROTO(struct request_queue *q, struct bio *bio, int error), |
| 265 | |
| 266 | TP_ARGS(q, bio, error), |
| 267 | |
| 268 | TP_STRUCT__entry( |
| 269 | __field( dev_t, dev ) |
| 270 | __field( sector_t, sector ) |
| 271 | __field( unsigned, nr_sector ) |
| 272 | __field( int, error ) |
| 273 | __field( unsigned int, rwbs ) |
| 274 | ), |
| 275 | |
| 276 | TP_fast_assign( |
| 277 | tp_assign(dev, bio->bi_bdev->bd_dev) |
| 278 | tp_assign(sector, bio->bi_sector) |
| 279 | tp_assign(nr_sector, bio->bi_size >> 9) |
| 280 | tp_assign(error, error) |
| 281 | blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size) |
| 282 | ), |
| 283 | |
| 284 | TP_printk("%d,%d %s %llu + %u [%d]", |
| 285 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 286 | __print_rwbs_flags(__entry->rwbs), |
| 287 | (unsigned long long)__entry->sector, |
| 288 | __entry->nr_sector, __entry->error) |
| 289 | ) |
| 290 | |
| 291 | DECLARE_EVENT_CLASS(block_bio, |
| 292 | |
| 293 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 294 | |
| 295 | TP_ARGS(q, bio), |
| 296 | |
| 297 | TP_STRUCT__entry( |
| 298 | __field( dev_t, dev ) |
| 299 | __field( sector_t, sector ) |
| 300 | __field( unsigned int, nr_sector ) |
| 301 | __field( unsigned int, rwbs ) |
| 302 | __array_text( char, comm, TASK_COMM_LEN ) |
| 303 | ), |
| 304 | |
| 305 | TP_fast_assign( |
| 306 | tp_assign(dev, bio->bi_bdev->bd_dev) |
| 307 | tp_assign(sector, bio->bi_sector) |
| 308 | tp_assign(nr_sector, bio->bi_size >> 9) |
| 309 | blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size) |
| 310 | tp_memcpy(comm, current->comm, TASK_COMM_LEN) |
| 311 | ), |
| 312 | |
| 313 | TP_printk("%d,%d %s %llu + %u [%s]", |
| 314 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 315 | __print_rwbs_flags(__entry->rwbs), |
| 316 | (unsigned long long)__entry->sector, |
| 317 | __entry->nr_sector, __entry->comm) |
| 318 | ) |
| 319 | |
| 320 | /** |
| 321 | * block_bio_backmerge - merging block operation to the end of an existing operation |
| 322 | * @q: queue holding operation |
| 323 | * @bio: new block operation to merge |
| 324 | * |
| 325 | * Merging block request @bio to the end of an existing block request |
| 326 | * in queue @q. |
| 327 | */ |
| 328 | DEFINE_EVENT(block_bio, block_bio_backmerge, |
| 329 | |
| 330 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 331 | |
| 332 | TP_ARGS(q, bio) |
| 333 | ) |
| 334 | |
| 335 | /** |
| 336 | * block_bio_frontmerge - merging block operation to the beginning of an existing operation |
| 337 | * @q: queue holding operation |
| 338 | * @bio: new block operation to merge |
| 339 | * |
| 340 | * Merging block IO operation @bio to the beginning of an existing block |
| 341 | * operation in queue @q. |
| 342 | */ |
| 343 | DEFINE_EVENT(block_bio, block_bio_frontmerge, |
| 344 | |
| 345 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 346 | |
| 347 | TP_ARGS(q, bio) |
| 348 | ) |
| 349 | |
| 350 | /** |
| 351 | * block_bio_queue - putting new block IO operation in queue |
| 352 | * @q: queue holding operation |
| 353 | * @bio: new block operation |
| 354 | * |
| 355 | * About to place the block IO operation @bio into queue @q. |
| 356 | */ |
| 357 | DEFINE_EVENT(block_bio, block_bio_queue, |
| 358 | |
| 359 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 360 | |
| 361 | TP_ARGS(q, bio) |
| 362 | ) |
| 363 | |
| 364 | DECLARE_EVENT_CLASS(block_get_rq, |
| 365 | |
| 366 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), |
| 367 | |
| 368 | TP_ARGS(q, bio, rw), |
| 369 | |
| 370 | TP_STRUCT__entry( |
| 371 | __field( dev_t, dev ) |
| 372 | __field( sector_t, sector ) |
| 373 | __field( unsigned int, nr_sector ) |
| 374 | __field( unsigned int, rwbs ) |
| 375 | __array_text( char, comm, TASK_COMM_LEN ) |
| 376 | ), |
| 377 | |
| 378 | TP_fast_assign( |
| 379 | tp_assign(dev, bio ? bio->bi_bdev->bd_dev : 0) |
| 380 | tp_assign(sector, bio ? bio->bi_sector : 0) |
| 381 | tp_assign(nr_sector, bio ? bio->bi_size >> 9 : 0) |
| 382 | blk_fill_rwbs(rwbs, bio ? bio->bi_rw : 0, |
| 383 | bio ? bio->bi_size >> 9 : 0) |
| 384 | tp_memcpy(comm, current->comm, TASK_COMM_LEN) |
| 385 | ), |
| 386 | |
| 387 | TP_printk("%d,%d %s %llu + %u [%s]", |
| 388 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 389 | __print_rwbs_flags(__entry->rwbs), |
| 390 | (unsigned long long)__entry->sector, |
| 391 | __entry->nr_sector, __entry->comm) |
| 392 | ) |
| 393 | |
| 394 | /** |
| 395 | * block_getrq - get a free request entry in queue for block IO operations |
| 396 | * @q: queue for operations |
| 397 | * @bio: pending block IO operation |
| 398 | * @rw: low bit indicates a read (%0) or a write (%1) |
| 399 | * |
| 400 | * A request struct for queue @q has been allocated to handle the |
| 401 | * block IO operation @bio. |
| 402 | */ |
| 403 | DEFINE_EVENT(block_get_rq, block_getrq, |
| 404 | |
| 405 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), |
| 406 | |
| 407 | TP_ARGS(q, bio, rw) |
| 408 | ) |
| 409 | |
| 410 | /** |
| 411 | * block_sleeprq - waiting to get a free request entry in queue for block IO operation |
| 412 | * @q: queue for operation |
| 413 | * @bio: pending block IO operation |
| 414 | * @rw: low bit indicates a read (%0) or a write (%1) |
| 415 | * |
| 416 | * In the case where a request struct cannot be provided for queue @q |
| 417 | * the process needs to wait for an request struct to become |
| 418 | * available. This tracepoint event is generated each time the |
| 419 | * process goes to sleep waiting for request struct become available. |
| 420 | */ |
| 421 | DEFINE_EVENT(block_get_rq, block_sleeprq, |
| 422 | |
| 423 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), |
| 424 | |
| 425 | TP_ARGS(q, bio, rw) |
| 426 | ) |
| 427 | |
| 428 | /** |
| 429 | * block_plug - keep operations requests in request queue |
| 430 | * @q: request queue to plug |
| 431 | * |
| 432 | * Plug the request queue @q. Do not allow block operation requests |
| 433 | * to be sent to the device driver. Instead, accumulate requests in |
| 434 | * the queue to improve throughput performance of the block device. |
| 435 | */ |
| 436 | TRACE_EVENT(block_plug, |
| 437 | |
| 438 | TP_PROTO(struct request_queue *q), |
| 439 | |
| 440 | TP_ARGS(q), |
| 441 | |
| 442 | TP_STRUCT__entry( |
| 443 | __array_text( char, comm, TASK_COMM_LEN ) |
| 444 | ), |
| 445 | |
| 446 | TP_fast_assign( |
| 447 | tp_memcpy(comm, current->comm, TASK_COMM_LEN) |
| 448 | ), |
| 449 | |
| 450 | TP_printk("[%s]", __entry->comm) |
| 451 | ) |
| 452 | |
| 453 | DECLARE_EVENT_CLASS(block_unplug, |
| 454 | |
| 455 | TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit), |
| 456 | |
| 457 | TP_ARGS(q, depth, explicit), |
| 458 | |
| 459 | TP_STRUCT__entry( |
| 460 | __field( int, nr_rq ) |
| 461 | __array_text( char, comm, TASK_COMM_LEN ) |
| 462 | ), |
| 463 | |
| 464 | TP_fast_assign( |
| 465 | tp_assign(nr_rq, depth) |
| 466 | tp_memcpy(comm, current->comm, TASK_COMM_LEN) |
| 467 | ), |
| 468 | |
| 469 | TP_printk("[%s] %d", __entry->comm, __entry->nr_rq) |
| 470 | ) |
| 471 | |
| 472 | /** |
| 473 | * block_unplug - release of operations requests in request queue |
| 474 | * @q: request queue to unplug |
| 475 | * @depth: number of requests just added to the queue |
| 476 | * @explicit: whether this was an explicit unplug, or one from schedule() |
| 477 | * |
| 478 | * Unplug request queue @q because device driver is scheduled to work |
| 479 | * on elements in the request queue. |
| 480 | */ |
| 481 | DEFINE_EVENT(block_unplug, block_unplug, |
| 482 | |
| 483 | TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit), |
| 484 | |
| 485 | TP_ARGS(q, depth, explicit) |
| 486 | ) |
| 487 | |
| 488 | /** |
| 489 | * block_split - split a single bio struct into two bio structs |
| 490 | * @q: queue containing the bio |
| 491 | * @bio: block operation being split |
| 492 | * @new_sector: The starting sector for the new bio |
| 493 | * |
| 494 | * The bio request @bio in request queue @q needs to be split into two |
| 495 | * bio requests. The newly created @bio request starts at |
| 496 | * @new_sector. This split may be required due to hardware limitation |
| 497 | * such as operation crossing device boundaries in a RAID system. |
| 498 | */ |
| 499 | TRACE_EVENT(block_split, |
| 500 | |
| 501 | TP_PROTO(struct request_queue *q, struct bio *bio, |
| 502 | unsigned int new_sector), |
| 503 | |
| 504 | TP_ARGS(q, bio, new_sector), |
| 505 | |
| 506 | TP_STRUCT__entry( |
| 507 | __field( dev_t, dev ) |
| 508 | __field( sector_t, sector ) |
| 509 | __field( sector_t, new_sector ) |
| 510 | __field( unsigned int, rwbs ) |
| 511 | __array_text( char, comm, TASK_COMM_LEN ) |
| 512 | ), |
| 513 | |
| 514 | TP_fast_assign( |
| 515 | tp_assign(dev, bio->bi_bdev->bd_dev) |
| 516 | tp_assign(sector, bio->bi_sector) |
| 517 | tp_assign(new_sector, new_sector) |
| 518 | blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size) |
| 519 | tp_memcpy(comm, current->comm, TASK_COMM_LEN) |
| 520 | ), |
| 521 | |
| 522 | TP_printk("%d,%d %s %llu / %llu [%s]", |
| 523 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 524 | __print_rwbs_flags(__entry->rwbs), |
| 525 | (unsigned long long)__entry->sector, |
| 526 | (unsigned long long)__entry->new_sector, |
| 527 | __entry->comm) |
| 528 | ) |
| 529 | |
| 530 | /** |
| 531 | * block_bio_remap - map request for a logical device to the raw device |
| 532 | * @q: queue holding the operation |
| 533 | * @bio: revised operation |
| 534 | * @dev: device for the operation |
| 535 | * @from: original sector for the operation |
| 536 | * |
| 537 | * An operation for a logical device has been mapped to the |
| 538 | * raw block device. |
| 539 | */ |
| 540 | TRACE_EVENT(block_bio_remap, |
| 541 | |
| 542 | TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev, |
| 543 | sector_t from), |
| 544 | |
| 545 | TP_ARGS(q, bio, dev, from), |
| 546 | |
| 547 | TP_STRUCT__entry( |
| 548 | __field( dev_t, dev ) |
| 549 | __field( sector_t, sector ) |
| 550 | __field( unsigned int, nr_sector ) |
| 551 | __field( dev_t, old_dev ) |
| 552 | __field( sector_t, old_sector ) |
| 553 | __field( unsigned int, rwbs ) |
| 554 | ), |
| 555 | |
| 556 | TP_fast_assign( |
| 557 | tp_assign(dev, bio->bi_bdev->bd_dev) |
| 558 | tp_assign(sector, bio->bi_sector) |
| 559 | tp_assign(nr_sector, bio->bi_size >> 9) |
| 560 | tp_assign(old_dev, dev) |
| 561 | tp_assign(old_sector, from) |
| 562 | blk_fill_rwbs(rwbs, bio->bi_rw, bio->bi_size) |
| 563 | ), |
| 564 | |
| 565 | TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu", |
| 566 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 567 | __print_rwbs_flags(__entry->rwbs), |
| 568 | (unsigned long long)__entry->sector, |
| 569 | __entry->nr_sector, |
| 570 | MAJOR(__entry->old_dev), MINOR(__entry->old_dev), |
| 571 | (unsigned long long)__entry->old_sector) |
| 572 | ) |
| 573 | |
| 574 | /** |
| 575 | * block_rq_remap - map request for a block operation request |
| 576 | * @q: queue holding the operation |
| 577 | * @rq: block IO operation request |
| 578 | * @dev: device for the operation |
| 579 | * @from: original sector for the operation |
| 580 | * |
| 581 | * The block operation request @rq in @q has been remapped. The block |
| 582 | * operation request @rq holds the current information and @from hold |
| 583 | * the original sector. |
| 584 | */ |
| 585 | TRACE_EVENT(block_rq_remap, |
| 586 | |
| 587 | TP_PROTO(struct request_queue *q, struct request *rq, dev_t dev, |
| 588 | sector_t from), |
| 589 | |
| 590 | TP_ARGS(q, rq, dev, from), |
| 591 | |
| 592 | TP_STRUCT__entry( |
| 593 | __field( dev_t, dev ) |
| 594 | __field( sector_t, sector ) |
| 595 | __field( unsigned int, nr_sector ) |
| 596 | __field( dev_t, old_dev ) |
| 597 | __field( sector_t, old_sector ) |
| 598 | __field( unsigned int, rwbs ) |
| 599 | ), |
| 600 | |
| 601 | TP_fast_assign( |
| 602 | tp_assign(dev, disk_devt(rq->rq_disk)) |
| 603 | tp_assign(sector, blk_rq_pos(rq)) |
| 604 | tp_assign(nr_sector, blk_rq_sectors(rq)) |
| 605 | tp_assign(old_dev, dev) |
| 606 | tp_assign(old_sector, from) |
| 607 | blk_fill_rwbs(rwbs, rq->cmd_flags, blk_rq_bytes(rq)) |
| 608 | ), |
| 609 | |
| 610 | TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu", |
| 611 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 612 | __print_rwbs_flags(__entry->rwbs), |
| 613 | (unsigned long long)__entry->sector, |
| 614 | __entry->nr_sector, |
| 615 | MAJOR(__entry->old_dev), MINOR(__entry->old_dev), |
| 616 | (unsigned long long)__entry->old_sector) |
| 617 | ) |
| 618 | |
| 619 | #undef __print_rwbs_flags |
| 620 | #undef blk_fill_rwbs |
| 621 | |
| 622 | #endif /* _TRACE_BLOCK_H */ |
| 623 | |
| 624 | /* This part must be outside protection */ |
| 625 | #include "../../../probes/define_trace.h" |
| 626 | |