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