diff options
author | NeilBrown <neilb@suse.de> | 2006-10-03 04:15:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-03 11:04:18 -0400 |
commit | 0d12922823408b26f83b15cae4a4feff4bd22f28 (patch) | |
tree | a3509f442e6fc75ca9304757ffa3dce4918ef55e /drivers/md/raid10.c | |
parent | 26be34dc3a46be983352dd89683db374b0cb73fa (diff) |
[PATCH] md: define ->congested_fn for raid1, raid10, and multipath
raid1, raid10 and multipath don't report their 'congested' status through
bdi_*_congested, but should.
This patch adds the appropriate functions which just check the 'congested'
status of all active members (with appropriate locking).
raid1 read_balance should be modified to prefer devices where
bdi_read_congested returns false. Then we could use the '&' branch rather
than the '|' branch. However that should would need some benchmarking first
to make sure it is actually a good idea.
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r-- | drivers/md/raid10.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 64f8016ab740..1250f0eab4af 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -648,6 +648,26 @@ static int raid10_issue_flush(request_queue_t *q, struct gendisk *disk, | |||
648 | return ret; | 648 | return ret; |
649 | } | 649 | } |
650 | 650 | ||
651 | static int raid10_congested(void *data, int bits) | ||
652 | { | ||
653 | mddev_t *mddev = data; | ||
654 | conf_t *conf = mddev_to_conf(mddev); | ||
655 | int i, ret = 0; | ||
656 | |||
657 | rcu_read_lock(); | ||
658 | for (i = 0; i < mddev->raid_disks && ret == 0; i++) { | ||
659 | mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev); | ||
660 | if (rdev && !test_bit(Faulty, &rdev->flags)) { | ||
661 | request_queue_t *q = bdev_get_queue(rdev->bdev); | ||
662 | |||
663 | ret |= bdi_congested(&q->backing_dev_info, bits); | ||
664 | } | ||
665 | } | ||
666 | rcu_read_unlock(); | ||
667 | return ret; | ||
668 | } | ||
669 | |||
670 | |||
651 | /* Barriers.... | 671 | /* Barriers.... |
652 | * Sometimes we need to suspend IO while we do something else, | 672 | * Sometimes we need to suspend IO while we do something else, |
653 | * either some resync/recovery, or reconfigure the array. | 673 | * either some resync/recovery, or reconfigure the array. |
@@ -2094,6 +2114,8 @@ static int run(mddev_t *mddev) | |||
2094 | 2114 | ||
2095 | mddev->queue->unplug_fn = raid10_unplug; | 2115 | mddev->queue->unplug_fn = raid10_unplug; |
2096 | mddev->queue->issue_flush_fn = raid10_issue_flush; | 2116 | mddev->queue->issue_flush_fn = raid10_issue_flush; |
2117 | mddev->queue->backing_dev_info.congested_fn = raid10_congested; | ||
2118 | mddev->queue->backing_dev_info.congested_data = mddev; | ||
2097 | 2119 | ||
2098 | /* Calculate max read-ahead size. | 2120 | /* Calculate max read-ahead size. |
2099 | * We need to readahead at least twice a whole stripe.... | 2121 | * We need to readahead at least twice a whole stripe.... |