]> err.no Git - linux-2.6/commitdiff
[PATCH] md: define backing_dev_info.congested_fn for raid0 and linear
authorNeilBrown <neilb@suse.de>
Tue, 3 Oct 2006 08:15:53 +0000 (01:15 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 3 Oct 2006 15:04:18 +0000 (08:04 -0700)
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 <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/md/linear.c
drivers/md/raid0.c

index b99c19c7eb2237e6f6583530c849bcfcaa2887c2..c625ddb8833d8b2de3f3d937b899e67b42cb48ae 100644 (file)
@@ -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;
 }
 
index cb8c6317e4e5fc367c7098a87e310b5ed059f724..dfe32149ad3ae1b0caf77fc39003d82cb640f3f7 100644 (file)
@@ -60,6 +60,21 @@ static int raid0_issue_flush(request_queue_t *q, struct gendisk *disk,
        return ret;
 }
 
+static int raid0_congested(void *data, int bits)
+{
+       mddev_t *mddev = data;
+       raid0_conf_t *conf = mddev_to_conf(mddev);
+       mdk_rdev_t **devlist = conf->strip_zone[0].dev;
+       int i, ret = 0;
+
+       for (i = 0; i < mddev->raid_disks && !ret ; i++) {
+               request_queue_t *q = bdev_get_queue(devlist[i]->bdev);
+
+               ret |= bdi_congested(&q->backing_dev_info, bits);
+       }
+       return ret;
+}
+
 
 static int create_strip_zones (mddev_t *mddev)
 {
@@ -236,6 +251,8 @@ static int create_strip_zones (mddev_t *mddev)
        mddev->queue->unplug_fn = raid0_unplug;
 
        mddev->queue->issue_flush_fn = raid0_issue_flush;
+       mddev->queue->backing_dev_info.congested_fn = raid0_congested;
+       mddev->queue->backing_dev_info.congested_data = mddev;
 
        printk("raid0: done.\n");
        return 0;