summaryrefslogtreecommitdiff
path: root/mdstat.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-06-04 12:31:40 +1000
committerNeilBrown <neilb@suse.de>2012-06-04 12:31:40 +1000
commit9dad51d41853a1bf791dfe418b67fefac21c4670 (patch)
tree02418b4e58745742430fa3f0c2fec9ce2e712a61 /mdstat.c
parentb0599bda13ede5b6022ad0c6fdd6641f07a008ed (diff)
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.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/mdstat.c b/mdstat.c
index 6ead24c4..17405601 100644
--- a/mdstat.c
+++ b/mdstat.c
@@ -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] == '%') {