[PATCH v2 2/2] blk-mq: Add a polling specific stats function
Jens Axboe
axboe at kernel.dk
Wed Apr 5 11:14:33 PDT 2017
On 04/05/2017 11:39 AM, sbates at raithlin.com 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
More information about the Linux-nvme
mailing list