aboutsummaryrefslogtreecommitdiffstats
path: root/block/cfq-iosched.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/cfq-iosched.c')
-rw-r--r--block/cfq-iosched.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 8e9d84825e1c..052b17487625 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1323,17 +1323,12 @@ cfq_alloc_io_context(struct cfq_data *cfqd, gfp_t gfp_mask)
1323 struct cfq_io_context *cic = kmem_cache_alloc(cfq_ioc_pool, gfp_mask); 1323 struct cfq_io_context *cic = kmem_cache_alloc(cfq_ioc_pool, gfp_mask);
1324 1324
1325 if (cic) { 1325 if (cic) {
1326 RB_CLEAR(&cic->rb_node); 1326 memset(cic, 0, sizeof(*cic));
1327 cic->key = NULL; 1327 RB_CLEAR_COLOR(&cic->rb_node);
1328 cic->cfqq[ASYNC] = NULL;
1329 cic->cfqq[SYNC] = NULL;
1330 cic->last_end_request = jiffies; 1328 cic->last_end_request = jiffies;
1331 cic->ttime_total = 0; 1329 INIT_LIST_HEAD(&cic->queue_list);
1332 cic->ttime_samples = 0;
1333 cic->ttime_mean = 0;
1334 cic->dtor = cfq_free_io_context; 1330 cic->dtor = cfq_free_io_context;
1335 cic->exit = cfq_exit_io_context; 1331 cic->exit = cfq_exit_io_context;
1336 INIT_LIST_HEAD(&cic->queue_list);
1337 atomic_inc(&ioc_count); 1332 atomic_inc(&ioc_count);
1338 } 1333 }
1339 1334
@@ -2251,14 +2246,14 @@ static void cfq_exit_queue(elevator_t *e)
2251 kfree(cfqd); 2246 kfree(cfqd);
2252} 2247}
2253 2248
2254static int cfq_init_queue(request_queue_t *q, elevator_t *e) 2249static void *cfq_init_queue(request_queue_t *q, elevator_t *e)
2255{ 2250{
2256 struct cfq_data *cfqd; 2251 struct cfq_data *cfqd;
2257 int i; 2252 int i;
2258 2253
2259 cfqd = kmalloc(sizeof(*cfqd), GFP_KERNEL); 2254 cfqd = kmalloc(sizeof(*cfqd), GFP_KERNEL);
2260 if (!cfqd) 2255 if (!cfqd)
2261 return -ENOMEM; 2256 return NULL;
2262 2257
2263 memset(cfqd, 0, sizeof(*cfqd)); 2258 memset(cfqd, 0, sizeof(*cfqd));
2264 2259
@@ -2288,8 +2283,6 @@ static int cfq_init_queue(request_queue_t *q, elevator_t *e)
2288 for (i = 0; i < CFQ_QHASH_ENTRIES; i++) 2283 for (i = 0; i < CFQ_QHASH_ENTRIES; i++)
2289 INIT_HLIST_HEAD(&cfqd->cfq_hash[i]); 2284 INIT_HLIST_HEAD(&cfqd->cfq_hash[i]);
2290 2285
2291 e->elevator_data = cfqd;
2292
2293 cfqd->queue = q; 2286 cfqd->queue = q;
2294 2287
2295 cfqd->max_queued = q->nr_requests / 4; 2288 cfqd->max_queued = q->nr_requests / 4;
@@ -2316,14 +2309,14 @@ static int cfq_init_queue(request_queue_t *q, elevator_t *e)
2316 cfqd->cfq_slice_async_rq = cfq_slice_async_rq; 2309 cfqd->cfq_slice_async_rq = cfq_slice_async_rq;
2317 cfqd->cfq_slice_idle = cfq_slice_idle; 2310 cfqd->cfq_slice_idle = cfq_slice_idle;
2318 2311
2319 return 0; 2312 return cfqd;
2320out_crqpool: 2313out_crqpool:
2321 kfree(cfqd->cfq_hash); 2314 kfree(cfqd->cfq_hash);
2322out_cfqhash: 2315out_cfqhash:
2323 kfree(cfqd->crq_hash); 2316 kfree(cfqd->crq_hash);
2324out_crqhash: 2317out_crqhash:
2325 kfree(cfqd); 2318 kfree(cfqd);
2326 return -ENOMEM; 2319 return NULL;
2327} 2320}
2328 2321
2329static void cfq_slab_kill(void) 2322static void cfq_slab_kill(void)