summaryrefslogtreecommitdiffstats
path: root/block/blk-core.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2018-11-26 16:21:49 +0100
committerJens Axboe <axboe@kernel.dk>2018-11-26 16:25:40 +0100
commit1052b8ac5282daf35df331edcbdb645839d17e6a (patch)
tree416e6bcaea468503613abeaf1e9705fea5aa94f9 /block/blk-core.c
parentblk-mq: not embed .mq_kobj and ctx->kobj into queue instance (diff)
downloadlinux-1052b8ac5282daf35df331edcbdb645839d17e6a.tar.xz
linux-1052b8ac5282daf35df331edcbdb645839d17e6a.zip
blk-mq: when polling for IO, look for any completion
If we want to support async IO polling, then we have to allow finding completions that aren't just for the one we are looking for. Always pass in -1 to the mq_ops->poll() helper, and have that return how many events were found in this poll loop. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-core.c')
-rw-r--r--block/blk-core.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 04f5be473638..03c4202b69bf 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1273,10 +1273,19 @@ blk_qc_t submit_bio(struct bio *bio)
}
EXPORT_SYMBOL(submit_bio);
-bool blk_poll(struct request_queue *q, blk_qc_t cookie)
+/**
+ * blk_poll - poll for IO completions
+ * @q: the queue
+ * @cookie: cookie passed back at IO submission time
+ *
+ * Description:
+ * Poll for completions on the passed in queue. Returns number of
+ * completed entries found.
+ */
+int blk_poll(struct request_queue *q, blk_qc_t cookie)
{
if (!q->poll_fn || !blk_qc_t_valid(cookie))
- return false;
+ return 0;
if (current->plug)
blk_flush_plug_list(current->plug, false);