extern int exit_now, manager_ready;
extern int mon_tid, mgr_tid;
extern int monitor_loop_cnt;
+
+/* helper routine to determine resync completion since MaxSector is a
+ * moving target
+ */
+static inline int is_resync_complete(struct active_array *a)
+{
+ if (a->resync_start >= a->info.component_size)
+ return 1;
+ return 0;
+}
+
if (consistent == 2) {
/* Should check if a recovery should be started FIXME */
consistent = 1;
- if (a->resync_start != ~0ULL)
+ if (!is_resync_complete(a))
consistent = 0;
}
if (consistent)
old = ddf->virt->entries[inst].init_state;
ddf->virt->entries[inst].init_state &= ~DDF_initstate_mask;
- if (a->resync_start == ~0ULL)
+ if (is_resync_complete(a))
ddf->virt->entries[inst].init_state |= DDF_init_full;
else if (a->resync_start == 0)
ddf->virt->entries[inst].init_state |= DDF_init_not;
__u8 map_state = imsm_check_degraded(super, dev, failed);
if (consistent == 2 &&
- (a->resync_start != ~0ULL ||
+ (!is_resync_complete(a) ||
map_state != IMSM_T_STATE_NORMAL ||
dev->vol.migr_state))
consistent = 0;
- if (a->resync_start == ~0ULL) {
+ if (is_resync_complete(a)) {
/* complete intialization / resync,
* recovery is completed in ->set_disk
*/