On 04/05/2017 11:39 AM, sbates@xxxxxxxxxxxx wrote: > @@ -42,6 +42,33 @@ static LIST_HEAD(all_q_list); > static void blk_mq_poll_stats_start(struct request_queue *q); > static void blk_mq_poll_stats_fn(struct blk_stat_callback *cb); > > +static int blk_mq_poll_stats_bkt(const struct request *rq) > +{ > + int dir, bytes; > + > + dir = blk_stat_rq_ddir(rq); > + bytes = blk_rq_bytes(rq); > + > + if (bytes <= 512) > + return dir; > + else if (bytes <= 4096) > + return dir + 2; > + else if (bytes <= 8192) > + return dir + 4; > + else if (bytes <= 16384) > + return dir + 6; > + else if (bytes <= 32768) > + return dir + 8; > + else if (bytes <= 65536) > + return dir + 10; > + else > + return dir + 12; Why not just have 8 buckets, and make it: bucket = ddir + ilog2(bytes) - 9; and cap it at MAX_BUCKET (8) and put all those above into the top bucket. -- Jens Axboe