diff mbox series

[07/29] blk-mq: provide mq_ops->busy() hook

Message ID 20181029163444.9940-8-axboe@kernel.dk (mailing list archive)
State Not Applicable
Headers show
Series blk-mq driver conversions and legacy path removal | expand

Commit Message

Jens Axboe Oct. 29, 2018, 4:34 p.m. UTC
We'll hook into this from blk_lld_busy(), allowing blk-mq to also
return whether or not a given queue currently has requests in
progress.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 block/blk-core.c       | 2 ++
 include/linux/blk-mq.h | 6 ++++++
 2 files changed, 8 insertions(+)

Comments

Hannes Reinecke Oct. 29, 2018, 4:56 p.m. UTC | #1
On 10/29/18 5:34 PM, Jens Axboe wrote:
> We'll hook into this from blk_lld_busy(), allowing blk-mq to also
> return whether or not a given queue currently has requests in
> progress.
> 
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
> ---
>   block/blk-core.c       | 2 ++
>   include/linux/blk-mq.h | 6 ++++++
>   2 files changed, 8 insertions(+)
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
diff mbox series

Patch

diff --git a/block/blk-core.c b/block/blk-core.c
index bc6ea87d10e0..c99088d0e80b 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -3429,6 +3429,8 @@  int blk_lld_busy(struct request_queue *q)
 {
 	if (q->lld_busy_fn)
 		return q->lld_busy_fn(q);
+	if (q->mq_ops && q->mq_ops->busy)
+		return q->mq_ops->busy(q);
 
 	return 0;
 }
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 2286dc12c6bc..5c8418ebbfd6 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -114,6 +114,7 @@  typedef void (busy_iter_fn)(struct blk_mq_hw_ctx *, struct request *, void *,
 typedef void (busy_tag_iter_fn)(struct request *, void *, bool);
 typedef int (poll_fn)(struct blk_mq_hw_ctx *, unsigned int);
 typedef int (map_queues_fn)(struct blk_mq_tag_set *set);
+typedef bool (busy_fn)(struct request_queue *);
 
 
 struct blk_mq_ops {
@@ -165,6 +166,11 @@  struct blk_mq_ops {
 	/* Called from inside blk_get_request() */
 	void (*initialize_rq_fn)(struct request *rq);
 
+	/*
+	 * If set, returns whether or not this queue currently is busy
+	 */
+	busy_fn			*busy;
+
 	map_queues_fn		*map_queues;
 
 #ifdef CONFIG_BLK_DEBUG_FS