From e0bf68ddec4f4f90e5871404be4f1854c17f3120 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Tue, 16 Oct 2007 23:25:46 -0700 Subject: mm: bdi init hooks provide BDI constructor/destructor hooks [akpm@linux-foundation.org: compile fix] Signed-off-by: Peter Zijlstra Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- block/ll_rw_blk.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'block') diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c index 9eabac95fbe..524404bd08c 100644 --- a/block/ll_rw_blk.c +++ b/block/ll_rw_blk.c @@ -1786,6 +1786,7 @@ static void blk_release_queue(struct kobject *kobj) blk_trace_shutdown(q); + bdi_destroy(&q->backing_dev_info); kmem_cache_free(requestq_cachep, q); } @@ -1839,21 +1840,27 @@ static struct kobj_type queue_ktype; struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id) { struct request_queue *q; + int err; q = kmem_cache_alloc_node(requestq_cachep, gfp_mask | __GFP_ZERO, node_id); if (!q) return NULL; + q->backing_dev_info.unplug_io_fn = blk_backing_dev_unplug; + q->backing_dev_info.unplug_io_data = q; + err = bdi_init(&q->backing_dev_info); + if (err) { + kmem_cache_free(requestq_cachep, q); + return NULL; + } + init_timer(&q->unplug_timer); kobject_set_name(&q->kobj, "%s", "queue"); q->kobj.ktype = &queue_ktype; kobject_init(&q->kobj); - q->backing_dev_info.unplug_io_fn = blk_backing_dev_unplug; - q->backing_dev_info.unplug_io_data = q; - mutex_init(&q->sysfs_lock); return q; -- cgit v1.2.3