aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-core.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-12-13 18:33:37 -0500
committerJens Axboe <axboe@kernel.dk>2011-12-13 18:33:37 -0500
commita73f730d013ff2788389fd0c46ad3e5510f124e6 (patch)
tree773987c8cbec56745d46f46382ad268ed91adf98 /block/blk-core.c
parent8ba61435d73f2274e12d4d823fde06735e8f6a54 (diff)
block, cfq: move cfqd->cic_index to q->id
cfq allocates per-queue id using ida and uses it to index cic radix tree from io_context. Move it to q->id and allocate on queue init and free on queue release. This simplifies cfq a bit and will allow for further improvements of io context life-cycle management. This patch doesn't introduce any functional difference. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-core.c')
-rw-r--r--block/blk-core.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 30add45a87ef..af7301581172 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -39,6 +39,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(block_bio_remap);
39EXPORT_TRACEPOINT_SYMBOL_GPL(block_rq_remap); 39EXPORT_TRACEPOINT_SYMBOL_GPL(block_rq_remap);
40EXPORT_TRACEPOINT_SYMBOL_GPL(block_bio_complete); 40EXPORT_TRACEPOINT_SYMBOL_GPL(block_bio_complete);
41 41
42DEFINE_IDA(blk_queue_ida);
43
42/* 44/*
43 * For the allocated request tables 45 * For the allocated request tables
44 */ 46 */
@@ -474,6 +476,10 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
474 if (!q) 476 if (!q)
475 return NULL; 477 return NULL;
476 478
479 q->id = ida_simple_get(&blk_queue_ida, 0, 0, GFP_KERNEL);
480 if (q->id < 0)
481 goto fail_q;
482
477 q->backing_dev_info.ra_pages = 483 q->backing_dev_info.ra_pages =
478 (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE; 484 (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE;
479 q->backing_dev_info.state = 0; 485 q->backing_dev_info.state = 0;
@@ -481,15 +487,11 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
481 q->backing_dev_info.name = "block"; 487 q->backing_dev_info.name = "block";
482 488
483 err = bdi_init(&q->backing_dev_info); 489 err = bdi_init(&q->backing_dev_info);
484 if (err) { 490 if (err)
485 kmem_cache_free(blk_requestq_cachep, q); 491 goto fail_id;
486 return NULL;
487 }
488 492
489 if (blk_throtl_init(q)) { 493 if (blk_throtl_init(q))
490 kmem_cache_free(blk_requestq_cachep, q); 494 goto fail_id;
491 return NULL;
492 }
493 495
494 setup_timer(&q->backing_dev_info.laptop_mode_wb_timer, 496 setup_timer(&q->backing_dev_info.laptop_mode_wb_timer,
495 laptop_mode_timer_fn, (unsigned long) q); 497 laptop_mode_timer_fn, (unsigned long) q);
@@ -512,6 +514,12 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
512 q->queue_lock = &q->__queue_lock; 514 q->queue_lock = &q->__queue_lock;
513 515
514 return q; 516 return q;
517
518fail_id:
519 ida_simple_remove(&blk_queue_ida, q->id);
520fail_q:
521 kmem_cache_free(blk_requestq_cachep, q);
522 return NULL;
515} 523}
516EXPORT_SYMBOL(blk_alloc_queue_node); 524EXPORT_SYMBOL(blk_alloc_queue_node);
517 525