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: Ming Lei <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
{
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)