diff --git a/managemon.c b/managemon.c index 971dcd1..91755f9 100644 --- a/managemon.c +++ b/managemon.c @@ -87,7 +87,6 @@ static void close_aa(struct active_array *aa) close(aa->action_fd); close(aa->info.state_fd); close(aa->resync_start_fd); - close(aa->sync_pos_fd); } static void free_aa(struct active_array *aa) @@ -265,8 +264,7 @@ static void manage_new(struct mdstat_ent *mdstat, new->action_fd = sysfs_open(new->devnum, NULL, "sync_action"); new->info.state_fd = sysfs_open(new->devnum, NULL, "array_state"); new->resync_start_fd = sysfs_open(new->devnum, NULL, "resync_start"); - new->sync_pos_fd = sysfs_open(new->devnum, NULL, "sync_completed"); - new->sync_pos = 0; + new->resync_start = 0; sysfs_free(mdi); // finds and compares. diff --git a/mdmon.h b/mdmon.h index b84e270..ad1a678 100644 --- a/mdmon.h +++ b/mdmon.h @@ -11,7 +11,6 @@ struct active_array { struct active_array *next, *replaces; int action_fd; - int sync_pos_fd; int resync_start_fd; enum array_state prev_state, curr_state, next_state; @@ -19,7 +18,6 @@ struct active_array { int devnum; - unsigned long long sync_pos; unsigned long long resync_start; }; diff --git a/monitor.c b/monitor.c index a7e5308..e14fd38 100644 --- a/monitor.c +++ b/monitor.c @@ -47,22 +47,6 @@ static int read_attr(char *buf, int len, int fd) return n; } -static int get_sync_pos(struct active_array *a) -{ - char buf[30]; - int n; - - n = read_attr(buf, 30, a->sync_pos_fd); - if (n <= 0) - return n; - - if (strncmp(buf, "max", 3) == 0) { - a->sync_pos = ~(unsigned long long)0; - return 1; - } - a->sync_pos = strtoull(buf, NULL, 10); - return 1; -} static int get_resync_start(struct active_array *a) { @@ -248,8 +232,7 @@ static int read_and_act(struct active_array *a) if (a->curr_state <= inactive && a->prev_state > inactive) { /* array has been stopped */ - get_sync_pos(a); - a->container->ss->mark_clean(a, a->sync_pos); + a->container->ss->mark_clean(a, a->resync_start); a->next_state = clear; deactivate = 1; } @@ -285,6 +268,7 @@ static int read_and_act(struct active_array *a) * until the array goes inactive or readonly though. * Just check if we need to fiddle spares. */ + get_resync_start(a); check_degraded = 1; }