Skip to content

Commit

Permalink
blk-mq: re-check for available tags after running the hardware queue
Browse files Browse the repository at this point in the history
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 <axboe@fb.com>
  • Loading branch information
Jens Axboe committed Dec 8, 2014
1 parent b322320 commit 080ff35
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions block/blk-mq-tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 080ff35

Please sign in to comment.