提交 9d3d21ae 编写于 作者: M Ming Lei 提交者: Jens Axboe

blk-mq: bitmap tag: select random tag betweet 0 and (depth - 1)

The selected tag should be selected at random between 0 and
(depth - 1) with probability 1/depth, instead between 0 and
(depth - 2) with probability 1/(depth - 1).
Signed-off-by: NMing Lei <tom.leiming@gmail.com>
Signed-off-by: NJens Axboe <axboe@fb.com>
上级 60f2df8a
......@@ -449,10 +449,7 @@ void blk_mq_tag_init_last_tag(struct blk_mq_tags *tags, unsigned int *tag)
{
unsigned int depth = tags->nr_tags - tags->nr_reserved_tags;
if (depth > 1)
*tag = prandom_u32() % (depth - 1);
else
*tag = 0;
*tag = prandom_u32() % depth;
}
ssize_t blk_mq_tag_sysfs_show(struct blk_mq_tags *tags, char *page)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册