md/raid10: fix "enough" function for detecting if array is failed.
[deliverable/linux.git] / drivers / md / raid10.c
index 1c2eb38f3c51a6dcc93148ca34b1a6a1de7aa465..0138a727c1f3c220bc91a02c9bdf720599465eb9 100644 (file)
@@ -1512,14 +1512,16 @@ static int _enough(struct r10conf *conf, struct geom *geo, 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) % geo->raid_disks;
+                       this = (this+1) % geo->raid_disks;
                }
                if (cnt == 0)
                        return 0;
+               first = (first + geo->near_copies) % geo->raid_disks;
        } while (first != 0);
        return 1;
 }
This page took 0.055337 seconds and 5 git commands to generate.