From: Robert Elliott <relliott@beardog.cce.hp.com>
To: axboe@kernel.dk, elliott@hp.com, hch@lst.de,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] block: return error if too many reserved tags are requested
Date: Tue, 09 Sep 2014 19:18:07 -0500 [thread overview]
Message-ID: <20140910001806.9294.35884.stgit@beardog.cce.hp.com> (raw)
In-Reply-To: <20140910001417.9294.40414.stgit@beardog.cce.hp.com>
From: Robert Elliott <elliott@hp.com>
Make blk_mq_alloc_tag_set return an error if set->reserved_tags
is greater than BLK_MQ_MAX_DEPTH minus the minimum number of
tags, since:
* set->queue_depth is truncated to that value
* set->reserved_tags needs to be less than set->queue_depth
Signed-off-by: Robert Elliott <elliott@hp.com>
---
block/blk-mq.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index c49fe00..dc2970d 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1936,16 +1936,18 @@ int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set)
return -EINVAL;
if (!set->queue_depth)
return -EINVAL;
+ if (set->reserved_tags > BLK_MQ_MAX_DEPTH - BLK_MQ_TAG_MIN)
+ return -EINVAL;
if (set->queue_depth < set->reserved_tags + BLK_MQ_TAG_MIN)
return -EINVAL;
if (!set->nr_hw_queues || !set->ops->queue_rq || !set->ops->map_queue)
return -EINVAL;
- if (set->queue_depth > BLK_MQ_MAX_DEPTH) {
+ if (set->queue_depth > BLK_MQ_MAX_DEPTH - set->reserved_tags) {
+ set->queue_depth = BLK_MQ_MAX_DEPTH - set->reserved_tags;
pr_info("blk-mq: reduced tag depth to %u\n",
- BLK_MQ_MAX_DEPTH);
- set->queue_depth = BLK_MQ_MAX_DEPTH;
+ set->queue_depth);
}
set->tags = kmalloc_node(set->nr_hw_queues *
next prev parent reply other threads:[~2014-09-10 0:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-10 0:17 [PATCH 0/2] block: rq_affinity default and reserved tag limits Robert Elliott
2014-09-10 0:18 ` [PATCH 1/2] block: default to rq_affinity=2 for blk-mq Robert Elliott
2014-09-10 18:14 ` Jens Axboe
2014-09-10 19:35 ` Elliott, Robert (Server Storage)
2014-09-10 19:51 ` Jens Axboe
2014-09-10 0:18 ` Robert Elliott [this message]
2014-09-10 18:17 ` [PATCH 2/2] block: return error if too many reserved tags are requested Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140910001806.9294.35884.stgit@beardog.cce.hp.com \
--to=relliott@beardog.cce.hp.com \
--cc=axboe@kernel.dk \
--cc=elliott@hp.com \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox