aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-03-18 12:05:37 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2006-03-18 18:35:05 -0500
commita90d742e4cbbc217c402265eb8b8bb0e0f9f8da2 (patch)
treea2423ca7cf3249a4c8b2c55021e0ae8f089b35e7 /block
parent483f4afc421435b7cfe5e88f74eea0b73a476d75 (diff)
[PATCH] don't bother with refcounting for cfq_data
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'block')
-rw-r--r--block/cfq-iosched.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 2949920df45d..9af4044dad5e 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -114,7 +114,6 @@ static struct completion *ioc_gone;
114 * Per block device queue structure 114 * Per block device queue structure
115 */ 115 */
116struct cfq_data { 116struct cfq_data {
117 atomic_t ref;
118 request_queue_t *queue; 117 request_queue_t *queue;
119 118
120 /* 119 /*
@@ -295,7 +294,6 @@ CFQ_CRQ_FNS(is_sync);
295 294
296static struct cfq_queue *cfq_find_cfq_hash(struct cfq_data *, unsigned int, unsigned short); 295static struct cfq_queue *cfq_find_cfq_hash(struct cfq_data *, unsigned int, unsigned short);
297static void cfq_dispatch_insert(request_queue_t *, struct cfq_rq *); 296static void cfq_dispatch_insert(request_queue_t *, struct cfq_rq *);
298static void cfq_put_cfqd(struct cfq_data *cfqd);
299static struct cfq_queue *cfq_get_queue(struct cfq_data *cfqd, unsigned int key, struct task_struct *tsk, gfp_t gfp_mask); 297static struct cfq_queue *cfq_get_queue(struct cfq_data *cfqd, unsigned int key, struct task_struct *tsk, gfp_t gfp_mask);
300 298
301#define process_sync(tsk) ((tsk)->flags & PF_SYNCWRITE) 299#define process_sync(tsk) ((tsk)->flags & PF_SYNCWRITE)
@@ -1168,8 +1166,6 @@ static void cfq_put_queue(struct cfq_queue *cfqq)
1168 if (unlikely(cfqd->active_queue == cfqq)) 1166 if (unlikely(cfqd->active_queue == cfqq))
1169 __cfq_slice_expired(cfqd, cfqq, 0); 1167 __cfq_slice_expired(cfqd, cfqq, 0);
1170 1168
1171 cfq_put_cfqd(cfqq->cfqd);
1172
1173 /* 1169 /*
1174 * it's on the empty list and still hashed 1170 * it's on the empty list and still hashed
1175 */ 1171 */
@@ -1442,7 +1438,6 @@ retry:
1442 hlist_add_head(&cfqq->cfq_hash, &cfqd->cfq_hash[hashval]); 1438 hlist_add_head(&cfqq->cfq_hash, &cfqd->cfq_hash[hashval]);
1443 atomic_set(&cfqq->ref, 0); 1439 atomic_set(&cfqq->ref, 0);
1444 cfqq->cfqd = cfqd; 1440 cfqq->cfqd = cfqd;
1445 atomic_inc(&cfqd->ref);
1446 cfqq->service_last = 0; 1441 cfqq->service_last = 0;
1447 /* 1442 /*
1448 * set ->slice_left to allow preemption for a new process 1443 * set ->slice_left to allow preemption for a new process
@@ -2144,19 +2139,6 @@ static void cfq_shutdown_timer_wq(struct cfq_data *cfqd)
2144 blk_sync_queue(cfqd->queue); 2139 blk_sync_queue(cfqd->queue);
2145} 2140}
2146 2141
2147static void cfq_put_cfqd(struct cfq_data *cfqd)
2148{
2149 if (!atomic_dec_and_test(&cfqd->ref))
2150 return;
2151
2152 cfq_shutdown_timer_wq(cfqd);
2153
2154 mempool_destroy(cfqd->crq_pool);
2155 kfree(cfqd->crq_hash);
2156 kfree(cfqd->cfq_hash);
2157 kfree(cfqd);
2158}
2159
2160static void cfq_exit_queue(elevator_t *e) 2142static void cfq_exit_queue(elevator_t *e)
2161{ 2143{
2162 struct cfq_data *cfqd = e->elevator_data; 2144 struct cfq_data *cfqd = e->elevator_data;
@@ -2184,7 +2166,13 @@ static void cfq_exit_queue(elevator_t *e)
2184 } 2166 }
2185 spin_unlock_irq(q->queue_lock); 2167 spin_unlock_irq(q->queue_lock);
2186 write_unlock(&cfq_exit_lock); 2168 write_unlock(&cfq_exit_lock);
2187 cfq_put_cfqd(cfqd); 2169
2170 cfq_shutdown_timer_wq(cfqd);
2171
2172 mempool_destroy(cfqd->crq_pool);
2173 kfree(cfqd->crq_hash);
2174 kfree(cfqd->cfq_hash);
2175 kfree(cfqd);
2188} 2176}
2189 2177
2190static int cfq_init_queue(request_queue_t *q, elevator_t *e) 2178static int cfq_init_queue(request_queue_t *q, elevator_t *e)
@@ -2241,8 +2229,6 @@ static int cfq_init_queue(request_queue_t *q, elevator_t *e)
2241 2229
2242 INIT_WORK(&cfqd->unplug_work, cfq_kick_queue, q); 2230 INIT_WORK(&cfqd->unplug_work, cfq_kick_queue, q);
2243 2231
2244 atomic_set(&cfqd->ref, 1);
2245
2246 cfqd->cfq_queued = cfq_queued; 2232 cfqd->cfq_queued = cfq_queued;
2247 cfqd->cfq_quantum = cfq_quantum; 2233 cfqd->cfq_quantum = cfq_quantum;
2248 cfqd->cfq_fifo_expire[0] = cfq_fifo_expire[0]; 2234 cfqd->cfq_fifo_expire[0] = cfq_fifo_expire[0];