diff options
author | NeilBrown <neilb@suse.de> | 2012-06-04 04:31:40 +0200 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-06-04 04:31:40 +0200 |
commit | 9dad51d41853a1bf791dfe418b67fefac21c4670 (patch) | |
tree | 02418b4e58745742430fa3f0c2fec9ce2e712a61 /mdstat.c | |
parent | Monitor: Allow correct monitoring of more member devices. (diff) | |
download | mdadm-9dad51d41853a1bf791dfe418b67fefac21c4670.tar.xz mdadm-9dad51d41853a1bf791dfe418b67fefac21c4670.zip |
Monitor: fix inconsistencies in values for ->percent
->percent sometimes stores negative values recording states
like 'pending' or 'delayed'.
The value '-2' means both 'delayed' and in Monitor, 'unknown'.
Also, '-1' has a meaning but not #define.
So change the #defines to be prefixed with "RESYNC_", instead
of "PROCESS_", add new "_NONE" and "_UNKNOWN", and use correct
value in each location.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'mdstat.c')
-rw-r--r-- | mdstat.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -185,7 +185,7 @@ struct mdstat_ent *mdstat_read(int hold, int start) } ent->dev = ent->level = ent->pattern= NULL; ent->next = NULL; - ent->percent = -1; + ent->percent = RESYNC_NONE; ent->active = -1; ent->resync = 0; ent->metadata_version = NULL; @@ -240,7 +240,7 @@ struct mdstat_ent *mdstat_read(int hold, int start) ent->pattern = strdup(w+1); if (ent->pattern[l-2]==']') ent->pattern[l-2] = '\0'; - } else if (ent->percent == -1 && + } else if (ent->percent == RESYNC_NONE && strncmp(w, "re", 2)== 0 && w[l-1] == '%' && (eq=strchr(w, '=')) != NULL ) { @@ -251,7 +251,7 @@ struct mdstat_ent *mdstat_read(int hold, int start) ent->resync = 2; else ent->resync = 0; - } else if (ent->percent == -1 && + } else if (ent->percent == RESYNC_NONE && (w[0] == 'r' || w[0] == 'c')) { if (strncmp(w, "resync", 4)==0) ent->resync = 1; @@ -263,10 +263,10 @@ struct mdstat_ent *mdstat_read(int hold, int start) ent->resync = 3; if (l > 8 && strcmp(w+l-8, "=DELAYED") == 0) - ent->percent = PROCESS_DELAYED; + ent->percent = RESYNC_DELAYED; if (l > 8 && strcmp(w+l-8, "=PENDING") == 0) - ent->percent = PROCESS_PENDING; - } else if (ent->percent == -1 && + ent->percent = RESYNC_PENDING; + } else if (ent->percent == RESYNC_NONE && w[0] >= '0' && w[0] <= '9' && w[l-1] == '%') { |