diff options
author | Ming Lei <tom.leiming@gmail.com> | 2014-05-27 11:35:14 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-05-27 11:37:08 -0400 |
commit | 3d2936f457a847d9d88a9cc127e0eb7a0ebba0ff (patch) | |
tree | 575a307f9715ee60ab45dbe31b677c644975f7ad /block/blk-mq.c | |
parent | 624dbe47541643b72868a59b2c0059bb53dc923f (diff) |
block: only allocate/free mq_usage_counter in blk-mq
The percpu counter is only used for blk-mq, so move
its allocation and free inside blk-mq, and don't
allocate it for legacy queue device.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r-- | block/blk-mq.c | 5 |
1 files changed, 5 insertions, 0 deletions
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); |