From aa88f531b468349982905ecacf11da2cb6678ce6 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Mon, 28 Jul 2003 23:59:00 +0000 Subject: mdadm-1.3.0 --- Assemble.c | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'Assemble.c') diff --git a/Assemble.c b/Assemble.c index 96e9ebe..cddb76f 100644 --- a/Assemble.c +++ b/Assemble.c @@ -109,6 +109,7 @@ int Assemble(char *mddev, int mdfd, int *best = NULL; /* indexed by raid_disk */ int bestcnt = 0; int devcnt = 0, okcnt, sparecnt; + int req_cnt; int i; int most_recent = 0; int chosen_drive; @@ -365,8 +366,11 @@ int Assemble(char *mddev, int mdfd, * as they don't make sense */ if (first_super.level != -4) - if (!(devices[j].state & (1<= devices[most_recent].events) { devices[j].uptodate = 1; @@ -535,6 +539,17 @@ This doesnt work yet change = 0; } + /* count number of in-sync devices according to the superblock. + * We must have this number to start the array without -s or -R + */ + req_cnt = 0; + for (i=0; i= req_cnt || start_partial_ok) + ))) { if (ioctl(mdfd, RUN_ARRAY, NULL)==0) { fprintf(stderr, Name ": %s has been started with %d drive%s", mddev, okcnt, okcnt==1?"":"s"); + if (okcnt < first_super.raid_disks) + fprintf(stderr, " (out of %d)", first_super.raid_disks); if (sparecnt) fprintf(stderr, " and %d spare%s", sparecnt, sparecnt==1?"":"s"); fprintf(stderr, ".\n"); @@ -596,8 +613,18 @@ This doesnt work yet mddev, okcnt, okcnt==1?"":"s"); return 0; } - fprintf(stderr, Name ": %s assembled from %d drive%s - not enough to start it (use --run to insist).\n", - mddev, okcnt, okcnt==1?"":"s"); + fprintf(stderr, Name ": %s assembled from %d drive%s", mddev, okcnt, okcnt==1?"":"s"); + if (sparecnt) + fprintf(stderr, " and %d spare%s", sparecnt, sparecnt==1?"":"s"); + if (!enough(first_super.level, first_super.raid_disks, okcnt)) + fprintf(stderr, " - not enough to start the array.\n"); + else { + if (req_cnt == first_super.raid_disks) + fprintf(stderr, " - need all %d to start it", req_cnt); + else + fprintf(stderr, " - need %d of %d to start", req_cnt, first_super.raid_disks); + fprintf(stderr, " (use --run to insist).\n"); + } return 1; } else { /* The "chosen_drive" is a good choice, and if necessary, the superblock has -- cgit