]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
blk-mq: provide mq_ops->busy() hook
authorJens Axboe <axboe@kernel.dk>
Mon, 29 Oct 2018 16:15:10 +0000 (10:15 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 7 Nov 2018 20:42:31 +0000 (13:42 -0700)
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.

Reviewed-by: Hannes Reinecke <hare@suse.com>
Tested-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-core.c
include/linux/blk-mq.h

index ce12515f9b9b9930da4515ed8f70a4cf5f5b946f..ca1a3af49f87d940d02aaad76185fcad45050757 100644 (file)
@@ -3431,6 +3431,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;
 }
index 2286dc12c6bcb63ffc131cb7a94481dcff781a2b..5c8418ebbfd6df6491ac7b4c3f871f989b96a47f 100644 (file)
@@ -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