From: Jens Axboe Date: Mon, 8 Dec 2014 15:49:06 +0000 (-0700) Subject: blk-mq: re-check for available tags after running the hardware queue X-Git-Tag: firefly_0821_release~176^2~2687^2~9 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=080ff3511450fd73948697fef34a3cc382675b59;p=firefly-linux-kernel-4.4.55.git blk-mq: re-check for available tags after running the hardware queue If we run out of tags and have to sleep, we run the hardware queue to kick pending IO into gear. During that run, we may have completed requests, so re-check if we have free tags before going to sleep. Signed-off-by: Jens Axboe --- diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c index eb55492e6875..bab4bff15f42 100644 --- a/block/blk-mq-tag.c +++ b/block/blk-mq-tag.c @@ -261,6 +261,14 @@ static int bt_get(struct blk_mq_alloc_data *data, */ blk_mq_run_hw_queue(hctx, false); + /* + * Retry tag allocation after running the hardware queue, + * as running the queue may also have found completions. + */ + tag = __bt_get(hctx, bt, last_tag); + if (tag != -1) + break; + blk_mq_put_ctx(data->ctx); io_schedule();