From 26be34dc3a46be983352dd89683db374b0cb73fa Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 3 Oct 2006 01:15:53 -0700 Subject: [PATCH] md: define backing_dev_info.congested_fn for raid0 and linear Each backing_dev needs to be able to report whether it is congested, either by modulating BDI_*_congested in ->state, or by defining a ->congested_fn. md/raid did neither of these. This patch add a congested_fn which simply checks all component devices to see if they are congested. Signed-off-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/md/linear.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'drivers/md/linear.c') diff --git a/drivers/md/linear.c b/drivers/md/linear.c index b99c19c7eb22..c625ddb8833d 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c @@ -111,6 +111,19 @@ static int linear_issue_flush(request_queue_t *q, struct gendisk *disk, return ret; } +static int linear_congested(void *data, int bits) +{ + mddev_t *mddev = data; + linear_conf_t *conf = mddev_to_conf(mddev); + int i, ret = 0; + + for (i = 0; i < mddev->raid_disks && !ret ; i++) { + request_queue_t *q = bdev_get_queue(conf->disks[i].rdev->bdev); + ret |= bdi_congested(&q->backing_dev_info, bits); + } + return ret; +} + static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) { linear_conf_t *conf; @@ -269,6 +282,8 @@ static int linear_run (mddev_t *mddev) blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec); mddev->queue->unplug_fn = linear_unplug; mddev->queue->issue_flush_fn = linear_issue_flush; + mddev->queue->backing_dev_info.congested_fn = linear_congested; + mddev->queue->backing_dev_info.congested_data = mddev; return 0; } -- cgit v1.2.3