From: NeilBrown Date: Wed, 24 Oct 2012 01:06:51 +0000 (+1100) Subject: Incremental: support replacement devices. X-Git-Tag: mdadm-3.3-rc1~162 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=72e7fb13f0154eb59941cfbe69e75c830bde4441;p=thirdparty%2Fmdadm.git Incremental: support replacement devices. These need to be counted in the number of 'active' devices. Signed-off-by: NeilBrown --- diff --git a/Incremental.c b/Incremental.c index 9b5ac27d..4c889b5f 100644 --- a/Incremental.c +++ b/Incremental.c @@ -641,6 +641,7 @@ static int count_active(struct supertype *st, struct mdinfo *sra, /* count how many devices in sra think they are active */ struct mdinfo *d; int cnt = 0; + int replcnt = 0; __u64 max_events = 0; char *avail = NULL; int *best = NULL; @@ -716,7 +717,8 @@ static int count_active(struct supertype *st, struct mdinfo *sra, best[info.disk.raid_disk] = devnum; st->ss->getinfo_super(st, bestinfo, NULL); } - } + } else if (info.disk.state & (1<ss->free_super(st); } if (!avail) @@ -743,7 +745,7 @@ static int count_active(struct supertype *st, struct mdinfo *sra, } free(best); free(devmap); - return cnt; + return cnt + replcnt; } /* test if container has degraded member(s) */ diff --git a/super1.c b/super1.c index 54e935a4..5bb1f014 100644 --- a/super1.c +++ b/super1.c @@ -767,6 +767,7 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map) info->name[32] = 0; if ((__le32_to_cpu(sb->feature_map)&MD_FEATURE_REPLACEMENT)) { + info->disk.state &= ~(1 << MD_DISK_SYNC); info->disk.state |= 1 << MD_DISK_REPLACEMENT; }