summaryrefslogtreecommitdiff
path: root/block/blk-mq-tag.c
diff options
context:
space:
mode:
authorMing Lei <tom.leiming@gmail.com>2014-05-10 15:43:14 -0600
committerJens Axboe <axboe@fb.com>2014-05-10 15:43:14 -0600
commit9d3d21aeb4f194cd7ac205abe68b14b47ae736a8 (patch)
tree18b1306aa0a86c1c987bab5d3f2e9610f47bbb8b /block/blk-mq-tag.c
parent60f2df8a29df5f2db2c87fd23122a1cebdf2011a (diff)
downloadkernel-9d3d21aeb4f194cd7ac205abe68b14b47ae736a8.tar.gz
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: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-mq-tag.c')
-rw-r--r--block/blk-mq-tag.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
index 5a83d8e587f7..f196e60178f4 100644
--- a/block/blk-mq-tag.c
+++ b/block/blk-mq-tag.c
@@ -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)