Skip to content

Commit

Permalink
blk-mq: skip hybrid polling if iopoll doesn't spin
Browse files Browse the repository at this point in the history
If blk_poll() is not going to spin (i.e. @spin=false), it also must not
sleep in hybrid polling, otherwise it might be pretty suprising for
users trying to do a quick check and expecting no-wait behaviour.

Signed-off-by: Pavel Begunkov <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
isilence authored and axboe committed Dec 7, 2020
1 parent 926f75f commit f6f371f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -3865,9 +3865,10 @@ int blk_poll(struct request_queue *q, blk_qc_t cookie, bool spin)
* the state. Like for the other success return cases, the
* caller is responsible for checking if the IO completed. If
* the IO isn't complete, we'll get called again and will go
* straight to the busy poll loop.
* straight to the busy poll loop. If specified not to spin,
* we also should not sleep.
*/
if (blk_mq_poll_hybrid(q, hctx, cookie))
if (spin && blk_mq_poll_hybrid(q, hctx, cookie))
return 1;

hctx->poll_considered++;
Expand Down

0 comments on commit f6f371f

Please sign in to comment.