]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - block/blk-mq-sched.c
UBUNTU: Ubuntu-4.13.0-45.50
[mirror_ubuntu-artful-kernel.git] / block / blk-mq-sched.c
index 7f0dc48ffb40895a499208474536e300f2efab34..4ab69435708c2b04df3ba3bda332fdfe74a5aac5 100644 (file)
@@ -515,10 +515,12 @@ int blk_mq_init_sched(struct request_queue *q, struct elevator_type *e)
        }
 
        /*
-        * Default to 256, since we don't split into sync/async like the
-        * old code did. Additionally, this is a per-hw queue depth.
+        * Default to double of smaller one between hw queue_depth and 128,
+        * since we don't split into sync/async like the old code did.
+        * Additionally, this is a per-hw queue depth.
         */
-       q->nr_requests = 2 * BLKDEV_MAX_RQ;
+       q->nr_requests = 2 * min_t(unsigned int, q->tag_set->queue_depth,
+                                  BLKDEV_MAX_RQ);
 
        queue_for_each_hw_ctx(q, hctx, i) {
                ret = blk_mq_sched_alloc_tags(q, hctx, i);