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/multipath.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/multipath.c')
-rw-r--r-- | drivers/md/multipath.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index e4f168d063db..171ff41b52b0 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c | |||
@@ -228,6 +228,28 @@ static int multipath_issue_flush(request_queue_t *q, struct gendisk *disk, | |||
228 | rcu_read_unlock(); | 228 | rcu_read_unlock(); |
229 | return ret; | 229 | return ret; |
230 | } | 230 | } |
231 | static int multipath_congested(void *data, int bits) | ||
232 | { | ||
233 | mddev_t *mddev = data; | ||
234 | multipath_conf_t *conf = mddev_to_conf(mddev); | ||
235 | int i, ret = 0; | ||
236 | |||
237 | rcu_read_lock(); | ||
238 | for (i = 0; i < mddev->raid_disks ; i++) { | ||
239 | mdk_rdev_t *rdev = rcu_dereference(conf->multipaths[i].rdev); | ||
240 | if (rdev && !test_bit(Faulty, &rdev->flags)) { | ||
241 | request_queue_t *q = bdev_get_queue(rdev->bdev); | ||
242 | |||
243 | ret |= bdi_congested(&q->backing_dev_info, bits); | ||
244 | /* Just like multipath_map, we just check the | ||
245 | * first available device | ||
246 | */ | ||
247 | break; | ||
248 | } | ||
249 | } | ||
250 | rcu_read_unlock(); | ||
251 | return ret; | ||
252 | } | ||
231 | 253 | ||
232 | /* | 254 | /* |
233 | * Careful, this can execute in IRQ contexts as well! | 255 | * Careful, this can execute in IRQ contexts as well! |
@@ -509,6 +531,8 @@ static int multipath_run (mddev_t *mddev) | |||
509 | 531 | ||
510 | mddev->queue->unplug_fn = multipath_unplug; | 532 | mddev->queue->unplug_fn = multipath_unplug; |
511 | mddev->queue->issue_flush_fn = multipath_issue_flush; | 533 | mddev->queue->issue_flush_fn = multipath_issue_flush; |
534 | mddev->queue->backing_dev_info.congested_fn = multipath_congested; | ||
535 | mddev->queue->backing_dev_info.congested_data = mddev; | ||
512 | 536 | ||
513 | return 0; | 537 | return 0; |
514 | 538 | ||