diff options
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 | ||