Commit 0d61cac6 authored by Andrew Morton's avatar Andrew Morton Committed by Dave Jones

[PATCH] remove unused block congestion code

Patch from: Hugh Dickins <hugh@veritas.com>

Removes a ton of dead code from ll_rw_blk.c.  I don't expect we'll be using
this now.
parent 544db1a2
...@@ -56,11 +56,7 @@ static int batch_requests; ...@@ -56,11 +56,7 @@ static int batch_requests;
unsigned long blk_max_low_pfn, blk_max_pfn; unsigned long blk_max_low_pfn, blk_max_pfn;
int blk_nohighio = 0; int blk_nohighio = 0;
static struct congestion_state { static wait_queue_head_t congestion_wqh[2];
wait_queue_head_t wqh;
atomic_t nr_congested_queues;
atomic_t nr_active_queues;
} congestion_states[2];
/* /*
* Return the threshold (number of free requests) at which the queue is * Return the threshold (number of free requests) at which the queue is
...@@ -98,14 +94,12 @@ static inline int queue_congestion_off_threshold(void) ...@@ -98,14 +94,12 @@ static inline int queue_congestion_off_threshold(void)
static void clear_queue_congested(request_queue_t *q, int rw) static void clear_queue_congested(request_queue_t *q, int rw)
{ {
enum bdi_state bit; enum bdi_state bit;
struct congestion_state *cs = &congestion_states[rw]; wait_queue_head_t *wqh = &congestion_wqh[rw];
bit = (rw == WRITE) ? BDI_write_congested : BDI_read_congested; bit = (rw == WRITE) ? BDI_write_congested : BDI_read_congested;
clear_bit(bit, &q->backing_dev_info.state);
if (test_and_clear_bit(bit, &q->backing_dev_info.state)) if (waitqueue_active(wqh))
atomic_dec(&cs->nr_congested_queues); wake_up(wqh);
if (waitqueue_active(&cs->wqh))
wake_up(&cs->wqh);
} }
/* /*
...@@ -117,37 +111,7 @@ static void set_queue_congested(request_queue_t *q, int rw) ...@@ -117,37 +111,7 @@ static void set_queue_congested(request_queue_t *q, int rw)
enum bdi_state bit; enum bdi_state bit;
bit = (rw == WRITE) ? BDI_write_congested : BDI_read_congested; bit = (rw == WRITE) ? BDI_write_congested : BDI_read_congested;
set_bit(bit, &q->backing_dev_info.state);
if (!test_and_set_bit(bit, &q->backing_dev_info.state))
atomic_inc(&congestion_states[rw].nr_congested_queues);
}
/*
* A queue has just put back its last read or write request and has fallen
* idle.
*/
static void clear_queue_active(request_queue_t *q, int rw)
{
enum bdi_state bit;
bit = (rw == WRITE) ? BDI_write_active : BDI_read_active;
if (test_and_clear_bit(bit, &q->backing_dev_info.state))
atomic_dec(&congestion_states[rw].nr_active_queues);
}
/*
* A queue has just taken its first read or write request and has become
* active.
*/
static void set_queue_active(request_queue_t *q, int rw)
{
enum bdi_state bit;
bit = (rw == WRITE) ? BDI_write_active : BDI_read_active;
if (!test_and_set_bit(bit, &q->backing_dev_info.state))
atomic_inc(&congestion_states[rw].nr_active_queues);
} }
/** /**
...@@ -1325,8 +1289,6 @@ static struct request *get_request(request_queue_t *q, int rw) ...@@ -1325,8 +1289,6 @@ static struct request *get_request(request_queue_t *q, int rw)
rq = blkdev_free_rq(&rl->free); rq = blkdev_free_rq(&rl->free);
list_del_init(&rq->queuelist); list_del_init(&rq->queuelist);
rq->ref_count = 1; rq->ref_count = 1;
if (rl->count == queue_nr_requests)
set_queue_active(q, rw);
rl->count--; rl->count--;
if (rl->count < queue_congestion_on_threshold()) if (rl->count < queue_congestion_on_threshold())
set_queue_congested(q, rw); set_queue_congested(q, rw);
...@@ -1569,8 +1531,6 @@ void __blk_put_request(request_queue_t *q, struct request *req) ...@@ -1569,8 +1531,6 @@ void __blk_put_request(request_queue_t *q, struct request *req)
rl->count++; rl->count++;
if (rl->count >= queue_congestion_off_threshold()) if (rl->count >= queue_congestion_off_threshold())
clear_queue_congested(q, rw); clear_queue_congested(q, rw);
if (rl->count == queue_nr_requests)
clear_queue_active(q, rw);
if (rl->count >= batch_requests && waitqueue_active(&rl->wait)) if (rl->count >= batch_requests && waitqueue_active(&rl->wait))
wake_up(&rl->wait); wake_up(&rl->wait);
} }
...@@ -1605,12 +1565,12 @@ void blk_put_request(struct request *req) ...@@ -1605,12 +1565,12 @@ void blk_put_request(struct request *req)
void blk_congestion_wait(int rw, long timeout) void blk_congestion_wait(int rw, long timeout)
{ {
DEFINE_WAIT(wait); DEFINE_WAIT(wait);
struct congestion_state *cs = &congestion_states[rw]; wait_queue_head_t *wqh = &congestion_wqh[rw];
blk_run_queues(); blk_run_queues();
prepare_to_wait(&cs->wqh, &wait, TASK_UNINTERRUPTIBLE); prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE);
io_schedule_timeout(timeout); io_schedule_timeout(timeout);
finish_wait(&cs->wqh, &wait); finish_wait(wqh, &wait);
} }
/* /*
...@@ -2249,11 +2209,8 @@ int __init blk_dev_init(void) ...@@ -2249,11 +2209,8 @@ int __init blk_dev_init(void)
blk_max_low_pfn = max_low_pfn; blk_max_low_pfn = max_low_pfn;
blk_max_pfn = max_pfn; blk_max_pfn = max_pfn;
for (i = 0; i < ARRAY_SIZE(congestion_states); i++) { for (i = 0; i < ARRAY_SIZE(congestion_wqh); i++)
init_waitqueue_head(&congestion_states[i].wqh); init_waitqueue_head(&congestion_wqh[i]);
atomic_set(&congestion_states[i].nr_congested_queues, 0);
atomic_set(&congestion_states[i].nr_active_queues, 0);
}
return 0; return 0;
}; };
......
...@@ -17,8 +17,6 @@ enum bdi_state { ...@@ -17,8 +17,6 @@ enum bdi_state {
BDI_pdflush, /* A pdflush thread is working this device */ BDI_pdflush, /* A pdflush thread is working this device */
BDI_write_congested, /* The write queue is getting full */ BDI_write_congested, /* The write queue is getting full */
BDI_read_congested, /* The read queue is getting full */ BDI_read_congested, /* The read queue is getting full */
BDI_write_active, /* There are one or more queued writes */
BDI_read_active, /* There are one or more queued reads */
BDI_unused, /* Available bits start here */ BDI_unused, /* Available bits start here */
}; };
...@@ -44,14 +42,4 @@ static inline int bdi_write_congested(struct backing_dev_info *bdi) ...@@ -44,14 +42,4 @@ static inline int bdi_write_congested(struct backing_dev_info *bdi)
return test_bit(BDI_write_congested, &bdi->state); return test_bit(BDI_write_congested, &bdi->state);
} }
static inline int bdi_read_active(struct backing_dev_info *bdi)
{
return test_bit(BDI_read_active, &bdi->state);
}
static inline int bdi_write_active(struct backing_dev_info *bdi)
{
return test_bit(BDI_write_active, &bdi->state);
}
#endif /* _LINUX_BACKING_DEV_H */ #endif /* _LINUX_BACKING_DEV_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment