1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2d0b6e04aSLi Zefan #undef TRACE_SYSTEM 3d0b6e04aSLi Zefan #define TRACE_SYSTEM block 4d0b6e04aSLi Zefan 555782138SLi Zefan #if !defined(_TRACE_BLOCK_H) || defined(TRACE_HEADER_MULTI_READ) 655782138SLi Zefan #define _TRACE_BLOCK_H 755782138SLi Zefan 855782138SLi Zefan #include <linux/blktrace_api.h> 955782138SLi Zefan #include <linux/blkdev.h> 105305cb83STejun Heo #include <linux/buffer_head.h> 1155782138SLi Zefan #include <linux/tracepoint.h> 1255782138SLi Zefan 13c09c47caSNamhyung Kim #define RWBS_LEN 8 14c09c47caSNamhyung Kim 155305cb83STejun Heo DECLARE_EVENT_CLASS(block_buffer, 165305cb83STejun Heo 175305cb83STejun Heo TP_PROTO(struct buffer_head *bh), 185305cb83STejun Heo 195305cb83STejun Heo TP_ARGS(bh), 205305cb83STejun Heo 215305cb83STejun Heo TP_STRUCT__entry ( 225305cb83STejun Heo __field( dev_t, dev ) 235305cb83STejun Heo __field( sector_t, sector ) 245305cb83STejun Heo __field( size_t, size ) 255305cb83STejun Heo ), 265305cb83STejun Heo 275305cb83STejun Heo TP_fast_assign( 285305cb83STejun Heo __entry->dev = bh->b_bdev->bd_dev; 295305cb83STejun Heo __entry->sector = bh->b_blocknr; 305305cb83STejun Heo __entry->size = bh->b_size; 315305cb83STejun Heo ), 325305cb83STejun Heo 335305cb83STejun Heo TP_printk("%d,%d sector=%llu size=%zu", 345305cb83STejun Heo MAJOR(__entry->dev), MINOR(__entry->dev), 355305cb83STejun Heo (unsigned long long)__entry->sector, __entry->size 365305cb83STejun Heo ) 375305cb83STejun Heo ); 385305cb83STejun Heo 395305cb83STejun Heo /** 405305cb83STejun Heo * block_touch_buffer - mark a buffer accessed 415305cb83STejun Heo * @bh: buffer_head being touched 425305cb83STejun Heo * 435305cb83STejun Heo * Called from touch_buffer(). 445305cb83STejun Heo */ 455305cb83STejun Heo DEFINE_EVENT(block_buffer, block_touch_buffer, 465305cb83STejun Heo 475305cb83STejun Heo TP_PROTO(struct buffer_head *bh), 485305cb83STejun Heo 495305cb83STejun Heo TP_ARGS(bh) 505305cb83STejun Heo ); 515305cb83STejun Heo 525305cb83STejun Heo /** 535305cb83STejun Heo * block_dirty_buffer - mark a buffer dirty 545305cb83STejun Heo * @bh: buffer_head being dirtied 555305cb83STejun Heo * 565305cb83STejun Heo * Called from mark_buffer_dirty(). 575305cb83STejun Heo */ 585305cb83STejun Heo DEFINE_EVENT(block_buffer, block_dirty_buffer, 595305cb83STejun Heo 605305cb83STejun Heo TP_PROTO(struct buffer_head *bh), 615305cb83STejun Heo 625305cb83STejun Heo TP_ARGS(bh) 635305cb83STejun Heo ); 645305cb83STejun Heo 65cee4b7ceSChristoph Hellwig /** 66cee4b7ceSChristoph Hellwig * block_rq_requeue - place block IO request back on a queue 67cee4b7ceSChristoph Hellwig * @rq: block IO operation request 68cee4b7ceSChristoph Hellwig * 69cee4b7ceSChristoph Hellwig * The block operation request @rq is being placed back into queue 70cee4b7ceSChristoph Hellwig * @q. For some reason the request was not completed and needs to be 71cee4b7ceSChristoph Hellwig * put back in the queue. 72cee4b7ceSChristoph Hellwig */ 73cee4b7ceSChristoph Hellwig TRACE_EVENT(block_rq_requeue, 7455782138SLi Zefan 75a54895faSChristoph Hellwig TP_PROTO(struct request *rq), 7655782138SLi Zefan 77a54895faSChristoph Hellwig TP_ARGS(rq), 7855782138SLi Zefan 7955782138SLi Zefan TP_STRUCT__entry( 8055782138SLi Zefan __field( dev_t, dev ) 8155782138SLi Zefan __field( sector_t, sector ) 8255782138SLi Zefan __field( unsigned int, nr_sector ) 83c09c47caSNamhyung Kim __array( char, rwbs, RWBS_LEN ) 8448b77ad6SChristoph Hellwig __dynamic_array( char, cmd, 1 ) 8555782138SLi Zefan ), 8655782138SLi Zefan 8755782138SLi Zefan TP_fast_assign( 8855782138SLi Zefan __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; 8948b77ad6SChristoph Hellwig __entry->sector = blk_rq_trace_sector(rq); 9048b77ad6SChristoph Hellwig __entry->nr_sector = blk_rq_trace_nr_sectors(rq); 9155782138SLi Zefan 92*179d1600SChaitanya Kulkarni blk_fill_rwbs(__entry->rwbs, rq->cmd_flags); 9348b77ad6SChristoph Hellwig __get_str(cmd)[0] = '\0'; 9455782138SLi Zefan ), 9555782138SLi Zefan 9655782138SLi Zefan TP_printk("%d,%d %s (%s) %llu + %u [%d]", 9755782138SLi Zefan MAJOR(__entry->dev), MINOR(__entry->dev), 9855782138SLi Zefan __entry->rwbs, __get_str(cmd), 996556d1dfSSteven Rostedt (unsigned long long)__entry->sector, 100caf7df12SChristoph Hellwig __entry->nr_sector, 0) 10155782138SLi Zefan ); 10255782138SLi Zefan 103881245dcSWilliam Cohen /** 104881245dcSWilliam Cohen * block_rq_complete - block IO operation completed by device driver 105881245dcSWilliam Cohen * @rq: block operations request 106caf7df12SChristoph Hellwig * @error: status code 107af5040daSRoman Pen * @nr_bytes: number of completed bytes 108881245dcSWilliam Cohen * 109881245dcSWilliam Cohen * The block_rq_complete tracepoint event indicates that some portion 110881245dcSWilliam Cohen * of operation request has been completed by the device driver. If 111881245dcSWilliam Cohen * the @rq->bio is %NULL, then there is absolutely no additional work to 112881245dcSWilliam Cohen * do for the request. If @rq->bio is non-NULL then there is 113881245dcSWilliam Cohen * additional work required to complete the request. 114881245dcSWilliam Cohen */ 115af5040daSRoman Pen TRACE_EVENT(block_rq_complete, 11677ca1e02SLi Zefan 117caf7df12SChristoph Hellwig TP_PROTO(struct request *rq, int error, unsigned int nr_bytes), 11877ca1e02SLi Zefan 119caf7df12SChristoph Hellwig TP_ARGS(rq, error, nr_bytes), 120af5040daSRoman Pen 121af5040daSRoman Pen TP_STRUCT__entry( 122af5040daSRoman Pen __field( dev_t, dev ) 123af5040daSRoman Pen __field( sector_t, sector ) 124af5040daSRoman Pen __field( unsigned int, nr_sector ) 125caf7df12SChristoph Hellwig __field( int, error ) 126af5040daSRoman Pen __array( char, rwbs, RWBS_LEN ) 12748b77ad6SChristoph Hellwig __dynamic_array( char, cmd, 1 ) 128af5040daSRoman Pen ), 129af5040daSRoman Pen 130af5040daSRoman Pen TP_fast_assign( 131af5040daSRoman Pen __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; 132af5040daSRoman Pen __entry->sector = blk_rq_pos(rq); 133af5040daSRoman Pen __entry->nr_sector = nr_bytes >> 9; 134caf7df12SChristoph Hellwig __entry->error = error; 135af5040daSRoman Pen 136*179d1600SChaitanya Kulkarni blk_fill_rwbs(__entry->rwbs, rq->cmd_flags); 13748b77ad6SChristoph Hellwig __get_str(cmd)[0] = '\0'; 138af5040daSRoman Pen ), 139af5040daSRoman Pen 140af5040daSRoman Pen TP_printk("%d,%d %s (%s) %llu + %u [%d]", 141af5040daSRoman Pen MAJOR(__entry->dev), MINOR(__entry->dev), 142af5040daSRoman Pen __entry->rwbs, __get_str(cmd), 143af5040daSRoman Pen (unsigned long long)__entry->sector, 144caf7df12SChristoph Hellwig __entry->nr_sector, __entry->error) 14577ca1e02SLi Zefan ); 14677ca1e02SLi Zefan 14777ca1e02SLi Zefan DECLARE_EVENT_CLASS(block_rq, 14855782138SLi Zefan 149a54895faSChristoph Hellwig TP_PROTO(struct request *rq), 15055782138SLi Zefan 151a54895faSChristoph Hellwig TP_ARGS(rq), 15255782138SLi Zefan 15355782138SLi Zefan TP_STRUCT__entry( 15455782138SLi Zefan __field( dev_t, dev ) 15555782138SLi Zefan __field( sector_t, sector ) 15655782138SLi Zefan __field( unsigned int, nr_sector ) 15755782138SLi Zefan __field( unsigned int, bytes ) 158c09c47caSNamhyung Kim __array( char, rwbs, RWBS_LEN ) 15955782138SLi Zefan __array( char, comm, TASK_COMM_LEN ) 16048b77ad6SChristoph Hellwig __dynamic_array( char, cmd, 1 ) 16155782138SLi Zefan ), 16255782138SLi Zefan 16355782138SLi Zefan TP_fast_assign( 16455782138SLi Zefan __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; 16548b77ad6SChristoph Hellwig __entry->sector = blk_rq_trace_sector(rq); 16648b77ad6SChristoph Hellwig __entry->nr_sector = blk_rq_trace_nr_sectors(rq); 16748b77ad6SChristoph Hellwig __entry->bytes = blk_rq_bytes(rq); 16855782138SLi Zefan 169*179d1600SChaitanya Kulkarni blk_fill_rwbs(__entry->rwbs, rq->cmd_flags); 17048b77ad6SChristoph Hellwig __get_str(cmd)[0] = '\0'; 17155782138SLi Zefan memcpy(__entry->comm, current->comm, TASK_COMM_LEN); 17255782138SLi Zefan ), 17355782138SLi Zefan 17455782138SLi Zefan TP_printk("%d,%d %s %u (%s) %llu + %u [%s]", 17555782138SLi Zefan MAJOR(__entry->dev), MINOR(__entry->dev), 17655782138SLi Zefan __entry->rwbs, __entry->bytes, __get_str(cmd), 1776556d1dfSSteven Rostedt (unsigned long long)__entry->sector, 1786556d1dfSSteven Rostedt __entry->nr_sector, __entry->comm) 17955782138SLi Zefan ); 18055782138SLi Zefan 181881245dcSWilliam Cohen /** 182881245dcSWilliam Cohen * block_rq_insert - insert block operation request into queue 183881245dcSWilliam Cohen * @rq: block IO operation request 184881245dcSWilliam Cohen * 185881245dcSWilliam Cohen * Called immediately before block operation request @rq is inserted 186881245dcSWilliam Cohen * into queue @q. The fields in the operation request @rq struct can 187881245dcSWilliam Cohen * be examined to determine which device and sectors the pending 188881245dcSWilliam Cohen * operation would access. 189881245dcSWilliam Cohen */ 19077ca1e02SLi Zefan DEFINE_EVENT(block_rq, block_rq_insert, 19155782138SLi Zefan 192a54895faSChristoph Hellwig TP_PROTO(struct request *rq), 19355782138SLi Zefan 194a54895faSChristoph Hellwig TP_ARGS(rq) 19555782138SLi Zefan ); 19655782138SLi Zefan 197881245dcSWilliam Cohen /** 198881245dcSWilliam Cohen * block_rq_issue - issue pending block IO request operation to device driver 199881245dcSWilliam Cohen * @rq: block IO operation operation request 200881245dcSWilliam Cohen * 201881245dcSWilliam Cohen * Called when block operation request @rq from queue @q is sent to a 202881245dcSWilliam Cohen * device driver for processing. 203881245dcSWilliam Cohen */ 20477ca1e02SLi Zefan DEFINE_EVENT(block_rq, block_rq_issue, 20555782138SLi Zefan 206a54895faSChristoph Hellwig TP_PROTO(struct request *rq), 20755782138SLi Zefan 208a54895faSChristoph Hellwig TP_ARGS(rq) 20955782138SLi Zefan ); 210fe63b94aSCarsten Emde 211881245dcSWilliam Cohen /** 212f3bdc62fSJan Kara * block_rq_merge - merge request with another one in the elevator 213f3bdc62fSJan Kara * @rq: block IO operation operation request 214f3bdc62fSJan Kara * 215f3bdc62fSJan Kara * Called when block operation request @rq from queue @q is merged to another 216f3bdc62fSJan Kara * request queued in the elevator. 217f3bdc62fSJan Kara */ 218f3bdc62fSJan Kara DEFINE_EVENT(block_rq, block_rq_merge, 219f3bdc62fSJan Kara 220a54895faSChristoph Hellwig TP_PROTO(struct request *rq), 221f3bdc62fSJan Kara 222a54895faSChristoph Hellwig TP_ARGS(rq) 223f3bdc62fSJan Kara ); 224f3bdc62fSJan Kara 225f3bdc62fSJan Kara /** 226881245dcSWilliam Cohen * block_bio_complete - completed all work on the block operation 2270a82a8d1SLinus Torvalds * @q: queue holding the block operation 228881245dcSWilliam Cohen * @bio: block operation completed 229881245dcSWilliam Cohen * 230881245dcSWilliam Cohen * This tracepoint indicates there is no further work to do on this 231881245dcSWilliam Cohen * block IO operation @bio. 232881245dcSWilliam Cohen */ 23355782138SLi Zefan TRACE_EVENT(block_bio_complete, 23455782138SLi Zefan 235d24de76aSChristoph Hellwig TP_PROTO(struct request_queue *q, struct bio *bio), 23655782138SLi Zefan 237d24de76aSChristoph Hellwig TP_ARGS(q, bio), 23855782138SLi Zefan 23955782138SLi Zefan TP_STRUCT__entry( 24055782138SLi Zefan __field( dev_t, dev ) 24155782138SLi Zefan __field( sector_t, sector ) 24255782138SLi Zefan __field( unsigned, nr_sector ) 24355782138SLi Zefan __field( int, error ) 244c09c47caSNamhyung Kim __array( char, rwbs, RWBS_LEN) 24555782138SLi Zefan ), 24655782138SLi Zefan 24755782138SLi Zefan TP_fast_assign( 24874d46992SChristoph Hellwig __entry->dev = bio_dev(bio); 2494f024f37SKent Overstreet __entry->sector = bio->bi_iter.bi_sector; 250aa8b57aaSKent Overstreet __entry->nr_sector = bio_sectors(bio); 251d24de76aSChristoph Hellwig __entry->error = blk_status_to_errno(bio->bi_status); 252*179d1600SChaitanya Kulkarni blk_fill_rwbs(__entry->rwbs, bio->bi_opf); 25355782138SLi Zefan ), 25455782138SLi Zefan 25555782138SLi Zefan TP_printk("%d,%d %s %llu + %u [%d]", 25655782138SLi Zefan MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, 2576556d1dfSSteven Rostedt (unsigned long long)__entry->sector, 2586556d1dfSSteven Rostedt __entry->nr_sector, __entry->error) 25955782138SLi Zefan ); 26055782138SLi Zefan 261e8a676d6SChristoph Hellwig DECLARE_EVENT_CLASS(block_bio, 26255782138SLi Zefan 263e8a676d6SChristoph Hellwig TP_PROTO(struct bio *bio), 26455782138SLi Zefan 265e8a676d6SChristoph Hellwig TP_ARGS(bio), 26655782138SLi Zefan 26755782138SLi Zefan TP_STRUCT__entry( 26855782138SLi Zefan __field( dev_t, dev ) 26955782138SLi Zefan __field( sector_t, sector ) 27055782138SLi Zefan __field( unsigned int, nr_sector ) 271c09c47caSNamhyung Kim __array( char, rwbs, RWBS_LEN ) 27255782138SLi Zefan __array( char, comm, TASK_COMM_LEN ) 27355782138SLi Zefan ), 27455782138SLi Zefan 27555782138SLi Zefan TP_fast_assign( 27674d46992SChristoph Hellwig __entry->dev = bio_dev(bio); 2774f024f37SKent Overstreet __entry->sector = bio->bi_iter.bi_sector; 278aa8b57aaSKent Overstreet __entry->nr_sector = bio_sectors(bio); 279*179d1600SChaitanya Kulkarni blk_fill_rwbs(__entry->rwbs, bio->bi_opf); 28055782138SLi Zefan memcpy(__entry->comm, current->comm, TASK_COMM_LEN); 28155782138SLi Zefan ), 28255782138SLi Zefan 28355782138SLi Zefan TP_printk("%d,%d %s %llu + %u [%s]", 28455782138SLi Zefan MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, 2856556d1dfSSteven Rostedt (unsigned long long)__entry->sector, 2866556d1dfSSteven Rostedt __entry->nr_sector, __entry->comm) 28755782138SLi Zefan ); 28855782138SLi Zefan 289881245dcSWilliam Cohen /** 290e8a676d6SChristoph Hellwig * block_bio_bounce - used bounce buffer when processing block operation 291e8a676d6SChristoph Hellwig * @bio: block operation 292e8a676d6SChristoph Hellwig * 293e8a676d6SChristoph Hellwig * A bounce buffer was used to handle the block operation @bio in @q. 294e8a676d6SChristoph Hellwig * This occurs when hardware limitations prevent a direct transfer of 295e8a676d6SChristoph Hellwig * data between the @bio data memory area and the IO device. Use of a 296e8a676d6SChristoph Hellwig * bounce buffer requires extra copying of data and decreases 297e8a676d6SChristoph Hellwig * performance. 298e8a676d6SChristoph Hellwig */ 299e8a676d6SChristoph Hellwig DEFINE_EVENT(block_bio, block_bio_bounce, 300e8a676d6SChristoph Hellwig TP_PROTO(struct bio *bio), 301e8a676d6SChristoph Hellwig TP_ARGS(bio) 302e8a676d6SChristoph Hellwig ); 303e8a676d6SChristoph Hellwig 304e8a676d6SChristoph Hellwig /** 305881245dcSWilliam Cohen * block_bio_backmerge - merging block operation to the end of an existing operation 306881245dcSWilliam Cohen * @bio: new block operation to merge 307881245dcSWilliam Cohen * 308e8a676d6SChristoph Hellwig * Merging block request @bio to the end of an existing block request. 309881245dcSWilliam Cohen */ 310e8a676d6SChristoph Hellwig DEFINE_EVENT(block_bio, block_bio_backmerge, 311e8a676d6SChristoph Hellwig TP_PROTO(struct bio *bio), 312e8a676d6SChristoph Hellwig TP_ARGS(bio) 31355782138SLi Zefan ); 31455782138SLi Zefan 315881245dcSWilliam Cohen /** 316881245dcSWilliam Cohen * block_bio_frontmerge - merging block operation to the beginning of an existing operation 317881245dcSWilliam Cohen * @bio: new block operation to merge 318881245dcSWilliam Cohen * 319e8a676d6SChristoph Hellwig * Merging block IO operation @bio to the beginning of an existing block request. 320881245dcSWilliam Cohen */ 321e8a676d6SChristoph Hellwig DEFINE_EVENT(block_bio, block_bio_frontmerge, 322e8a676d6SChristoph Hellwig TP_PROTO(struct bio *bio), 323e8a676d6SChristoph Hellwig TP_ARGS(bio) 32455782138SLi Zefan ); 32555782138SLi Zefan 326881245dcSWilliam Cohen /** 327881245dcSWilliam Cohen * block_bio_queue - putting new block IO operation in queue 328881245dcSWilliam Cohen * @bio: new block operation 329881245dcSWilliam Cohen * 330881245dcSWilliam Cohen * About to place the block IO operation @bio into queue @q. 331881245dcSWilliam Cohen */ 332e8a676d6SChristoph Hellwig DEFINE_EVENT(block_bio, block_bio_queue, 333e8a676d6SChristoph Hellwig TP_PROTO(struct bio *bio), 334e8a676d6SChristoph Hellwig TP_ARGS(bio) 33555782138SLi Zefan ); 33655782138SLi Zefan 337881245dcSWilliam Cohen /** 338881245dcSWilliam Cohen * block_getrq - get a free request entry in queue for block IO operations 339f8e9ec16SGreg Thelen * @bio: pending block IO operation (can be %NULL) 340881245dcSWilliam Cohen * 341e8a676d6SChristoph Hellwig * A request struct has been allocated to handle the block IO operation @bio. 342881245dcSWilliam Cohen */ 343e8a676d6SChristoph Hellwig DEFINE_EVENT(block_bio, block_getrq, 344e8a676d6SChristoph Hellwig TP_PROTO(struct bio *bio), 345e8a676d6SChristoph Hellwig TP_ARGS(bio) 34677ca1e02SLi Zefan ); 34755782138SLi Zefan 348881245dcSWilliam Cohen /** 349881245dcSWilliam Cohen * block_plug - keep operations requests in request queue 350881245dcSWilliam Cohen * @q: request queue to plug 351881245dcSWilliam Cohen * 352881245dcSWilliam Cohen * Plug the request queue @q. Do not allow block operation requests 353881245dcSWilliam Cohen * to be sent to the device driver. Instead, accumulate requests in 354881245dcSWilliam Cohen * the queue to improve throughput performance of the block device. 355881245dcSWilliam Cohen */ 35655782138SLi Zefan TRACE_EVENT(block_plug, 35755782138SLi Zefan 35855782138SLi Zefan TP_PROTO(struct request_queue *q), 35955782138SLi Zefan 36055782138SLi Zefan TP_ARGS(q), 36155782138SLi Zefan 36255782138SLi Zefan TP_STRUCT__entry( 36355782138SLi Zefan __array( char, comm, TASK_COMM_LEN ) 36455782138SLi Zefan ), 36555782138SLi Zefan 36655782138SLi Zefan TP_fast_assign( 36755782138SLi Zefan memcpy(__entry->comm, current->comm, TASK_COMM_LEN); 36855782138SLi Zefan ), 36955782138SLi Zefan 37055782138SLi Zefan TP_printk("[%s]", __entry->comm) 37155782138SLi Zefan ); 37255782138SLi Zefan 37377ca1e02SLi Zefan DECLARE_EVENT_CLASS(block_unplug, 37455782138SLi Zefan 37549cac01eSJens Axboe TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit), 37655782138SLi Zefan 37749cac01eSJens Axboe TP_ARGS(q, depth, explicit), 37855782138SLi Zefan 37955782138SLi Zefan TP_STRUCT__entry( 38055782138SLi Zefan __field( int, nr_rq ) 38155782138SLi Zefan __array( char, comm, TASK_COMM_LEN ) 38255782138SLi Zefan ), 38355782138SLi Zefan 38455782138SLi Zefan TP_fast_assign( 38594b5eb28SJens Axboe __entry->nr_rq = depth; 38655782138SLi Zefan memcpy(__entry->comm, current->comm, TASK_COMM_LEN); 38755782138SLi Zefan ), 38855782138SLi Zefan 38955782138SLi Zefan TP_printk("[%s] %d", __entry->comm, __entry->nr_rq) 39055782138SLi Zefan ); 39155782138SLi Zefan 392881245dcSWilliam Cohen /** 39349cac01eSJens Axboe * block_unplug - release of operations requests in request queue 394881245dcSWilliam Cohen * @q: request queue to unplug 39594b5eb28SJens Axboe * @depth: number of requests just added to the queue 39649cac01eSJens Axboe * @explicit: whether this was an explicit unplug, or one from schedule() 397881245dcSWilliam Cohen * 398881245dcSWilliam Cohen * Unplug request queue @q because device driver is scheduled to work 399881245dcSWilliam Cohen * on elements in the request queue. 400881245dcSWilliam Cohen */ 40149cac01eSJens Axboe DEFINE_EVENT(block_unplug, block_unplug, 40255782138SLi Zefan 40349cac01eSJens Axboe TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit), 40455782138SLi Zefan 40549cac01eSJens Axboe TP_ARGS(q, depth, explicit) 40655782138SLi Zefan ); 40755782138SLi Zefan 408881245dcSWilliam Cohen /** 409881245dcSWilliam Cohen * block_split - split a single bio struct into two bio structs 410881245dcSWilliam Cohen * @bio: block operation being split 411881245dcSWilliam Cohen * @new_sector: The starting sector for the new bio 412881245dcSWilliam Cohen * 413eb6f7f7cSChristoph Hellwig * The bio request @bio needs to be split into two bio requests. The newly 414eb6f7f7cSChristoph Hellwig * created @bio request starts at @new_sector. This split may be required due to 415eb6f7f7cSChristoph Hellwig * hardware limitations such as operation crossing device boundaries in a RAID 416eb6f7f7cSChristoph Hellwig * system. 417881245dcSWilliam Cohen */ 41855782138SLi Zefan TRACE_EVENT(block_split, 41955782138SLi Zefan 420eb6f7f7cSChristoph Hellwig TP_PROTO(struct bio *bio, unsigned int new_sector), 42155782138SLi Zefan 422eb6f7f7cSChristoph Hellwig TP_ARGS(bio, new_sector), 42355782138SLi Zefan 42455782138SLi Zefan TP_STRUCT__entry( 42555782138SLi Zefan __field( dev_t, dev ) 42655782138SLi Zefan __field( sector_t, sector ) 42755782138SLi Zefan __field( sector_t, new_sector ) 428c09c47caSNamhyung Kim __array( char, rwbs, RWBS_LEN ) 42955782138SLi Zefan __array( char, comm, TASK_COMM_LEN ) 43055782138SLi Zefan ), 43155782138SLi Zefan 43255782138SLi Zefan TP_fast_assign( 43374d46992SChristoph Hellwig __entry->dev = bio_dev(bio); 4344f024f37SKent Overstreet __entry->sector = bio->bi_iter.bi_sector; 43555782138SLi Zefan __entry->new_sector = new_sector; 436*179d1600SChaitanya Kulkarni blk_fill_rwbs(__entry->rwbs, bio->bi_opf); 43755782138SLi Zefan memcpy(__entry->comm, current->comm, TASK_COMM_LEN); 43855782138SLi Zefan ), 43955782138SLi Zefan 44055782138SLi Zefan TP_printk("%d,%d %s %llu / %llu [%s]", 44155782138SLi Zefan MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, 4426556d1dfSSteven Rostedt (unsigned long long)__entry->sector, 4436556d1dfSSteven Rostedt (unsigned long long)__entry->new_sector, 4446556d1dfSSteven Rostedt __entry->comm) 44555782138SLi Zefan ); 44655782138SLi Zefan 447881245dcSWilliam Cohen /** 448d07335e5SMike Snitzer * block_bio_remap - map request for a logical device to the raw device 449881245dcSWilliam Cohen * @bio: revised operation 4501c02fca6SChristoph Hellwig * @dev: original device for the operation 451881245dcSWilliam Cohen * @from: original sector for the operation 452881245dcSWilliam Cohen * 453d07335e5SMike Snitzer * An operation for a logical device has been mapped to the 454881245dcSWilliam Cohen * raw block device. 455881245dcSWilliam Cohen */ 456d07335e5SMike Snitzer TRACE_EVENT(block_bio_remap, 45755782138SLi Zefan 4581c02fca6SChristoph Hellwig TP_PROTO(struct bio *bio, dev_t dev, sector_t from), 45955782138SLi Zefan 4601c02fca6SChristoph Hellwig TP_ARGS(bio, dev, from), 46155782138SLi Zefan 46255782138SLi Zefan TP_STRUCT__entry( 46355782138SLi Zefan __field( dev_t, dev ) 46455782138SLi Zefan __field( sector_t, sector ) 46555782138SLi Zefan __field( unsigned int, nr_sector ) 46655782138SLi Zefan __field( dev_t, old_dev ) 46755782138SLi Zefan __field( sector_t, old_sector ) 468c09c47caSNamhyung Kim __array( char, rwbs, RWBS_LEN) 46955782138SLi Zefan ), 47055782138SLi Zefan 47155782138SLi Zefan TP_fast_assign( 47274d46992SChristoph Hellwig __entry->dev = bio_dev(bio); 4734f024f37SKent Overstreet __entry->sector = bio->bi_iter.bi_sector; 474aa8b57aaSKent Overstreet __entry->nr_sector = bio_sectors(bio); 47555782138SLi Zefan __entry->old_dev = dev; 47655782138SLi Zefan __entry->old_sector = from; 477*179d1600SChaitanya Kulkarni blk_fill_rwbs(__entry->rwbs, bio->bi_opf); 47855782138SLi Zefan ), 47955782138SLi Zefan 48055782138SLi Zefan TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu", 48155782138SLi Zefan MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, 4826556d1dfSSteven Rostedt (unsigned long long)__entry->sector, 4836556d1dfSSteven Rostedt __entry->nr_sector, 48455782138SLi Zefan MAJOR(__entry->old_dev), MINOR(__entry->old_dev), 4856556d1dfSSteven Rostedt (unsigned long long)__entry->old_sector) 48655782138SLi Zefan ); 48755782138SLi Zefan 488881245dcSWilliam Cohen /** 489881245dcSWilliam Cohen * block_rq_remap - map request for a block operation request 490881245dcSWilliam Cohen * @rq: block IO operation request 491881245dcSWilliam Cohen * @dev: device for the operation 492881245dcSWilliam Cohen * @from: original sector for the operation 493881245dcSWilliam Cohen * 494881245dcSWilliam Cohen * The block operation request @rq in @q has been remapped. The block 495881245dcSWilliam Cohen * operation request @rq holds the current information and @from hold 496881245dcSWilliam Cohen * the original sector. 497881245dcSWilliam Cohen */ 498b0da3f0dSJun'ichi Nomura TRACE_EVENT(block_rq_remap, 499b0da3f0dSJun'ichi Nomura 500a54895faSChristoph Hellwig TP_PROTO(struct request *rq, dev_t dev, sector_t from), 501b0da3f0dSJun'ichi Nomura 502a54895faSChristoph Hellwig TP_ARGS(rq, dev, from), 503b0da3f0dSJun'ichi Nomura 504b0da3f0dSJun'ichi Nomura TP_STRUCT__entry( 505b0da3f0dSJun'ichi Nomura __field( dev_t, dev ) 506b0da3f0dSJun'ichi Nomura __field( sector_t, sector ) 507b0da3f0dSJun'ichi Nomura __field( unsigned int, nr_sector ) 508b0da3f0dSJun'ichi Nomura __field( dev_t, old_dev ) 509b0da3f0dSJun'ichi Nomura __field( sector_t, old_sector ) 51075afb352SJun'ichi Nomura __field( unsigned int, nr_bios ) 511c09c47caSNamhyung Kim __array( char, rwbs, RWBS_LEN) 512b0da3f0dSJun'ichi Nomura ), 513b0da3f0dSJun'ichi Nomura 514b0da3f0dSJun'ichi Nomura TP_fast_assign( 515b0da3f0dSJun'ichi Nomura __entry->dev = disk_devt(rq->rq_disk); 516b0da3f0dSJun'ichi Nomura __entry->sector = blk_rq_pos(rq); 517b0da3f0dSJun'ichi Nomura __entry->nr_sector = blk_rq_sectors(rq); 518b0da3f0dSJun'ichi Nomura __entry->old_dev = dev; 519b0da3f0dSJun'ichi Nomura __entry->old_sector = from; 52075afb352SJun'ichi Nomura __entry->nr_bios = blk_rq_count_bios(rq); 521*179d1600SChaitanya Kulkarni blk_fill_rwbs(__entry->rwbs, rq->cmd_flags); 522b0da3f0dSJun'ichi Nomura ), 523b0da3f0dSJun'ichi Nomura 52475afb352SJun'ichi Nomura TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu %u", 525b0da3f0dSJun'ichi Nomura MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, 526b0da3f0dSJun'ichi Nomura (unsigned long long)__entry->sector, 527b0da3f0dSJun'ichi Nomura __entry->nr_sector, 528b0da3f0dSJun'ichi Nomura MAJOR(__entry->old_dev), MINOR(__entry->old_dev), 52975afb352SJun'ichi Nomura (unsigned long long)__entry->old_sector, __entry->nr_bios) 530b0da3f0dSJun'ichi Nomura ); 531b0da3f0dSJun'ichi Nomura 53255782138SLi Zefan #endif /* _TRACE_BLOCK_H */ 53355782138SLi Zefan 53455782138SLi Zefan /* This part must be outside protection */ 53555782138SLi Zefan #include <trace/define_trace.h> 53655782138SLi Zefan 537