]> git.baikalelectronics.ru Git - kernel.git/commitdiff
blk-mq: add shallow depth option for blk_mq_get_tag()
authorOmar Sandoval <osandov@fb.com>
Fri, 14 Apr 2017 07:59:59 +0000 (00:59 -0700)
committerJens Axboe <axboe@fb.com>
Fri, 14 Apr 2017 20:06:54 +0000 (14:06 -0600)
Wire up the sbitmap_get_shallow() operation to the tag code so that a
caller can limit the number of tags available to it.

Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-mq-tag.c
block/blk-mq.h

index 9d97bfc4d4657b586d1a9b4d077a8e673300d79a..d0be72ccb0914c74fd9140ed112228832752ee6d 100644 (file)
@@ -96,7 +96,10 @@ static int __blk_mq_get_tag(struct blk_mq_alloc_data *data,
        if (!(data->flags & BLK_MQ_REQ_INTERNAL) &&
            !hctx_may_queue(data->hctx, bt))
                return -1;
-       return __sbitmap_queue_get(bt);
+       if (data->shallow_depth)
+               return __sbitmap_queue_get_shallow(bt, data->shallow_depth);
+       else
+               return __sbitmap_queue_get(bt);
 }
 
 unsigned int blk_mq_get_tag(struct blk_mq_alloc_data *data)
index 7e6f2e467696e1c1bd22f4d5839f0a9b788084e9..524f44742816cb308abea01c6baaaa9203bbc863 100644 (file)
@@ -141,6 +141,7 @@ struct blk_mq_alloc_data {
        /* input parameter */
        struct request_queue *q;
        unsigned int flags;
+       unsigned int shallow_depth;
 
        /* input & output parameter */
        struct blk_mq_ctx *ctx;