Skip to content

Commit

Permalink
blk-mq: directly poll requests
Browse files Browse the repository at this point in the history
Polling needs a bio with a valid bi_bdev, but neither of those are
guaranteed for polled driver requests. Make request based polling
directly use blk-mq's polling function instead.

When executing a request from a polled hctx, we know the request's
cookie, and that it's from a live blk-mq queue that supports polling, so
we can safely skip everything that bio_poll provides.

Cc: [email protected]
Reported-by: Martin Belanger <[email protected]>
Reported-by: Daniel Wagner <[email protected]>
Signed-off-by: Keith Busch <[email protected]>
Tested-by: Daniel Wagner <[email protected]>
Revieded-by: Daniel Wagner <[email protected]>
Reviewed-by: Chaitanya Kulkarni <[email protected]>
Reviewed-by: Sagi Grimberg <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Tested-by: Shin'ichiro Kawasaki <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
keithbusch authored and axboe committed Apr 4, 2023
1 parent 24ab70d commit 38a8c4d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1359,16 +1359,14 @@ bool blk_rq_is_poll(struct request *rq)
return false;
if (rq->mq_hctx->type != HCTX_TYPE_POLL)
return false;
if (WARN_ON_ONCE(!rq->bio))
return false;
return true;
}
EXPORT_SYMBOL_GPL(blk_rq_is_poll);

static void blk_rq_poll_completion(struct request *rq, struct completion *wait)
{
do {
bio_poll(rq->bio, NULL, 0);
blk_mq_poll(rq->q, blk_rq_to_qc(rq), NULL, 0);
cond_resched();
} while (!completion_done(wait));
}
Expand Down

0 comments on commit 38a8c4d

Please sign in to comment.