diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2020-12-06 14:04:39 +0000 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-12-07 16:49:04 -0700 |
commit | f6f371f7db42917c7b2a861c4fc923cb352ce5a1 (patch) | |
tree | 19507514f312ee1790ef3c38572c0cbd955d6371 /block/blk-mq.c | |
parent | 926f75f6a9ef503d45dced061e304d0324beeba1 (diff) |
blk-mq: skip hybrid polling if iopoll doesn't spin
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 <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r-- | block/blk-mq.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index cf3916e2852f..2881a457de83 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -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++; |