Commit 79e2de4b authored by Thomas Maier's avatar Thomas Maier Committed by Linus Torvalds

[PATCH] export clear_queue_congested and set_queue_congested

Export the clear_queue_congested() and set_queue_congested() functions
located in ll_rw_blk.c

The functions are renamed to blk_clear_queue_congested() and
blk_set_queue_congested().

(needed in the pktcdvd driver's bio write congestion control)
Signed-off-by: default avatarThomas Maier <balagi@justmail.de>
Cc: Peter Osterlund <petero2@telia.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 26da8205
...@@ -117,7 +117,7 @@ static void blk_queue_congestion_threshold(struct request_queue *q) ...@@ -117,7 +117,7 @@ static void blk_queue_congestion_threshold(struct request_queue *q)
* congested queues, and wake up anyone who was waiting for requests to be * congested queues, and wake up anyone who was waiting for requests to be
* put back. * put back.
*/ */
static void clear_queue_congested(request_queue_t *q, int rw) void blk_clear_queue_congested(request_queue_t *q, int rw)
{ {
enum bdi_state bit; enum bdi_state bit;
wait_queue_head_t *wqh = &congestion_wqh[rw]; wait_queue_head_t *wqh = &congestion_wqh[rw];
...@@ -128,18 +128,20 @@ static void clear_queue_congested(request_queue_t *q, int rw) ...@@ -128,18 +128,20 @@ static void clear_queue_congested(request_queue_t *q, int rw)
if (waitqueue_active(wqh)) if (waitqueue_active(wqh))
wake_up(wqh); wake_up(wqh);
} }
EXPORT_SYMBOL(blk_clear_queue_congested);
/* /*
* A queue has just entered congestion. Flag that in the queue's VM-visible * A queue has just entered congestion. Flag that in the queue's VM-visible
* state flags and increment the global gounter of congested queues. * state flags and increment the global gounter of congested queues.
*/ */
static void set_queue_congested(request_queue_t *q, int rw) void blk_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); set_bit(bit, &q->backing_dev_info.state);
} }
EXPORT_SYMBOL(blk_set_queue_congested);
/** /**
* blk_get_backing_dev_info - get the address of a queue's backing_dev_info * blk_get_backing_dev_info - get the address of a queue's backing_dev_info
...@@ -159,7 +161,6 @@ struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev) ...@@ -159,7 +161,6 @@ struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev)
ret = &q->backing_dev_info; ret = &q->backing_dev_info;
return ret; return ret;
} }
EXPORT_SYMBOL(blk_get_backing_dev_info); EXPORT_SYMBOL(blk_get_backing_dev_info);
void blk_queue_activity_fn(request_queue_t *q, activity_fn *fn, void *data) void blk_queue_activity_fn(request_queue_t *q, activity_fn *fn, void *data)
...@@ -167,7 +168,6 @@ void blk_queue_activity_fn(request_queue_t *q, activity_fn *fn, void *data) ...@@ -167,7 +168,6 @@ void blk_queue_activity_fn(request_queue_t *q, activity_fn *fn, void *data)
q->activity_fn = fn; q->activity_fn = fn;
q->activity_data = data; q->activity_data = data;
} }
EXPORT_SYMBOL(blk_queue_activity_fn); EXPORT_SYMBOL(blk_queue_activity_fn);
/** /**
...@@ -2067,7 +2067,7 @@ static void __freed_request(request_queue_t *q, int rw) ...@@ -2067,7 +2067,7 @@ static void __freed_request(request_queue_t *q, int rw)
struct request_list *rl = &q->rq; struct request_list *rl = &q->rq;
if (rl->count[rw] < queue_congestion_off_threshold(q)) if (rl->count[rw] < queue_congestion_off_threshold(q))
clear_queue_congested(q, rw); blk_clear_queue_congested(q, rw);
if (rl->count[rw] + 1 <= q->nr_requests) { if (rl->count[rw] + 1 <= q->nr_requests) {
if (waitqueue_active(&rl->wait[rw])) if (waitqueue_active(&rl->wait[rw]))
...@@ -2137,7 +2137,7 @@ static struct request *get_request(request_queue_t *q, int rw, struct bio *bio, ...@@ -2137,7 +2137,7 @@ static struct request *get_request(request_queue_t *q, int rw, struct bio *bio,
} }
} }
} }
set_queue_congested(q, rw); blk_set_queue_congested(q, rw);
} }
/* /*
...@@ -3765,14 +3765,14 @@ queue_requests_store(struct request_queue *q, const char *page, size_t count) ...@@ -3765,14 +3765,14 @@ queue_requests_store(struct request_queue *q, const char *page, size_t count)
blk_queue_congestion_threshold(q); blk_queue_congestion_threshold(q);
if (rl->count[READ] >= queue_congestion_on_threshold(q)) if (rl->count[READ] >= queue_congestion_on_threshold(q))
set_queue_congested(q, READ); blk_set_queue_congested(q, READ);
else if (rl->count[READ] < queue_congestion_off_threshold(q)) else if (rl->count[READ] < queue_congestion_off_threshold(q))
clear_queue_congested(q, READ); blk_clear_queue_congested(q, READ);
if (rl->count[WRITE] >= queue_congestion_on_threshold(q)) if (rl->count[WRITE] >= queue_congestion_on_threshold(q))
set_queue_congested(q, WRITE); blk_set_queue_congested(q, WRITE);
else if (rl->count[WRITE] < queue_congestion_off_threshold(q)) else if (rl->count[WRITE] < queue_congestion_off_threshold(q))
clear_queue_congested(q, WRITE); blk_clear_queue_congested(q, WRITE);
if (rl->count[READ] >= q->nr_requests) { if (rl->count[READ] >= q->nr_requests) {
blk_set_queue_full(q, READ); blk_set_queue_full(q, READ);
......
...@@ -651,6 +651,8 @@ extern void blk_recount_segments(request_queue_t *, struct bio *); ...@@ -651,6 +651,8 @@ extern void blk_recount_segments(request_queue_t *, struct bio *);
extern int scsi_cmd_ioctl(struct file *, struct gendisk *, unsigned int, void __user *); extern int scsi_cmd_ioctl(struct file *, struct gendisk *, unsigned int, void __user *);
extern int sg_scsi_ioctl(struct file *, struct request_queue *, extern int sg_scsi_ioctl(struct file *, struct request_queue *,
struct gendisk *, struct scsi_ioctl_command __user *); struct gendisk *, struct scsi_ioctl_command __user *);
extern void blk_clear_queue_congested(request_queue_t *q, int rw);
extern void blk_set_queue_congested(request_queue_t *q, int rw);
extern void blk_start_queue(request_queue_t *q); extern void blk_start_queue(request_queue_t *q);
extern void blk_stop_queue(request_queue_t *q); extern void blk_stop_queue(request_queue_t *q);
extern void blk_sync_queue(struct request_queue *q); extern void blk_sync_queue(struct request_queue *q);
......
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