summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Detail.c4
-rw-r--r--mdadm.h2
-rw-r--r--mdstat.c22
3 files changed, 22 insertions, 6 deletions
diff --git a/Detail.c b/Detail.c
index e0817aac..fdfffb72 100644
--- a/Detail.c
+++ b/Detail.c
@@ -355,6 +355,7 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
if (atime)
printf(" Update Time : %.24s\n", ctime(&atime));
if (array.raid_disks) {
+ static char *sync_action[] = {", recovering",", resyncing",", reshaping",", checking"};
char *st;
if (avail_disks == array.raid_disks)
st = "";
@@ -367,8 +368,7 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
printf(" State : %s%s%s%s\n",
(array.state&(1<<MD_SB_CLEAN))?"clean":"active",
st,
- (!e || e->percent < 0) ? "" :
- (e->resync) ? ", resyncing": ", recovering",
+ (!e || e->percent < 0) ? "" : sync_action[e->resync],
larray_size ? "": ", Not Started");
}
if (array.raid_disks)
diff --git a/mdadm.h b/mdadm.h
index 3e229103..577d858e 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -355,7 +355,7 @@ struct mdstat_ent {
char *level;
char *pattern; /* U or up, _ for down */
int percent; /* -1 if no resync */
- int resync; /* 1 if resync, 0 if recovery */
+ int resync; /* 3 if check, 2 if reshape, 1 if resync, 0 if recovery */
int devcnt;
int raid_disks;
int chunk_size;
diff --git a/mdstat.c b/mdstat.c
index 47be2bba..bb030bf3 100644
--- a/mdstat.c
+++ b/mdstat.c
@@ -241,11 +241,27 @@ struct mdstat_ent *mdstat_read(int hold, int start)
w[l-1] == '%' &&
(eq=strchr(w, '=')) != NULL ) {
ent->percent = atoi(eq+1);
- if (strncmp(w,"resync", 4)==0)
+ if (strncmp(w,"resync", 6)==0)
ent->resync = 1;
+ else if (strncmp(w, "reshape", 7)==0)
+ ent->resync = 2;
+ else
+ ent->resync = 0;
} else if (ent->percent == -1 &&
- strncmp(w, "resync", 4)==0) {
- ent->resync = 1;
+ (w[0] == 'r' || w[0] == 'c')) {
+ if (strncmp(w, "resync", 4)==0)
+ ent->resync = 1;
+ if (strncmp(w, "reshape", 7)==0)
+ ent->resync = 2;
+ if (strncmp(w, "recovery", 8)==0)
+ ent->resync = 2;
+ if (strncmp(w, "check", 5)==0)
+ ent->resync = 3;
+
+ if (l > 8 && strcmp(w+l-8, "=DELAYED"))
+ ent->percent = 0;
+ if (l > 8 && strcmp(w+l-8, "=PENDING"))
+ ent->percent = 0;
} else if (ent->percent == -1 &&
w[0] >= '0' &&
w[0] <= '9' &&