summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/util.c b/util.c
index 83f3187..eef0d6f 100644
--- a/util.c
+++ b/util.c
@@ -332,14 +332,15 @@ int enough(int level, int raid_disks, int layout, int clean, char *avail)
/* there must be one of the 'copies' form 'first' */
int n = copies;
int cnt=0;
+ int this = first;
while (n--) {
- if (avail[first])
+ if (avail[this])
cnt++;
- first = (first+1) % raid_disks;
+ this = (this+1) % raid_disks;
}
if (cnt == 0)
return 0;
-
+ first = (first+(layout&255)) % raid_disks;
} while (first != 0);
return 1;