Commit 229a9287 authored by Omar Sandoval's avatar Omar Sandoval Committed by Jens Axboe

blk-mq: add shallow depth option for blk_mq_get_tag()

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: default avatarOmar Sandoval <osandov@fb.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent c05e6673
...@@ -96,7 +96,10 @@ static int __blk_mq_get_tag(struct blk_mq_alloc_data *data, ...@@ -96,7 +96,10 @@ static int __blk_mq_get_tag(struct blk_mq_alloc_data *data,
if (!(data->flags & BLK_MQ_REQ_INTERNAL) && if (!(data->flags & BLK_MQ_REQ_INTERNAL) &&
!hctx_may_queue(data->hctx, bt)) !hctx_may_queue(data->hctx, bt))
return -1; 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) unsigned int blk_mq_get_tag(struct blk_mq_alloc_data *data)
......
...@@ -141,6 +141,7 @@ struct blk_mq_alloc_data { ...@@ -141,6 +141,7 @@ struct blk_mq_alloc_data {
/* input parameter */ /* input parameter */
struct request_queue *q; struct request_queue *q;
unsigned int flags; unsigned int flags;
unsigned int shallow_depth;
/* input & output parameter */ /* input & output parameter */
struct blk_mq_ctx *ctx; struct blk_mq_ctx *ctx;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment