Merge branch 'acpi-pci-hotplug'
[cascardo/linux.git] / block / blk-tag.c
index 4af6f5c..3f33d86 100644 (file)
@@ -186,7 +186,8 @@ int blk_queue_init_tags(struct request_queue *q, int depth,
                tags = __blk_queue_init_tags(q, depth);
 
                if (!tags)
-                       goto fail;
+                       return -ENOMEM;
+
        } else if (q->queue_tags) {
                rc = blk_queue_resize_tags(q, depth);
                if (rc)
@@ -203,9 +204,6 @@ int blk_queue_init_tags(struct request_queue *q, int depth,
        queue_flag_set_unlocked(QUEUE_FLAG_QUEUED, q);
        INIT_LIST_HEAD(&q->tag_busy_list);
        return 0;
-fail:
-       kfree(tags);
-       return -ENOMEM;
 }
 EXPORT_SYMBOL(blk_queue_init_tags);
 
@@ -350,9 +348,16 @@ int blk_queue_start_tag(struct request_queue *q, struct request *rq)
         */
        max_depth = bqt->max_depth;
        if (!rq_is_sync(rq) && max_depth > 1) {
-               max_depth -= 2;
-               if (!max_depth)
+               switch (max_depth) {
+               case 2:
                        max_depth = 1;
+                       break;
+               case 3:
+                       max_depth = 2;
+                       break;
+               default:
+                       max_depth -= 2;
+               }
                if (q->in_flight[BLK_RW_ASYNC] > max_depth)
                        return 1;
        }