Commit 5810d903 authored by Jens Axboe's avatar Jens Axboe

blk-mq: fix waiting for reserved tags

blk_mq_wait_for_tags() is only able to wait for "normal" tags,
not reserved tags. Pass in which one we should attempt to get
a tag for, so that waiting for reserved tags will work.

Reserved tags are used for internal commands, which are usually
serialized. Hence no waiting generally takes place, but we should
ensure that it actually works if users need that functionality.
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent bdcfa3e5
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
#include "blk-mq.h" #include "blk-mq.h"
#include "blk-mq-tag.h" #include "blk-mq-tag.h"
void blk_mq_wait_for_tags(struct blk_mq_tags *tags) void blk_mq_wait_for_tags(struct blk_mq_tags *tags, bool reserved)
{ {
int tag = blk_mq_get_tag(tags, __GFP_WAIT, false); int tag = blk_mq_get_tag(tags, __GFP_WAIT, reserved);
blk_mq_put_tag(tags, tag); blk_mq_put_tag(tags, tag);
} }
......
...@@ -24,7 +24,7 @@ extern struct blk_mq_tags *blk_mq_init_tags(unsigned int nr_tags, unsigned int r ...@@ -24,7 +24,7 @@ extern struct blk_mq_tags *blk_mq_init_tags(unsigned int nr_tags, unsigned int r
extern void blk_mq_free_tags(struct blk_mq_tags *tags); extern void blk_mq_free_tags(struct blk_mq_tags *tags);
extern unsigned int blk_mq_get_tag(struct blk_mq_tags *tags, gfp_t gfp, bool reserved); extern unsigned int blk_mq_get_tag(struct blk_mq_tags *tags, gfp_t gfp, bool reserved);
extern void blk_mq_wait_for_tags(struct blk_mq_tags *tags); extern void blk_mq_wait_for_tags(struct blk_mq_tags *tags, bool reserved);
extern void blk_mq_put_tag(struct blk_mq_tags *tags, unsigned int tag); extern void blk_mq_put_tag(struct blk_mq_tags *tags, unsigned int tag);
extern void blk_mq_tag_busy_iter(struct blk_mq_tags *tags, void (*fn)(void *data, unsigned long *), void *data); extern void blk_mq_tag_busy_iter(struct blk_mq_tags *tags, void (*fn)(void *data, unsigned long *), void *data);
extern bool blk_mq_has_free_tags(struct blk_mq_tags *tags); extern bool blk_mq_has_free_tags(struct blk_mq_tags *tags);
......
...@@ -218,7 +218,7 @@ static struct request *blk_mq_alloc_request_pinned(struct request_queue *q, ...@@ -218,7 +218,7 @@ static struct request *blk_mq_alloc_request_pinned(struct request_queue *q,
break; break;
} }
blk_mq_wait_for_tags(hctx->tags); blk_mq_wait_for_tags(hctx->tags, reserved);
} while (1); } while (1);
return rq; return rq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment