diff options
-rw-r--r-- | block/blk-core.c | 7 | ||||
-rw-r--r-- | block/blk-mq.c | 5 | ||||
-rw-r--r-- | block/blk-sysfs.c | 2 |
3 files changed, 6 insertions, 8 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 5b6f768a7c01..29d5fbafd94a 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -576,12 +576,9 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id) | |||
576 | if (!q) | 576 | if (!q) |
577 | return NULL; | 577 | return NULL; |
578 | 578 | ||
579 | if (percpu_counter_init(&q->mq_usage_counter, 0)) | ||
580 | goto fail_q; | ||
581 | |||
582 | q->id = ida_simple_get(&blk_queue_ida, 0, 0, gfp_mask); | 579 | q->id = ida_simple_get(&blk_queue_ida, 0, 0, gfp_mask); |
583 | if (q->id < 0) | 580 | if (q->id < 0) |
584 | goto fail_c; | 581 | goto fail_q; |
585 | 582 | ||
586 | q->backing_dev_info.ra_pages = | 583 | q->backing_dev_info.ra_pages = |
587 | (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE; | 584 | (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE; |
@@ -639,8 +636,6 @@ fail_bdi: | |||
639 | bdi_destroy(&q->backing_dev_info); | 636 | bdi_destroy(&q->backing_dev_info); |
640 | fail_id: | 637 | fail_id: |
641 | ida_simple_remove(&blk_queue_ida, q->id); | 638 | ida_simple_remove(&blk_queue_ida, q->id); |
642 | fail_c: | ||
643 | percpu_counter_destroy(&q->mq_usage_counter); | ||
644 | fail_q: | 639 | fail_q: |
645 | kmem_cache_free(blk_requestq_cachep, q); | 640 | kmem_cache_free(blk_requestq_cachep, q); |
646 | return NULL; | 641 | return NULL; |
diff --git a/block/blk-mq.c b/block/blk-mq.c index 07851753a049..e8b5f74dc1a1 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -1781,6 +1781,9 @@ struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *set) | |||
1781 | if (!q) | 1781 | if (!q) |
1782 | goto err_hctxs; | 1782 | goto err_hctxs; |
1783 | 1783 | ||
1784 | if (percpu_counter_init(&q->mq_usage_counter, 0)) | ||
1785 | goto err_map; | ||
1786 | |||
1784 | q->mq_map = blk_mq_make_queue_map(set); | 1787 | q->mq_map = blk_mq_make_queue_map(set); |
1785 | if (!q->mq_map) | 1788 | if (!q->mq_map) |
1786 | goto err_map; | 1789 | goto err_map; |
@@ -1867,6 +1870,8 @@ void blk_mq_free_queue(struct request_queue *q) | |||
1867 | blk_mq_exit_hw_queues(q, set, set->nr_hw_queues); | 1870 | blk_mq_exit_hw_queues(q, set, set->nr_hw_queues); |
1868 | blk_mq_free_hw_queues(q, set); | 1871 | blk_mq_free_hw_queues(q, set); |
1869 | 1872 | ||
1873 | percpu_counter_destroy(&q->mq_usage_counter); | ||
1874 | |||
1870 | free_percpu(q->queue_ctx); | 1875 | free_percpu(q->queue_ctx); |
1871 | kfree(q->queue_hw_ctx); | 1876 | kfree(q->queue_hw_ctx); |
1872 | kfree(q->mq_map); | 1877 | kfree(q->mq_map); |
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 4d6811ac13fd..23321fbab293 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c | |||
@@ -517,8 +517,6 @@ static void blk_release_queue(struct kobject *kobj) | |||
517 | if (q->queue_tags) | 517 | if (q->queue_tags) |
518 | __blk_queue_free_tags(q); | 518 | __blk_queue_free_tags(q); |
519 | 519 | ||
520 | percpu_counter_destroy(&q->mq_usage_counter); | ||
521 | |||
522 | if (q->mq_ops) | 520 | if (q->mq_ops) |
523 | blk_mq_free_queue(q); | 521 | blk_mq_free_queue(q); |
524 | 522 | ||