summaryrefslogtreecommitdiffstats
path: root/block/blk-mq.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-12-22 16:04:42 -0500
committerJens Axboe <axboe@fb.com>2014-12-31 11:39:16 -0500
commitaed3ea94bdd2ac0a21ed0103d34097e202ee77f6 (patch)
treee432ae8b2224a4172e4c91350b0135b14c587442 /block/blk-mq.c
parent2b25d981790b830f0e045881386866b970bf9066 (diff)
block: wake up waiters when a queue is marked dying
If it's dying, we can't expect new request to complete and come in an wake up other tasks waiting for requests. So after we have marked it as dying, wake up everybody currently waiting for a request. Once they wake, they will retry their allocation and fail appropriately due to the state of the queue. Tested-by: Keith Busch <keith.busch@intel.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r--block/blk-mq.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 97ebb84b5633..1a41d7aefbd5 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -152,6 +152,16 @@ void blk_mq_unfreeze_queue(struct request_queue *q)
152} 152}
153EXPORT_SYMBOL_GPL(blk_mq_unfreeze_queue); 153EXPORT_SYMBOL_GPL(blk_mq_unfreeze_queue);
154 154
155void blk_mq_wake_waiters(struct request_queue *q)
156{
157 struct blk_mq_hw_ctx *hctx;
158 unsigned int i;
159
160 queue_for_each_hw_ctx(q, hctx, i)
161 if (blk_mq_hw_queue_mapped(hctx))
162 blk_mq_tag_wakeup_all(hctx->tags, true);
163}
164
155bool blk_mq_can_queue(struct blk_mq_hw_ctx *hctx) 165bool blk_mq_can_queue(struct blk_mq_hw_ctx *hctx)
156{ 166{
157 return blk_mq_has_free_tags(hctx->tags); 167 return blk_mq_has_free_tags(hctx->tags);