Back to home page

LXR

 
 

    


0001 #ifndef BLK_STAT_H
0002 #define BLK_STAT_H
0003 
0004 /*
0005  * ~0.13s window as a power-of-2 (2^27 nsecs)
0006  */
0007 #define BLK_STAT_NSEC       134217728ULL
0008 #define BLK_STAT_NSEC_MASK  ~(BLK_STAT_NSEC - 1)
0009 
0010 /*
0011  * Upper 3 bits can be used elsewhere
0012  */
0013 #define BLK_STAT_RES_BITS   3
0014 #define BLK_STAT_SHIFT      (64 - BLK_STAT_RES_BITS)
0015 #define BLK_STAT_TIME_MASK  ((1ULL << BLK_STAT_SHIFT) - 1)
0016 #define BLK_STAT_MASK       ~BLK_STAT_TIME_MASK
0017 
0018 enum {
0019     BLK_STAT_READ   = 0,
0020     BLK_STAT_WRITE,
0021 };
0022 
0023 void blk_stat_add(struct blk_rq_stat *, struct request *);
0024 void blk_hctx_stat_get(struct blk_mq_hw_ctx *, struct blk_rq_stat *);
0025 void blk_queue_stat_get(struct request_queue *, struct blk_rq_stat *);
0026 void blk_stat_clear(struct request_queue *);
0027 void blk_stat_init(struct blk_rq_stat *);
0028 bool blk_stat_is_current(struct blk_rq_stat *);
0029 void blk_stat_set_issue_time(struct blk_issue_stat *);
0030 bool blk_stat_enable(struct request_queue *);
0031 
0032 static inline u64 __blk_stat_time(u64 time)
0033 {
0034     return time & BLK_STAT_TIME_MASK;
0035 }
0036 
0037 static inline u64 blk_stat_time(struct blk_issue_stat *stat)
0038 {
0039     return __blk_stat_time(stat->time);
0040 }
0041 
0042 #endif