diff options
author | Jens Axboe <axboe@kernel.dk> | 2018-11-26 16:24:43 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-11-26 16:25:53 +0100 |
commit | 0a1b8b87d064a47fad9ec475316002da28559207 (patch) | |
tree | 9bc87a52b3fcc1f476d52ae94d6bb7e69e2bfd94 /block/blk-core.c | |
parent | nvme: remove opportunistic polling from bdev target (diff) | |
download | linux-0a1b8b87d064a47fad9ec475316002da28559207.tar.xz linux-0a1b8b87d064a47fad9ec475316002da28559207.zip |
block: make blk_poll() take a parameter on whether to spin or not
blk_poll() has always kept spinning until it found an IO. This is
fine for SYNC polling, since we need to find one request we have
pending, but in preparation for ASYNC polling it can be beneficial
to just check if we have any entries available or not.
Existing callers are converted to pass in 'spin == true', to retain
the old behavior.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-core.c')
-rw-r--r-- | block/blk-core.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 03c4202b69bf..9af56dbb84f1 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1277,19 +1277,22 @@ EXPORT_SYMBOL(submit_bio); * blk_poll - poll for IO completions * @q: the queue * @cookie: cookie passed back at IO submission time + * @spin: whether to spin for completions * * Description: * Poll for completions on the passed in queue. Returns number of - * completed entries found. + * completed entries found. If @spin is true, then blk_poll will continue + * looping until at least one completion is found, unless the task is + * otherwise marked running (or we need to reschedule). */ -int blk_poll(struct request_queue *q, blk_qc_t cookie) +int blk_poll(struct request_queue *q, blk_qc_t cookie, bool spin) { if (!q->poll_fn || !blk_qc_t_valid(cookie)) return 0; if (current->plug) blk_flush_plug_list(current->plug, false); - return q->poll_fn(q, cookie); + return q->poll_fn(q, cookie, spin); } EXPORT_SYMBOL_GPL(blk_poll); |