diff options
-rw-r--r-- | drivers/md/raid10.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 67a8393e3f8..149426cd1e8 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -1419,14 +1419,16 @@ static int enough(struct r10conf *conf, int ignore) do { int n = conf->copies; int cnt = 0; + int this = first; while (n--) { - if (conf->mirrors[first].rdev && - first != ignore) + if (conf->mirrors[this].rdev && + this != ignore) cnt++; - first = (first+1) % conf->raid_disks; + this = (this+1) % conf->raid_disks; } if (cnt == 0) return 0; + first = (first + conf->near_copies) % conf->raid_disks; } while (first != 0); return 1; } |