@@ -155,6 +155,7 @@ unsigned int blk_mq_get_tag(struct blk_mq_alloc_data *data)
if (data->flags & BLK_MQ_REQ_NOWAIT)
return BLK_MQ_NO_TAG;
+ wait.nr_tags += data->nr_split;
ws = bt_wait_ptr(bt, data->hctx);
do {
struct sbitmap_queue *bt_prev;
@@ -2737,6 +2737,7 @@ static struct request *blk_mq_get_new_requests(struct request_queue *q,
.q = q,
.nr_tags = 1,
.cmd_flags = bio->bi_opf,
+ .nr_split = bio->bi_nr_split,
};
struct request *rq;
@@ -156,6 +156,7 @@ struct blk_mq_alloc_data {
/* allocate multiple requests/tags in one go */
unsigned int nr_tags;
+ unsigned int nr_split;
struct request **cached_rq;
/* input & output parameter */
@@ -591,11 +591,13 @@ void sbitmap_queue_show(struct sbitmap_queue *sbq, struct seq_file *m);
struct sbq_wait {
struct sbitmap_queue *sbq; /* if set, sbq_wait is accounted */
struct wait_queue_entry wait;
+ unsigned int nr_tags;
};
#define DEFINE_SBQ_WAIT(name) \
struct sbq_wait name = { \
.sbq = NULL, \
+ .nr_tags = 1, \
.wait = { \
.private = current, \
.func = autoremove_wake_function, \
Prepare to wake up number of threads based on required tags. Signed-off-by: Yu Kuai <yukuai3@huawei.com> --- block/blk-mq-tag.c | 1 + block/blk-mq.c | 1 + block/blk-mq.h | 1 + include/linux/sbitmap.h | 2 ++ 4 files changed, 5 insertions(+)