]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Incremental: support replacement devices.
authorNeilBrown <neilb@suse.de>
Wed, 24 Oct 2012 01:06:51 +0000 (12:06 +1100)
committerNeilBrown <neilb@suse.de>
Wed, 24 Oct 2012 01:06:51 +0000 (12:06 +1100)
These need to be counted in the number of 'active' devices.

Signed-off-by: NeilBrown <neilb@suse.de>
Incremental.c
super1.c

index 9b5ac27d60d11e39dbbb40d890ee74e6af9eef6f..4c889b5f257bc1734b08ae5c288f5150f1430766 100644 (file)
@@ -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<<MD_DISK_REPLACEMENT))
+                       replcnt++;
                st->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) */
index 54e935a4752bc02dfc8bd96b59796f15aac168f6..5bb1f0143790122dd208c4d2b4bc8db498e13ba9 100644 (file)
--- 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;
        }