summaryrefslogtreecommitdiffstats
path: root/block/blk-core.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-11-02 19:29:54 +0100
committerJens Axboe <axboe@kernel.dk>2017-11-03 17:31:48 +0100
commitea435e1b9392a33deceaea2a16ebaa3397bead93 (patch)
tree73c80a2bfed2bc37cedc4d38d9534e231c61dbd8 /block/blk-core.c
parentblock: introduce GENHD_FL_HIDDEN (diff)
downloadlinux-ea435e1b9392a33deceaea2a16ebaa3397bead93.tar.xz
linux-ea435e1b9392a33deceaea2a16ebaa3397bead93.zip
block: add a poll_fn callback to struct request_queue
That we we can also poll non blk-mq queues. Mostly needed for the NVMe multipath code, but could also be useful elsewhere. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-core.c')
-rw-r--r--block/blk-core.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 68cfe6780a9b..395bfb10d658 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -2321,6 +2321,17 @@ blk_qc_t submit_bio(struct bio *bio)
}
EXPORT_SYMBOL(submit_bio);
+bool blk_poll(struct request_queue *q, blk_qc_t cookie)
+{
+ if (!q->poll_fn || !blk_qc_t_valid(cookie))
+ return false;
+
+ if (current->plug)
+ blk_flush_plug_list(current->plug, false);
+ return q->poll_fn(q, cookie);
+}
+EXPORT_SYMBOL_GPL(blk_poll);
+
/**
* blk_cloned_rq_check_limits - Helper function to check a cloned request
* for new the queue limits