aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/blk-mq.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 4e4cd6208052..a6ee74e27957 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1967,13 +1967,19 @@ static int blk_mq_queue_reinit_notify(struct notifier_block *nb,
1967 return NOTIFY_OK; 1967 return NOTIFY_OK;
1968} 1968}
1969 1969
1970/*
1971 * Alloc a tag set to be associated with one or more request queues.
1972 * May fail with EINVAL for various error conditions. May adjust the
1973 * requested depth down, if if it too large. In that case, the set
1974 * value will be stored in set->queue_depth.
1975 */
1970int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set) 1976int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set)
1971{ 1977{
1972 int i; 1978 int i;
1973 1979
1974 if (!set->nr_hw_queues) 1980 if (!set->nr_hw_queues)
1975 return -EINVAL; 1981 return -EINVAL;
1976 if (!set->queue_depth || set->queue_depth > BLK_MQ_MAX_DEPTH) 1982 if (!set->queue_depth)
1977 return -EINVAL; 1983 return -EINVAL;
1978 if (set->queue_depth < set->reserved_tags + BLK_MQ_TAG_MIN) 1984 if (set->queue_depth < set->reserved_tags + BLK_MQ_TAG_MIN)
1979 return -EINVAL; 1985 return -EINVAL;
@@ -1981,6 +1987,11 @@ int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set)
1981 if (!set->nr_hw_queues || !set->ops->queue_rq || !set->ops->map_queue) 1987 if (!set->nr_hw_queues || !set->ops->queue_rq || !set->ops->map_queue)
1982 return -EINVAL; 1988 return -EINVAL;
1983 1989
1990 if (set->queue_depth > BLK_MQ_MAX_DEPTH) {
1991 pr_info("blk-mq: reduced tag depth to %u\n",
1992 BLK_MQ_MAX_DEPTH);
1993 set->queue_depth = BLK_MQ_MAX_DEPTH;
1994 }
1984 1995
1985 set->tags = kmalloc_node(set->nr_hw_queues * 1996 set->tags = kmalloc_node(set->nr_hw_queues *
1986 sizeof(struct blk_mq_tags *), 1997 sizeof(struct blk_mq_tags *),