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/raid1.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/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 99c4e031c7f1..dc9d2def0270 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -601,6 +601,32 @@ static int raid1_issue_flush(request_queue_t *q, struct gendisk *disk, | |||
601 | return ret; | 601 | return ret; |
602 | } | 602 | } |
603 | 603 | ||
604 | static int raid1_congested(void *data, int bits) | ||
605 | { | ||
606 | mddev_t *mddev = data; | ||
607 | conf_t *conf = mddev_to_conf(mddev); | ||
608 | int i, ret = 0; | ||
609 | |||
610 | rcu_read_lock(); | ||
611 | for (i = 0; i < mddev->raid_disks; i++) { | ||
612 | mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev); | ||
613 | if (rdev && !test_bit(Faulty, &rdev->flags)) { | ||
614 | request_queue_t *q = bdev_get_queue(rdev->bdev); | ||
615 | |||
616 | /* Note the '|| 1' - when read_balance prefers | ||
617 | * non-congested targets, it can be removed | ||
618 | */ | ||
619 | if ((bits & (1<<BDI_write_congested)) || 1) | ||
620 | ret |= bdi_congested(&q->backing_dev_info, bits); | ||
621 | else | ||
622 | ret &= bdi_congested(&q->backing_dev_info, bits); | ||
623 | } | ||
624 | } | ||
625 | rcu_read_unlock(); | ||
626 | return ret; | ||
627 | } | ||
628 | |||
629 | |||
604 | /* Barriers.... | 630 | /* Barriers.... |
605 | * Sometimes we need to suspend IO while we do something else, | 631 | * Sometimes we need to suspend IO while we do something else, |
606 | * either some resync/recovery, or reconfigure the array. | 632 | * either some resync/recovery, or reconfigure the array. |
@@ -1965,6 +1991,8 @@ static int run(mddev_t *mddev) | |||
1965 | 1991 | ||
1966 | mddev->queue->unplug_fn = raid1_unplug; | 1992 | mddev->queue->unplug_fn = raid1_unplug; |
1967 | mddev->queue->issue_flush_fn = raid1_issue_flush; | 1993 | mddev->queue->issue_flush_fn = raid1_issue_flush; |
1994 | mddev->queue->backing_dev_info.congested_fn = raid1_congested; | ||
1995 | mddev->queue->backing_dev_info.congested_data = mddev; | ||
1968 | 1996 | ||
1969 | return 0; | 1997 | return 0; |
1970 | 1998 | ||