static void pr_state(const struct ddf_super *ddf, const char *msg) {}
#endif
-static void _ddf_set_updates_pending(struct ddf_super *ddf, const char *func)
+static void _ddf_set_updates_pending(struct ddf_super *ddf, struct vd_config *vc,
+ const char *func)
{
+ if (vc) {
+ vc->timestamp = cpu_to_be32(time(0)-DECADE);
+ vc->seqnum = cpu_to_be32(be32_to_cpu(vc->seqnum) + 1);
+ }
if (ddf->updates_pending)
return;
ddf->updates_pending = 1;
pr_state(ddf, func);
}
-#define ddf_set_updates_pending(x) _ddf_set_updates_pending((x), __func__)
+#define ddf_set_updates_pending(x,v) _ddf_set_updates_pending((x), (v), __func__)
static be32 calc_crc(void *buf, int len)
{
memset(&vd->entries[i], 0xff, sizeof(struct virtual_entry));
st->sb = ddf;
- ddf_set_updates_pending(ddf);
+ ddf_set_updates_pending(ddf, NULL);
return 1;
}
vcl->next = ddf->conflist;
ddf->conflist = vcl;
ddf->currentconf = vcl;
- ddf_set_updates_pending(ddf);
+ ddf_set_updates_pending(ddf, NULL);
return 1;
}
__func__, dl->pdnum, be32_to_cpu(dl->disk.refnum),
ddf->currentconf->vcnum, guid_str(vc->guid),
dk->raid_disk);
- ddf_set_updates_pending(ddf);
+ ddf_set_updates_pending(ddf, vc);
}
static unsigned int find_unused_pde(const struct ddf_super *ddf)
} else {
dd->next = ddf->dlist;
ddf->dlist = dd;
- ddf_set_updates_pending(ddf);
+ ddf_set_updates_pending(ddf, NULL);
}
return 0;
i, be32_to_cpu(d->disk.refnum),
guid_str(vdc->guid),
vdc->sec_elmnt_seq);
- vdc->seqnum = header->seq;
vdc->crc = calc_crc(vdc, conf_size);
memcpy(conf + i*conf_size, vdc, conf_size);
} else
be16_set(ddf->phys->entries[pd].state,
cpu_to_be16(DDF_Failed|DDF_Missing));
vc->phys_refnum[n_bvd] = cpu_to_be32(0);
- ddf_set_updates_pending(ddf);
+ ddf_set_updates_pending(ddf, vc);
}
/* Mark the array as Degraded */
(ddf->virt->entries[inst].state & ~DDF_state_mask)
| state;
a->check_degraded = 1;
- ddf_set_updates_pending(ddf);
+ ddf_set_updates_pending(ddf, vc);
}
}
}
else
ddf->virt->entries[inst].state |= DDF_state_inconsistent;
if (old != ddf->virt->entries[inst].state)
- ddf_set_updates_pending(ddf);
+ ddf_set_updates_pending(ddf, NULL);
old = ddf->virt->entries[inst].init_state;
ddf->virt->entries[inst].init_state &= ~DDF_initstate_mask;
else
ddf->virt->entries[inst].init_state |= DDF_init_quick;
if (old != ddf->virt->entries[inst].init_state)
- ddf_set_updates_pending(ddf);
+ ddf_set_updates_pending(ddf, NULL);
dprintf("ddf mark %d/%s (%d) %s %llu\n", inst,
guid_str(ddf->virt->entries[inst].guid), a->curr_state,
int pd;
struct mdinfo *mdi;
struct dl *dl;
+ int update = 0;
dprintf("%s: %d to %x\n", __func__, n, state);
if (vc == NULL) {
cpu_to_be16(DDF_Global_Spare));
be16_set(ddf->phys->entries[pd].type,
cpu_to_be16(DDF_Active_in_VD));
- ddf_set_updates_pending(ddf);
+ update = 1;
}
} else {
be16 old = ddf->phys->entries[pd].state;
cpu_to_be16(DDF_Rebuilding));
}
if (!be16_eq(old, ddf->phys->entries[pd].state))
- ddf_set_updates_pending(ddf);
+ update = 1;
}
dprintf("ddf: set_disk %d (%08x) to %x->%02x\n", n,
ddf->virt->entries[inst].state =
(ddf->virt->entries[inst].state & ~DDF_state_mask)
| state;
- ddf_set_updates_pending(ddf);
+ update = 1;
}
-
+ if (update)
+ ddf_set_updates_pending(ddf, vc);
}
static void ddf_sync_metadata(struct supertype *st)
append_metadata_update(st, vd, len);
} else {
_kill_subarray_ddf(ddf, conf->guid);
- ddf_set_updates_pending(ddf);
+ ddf_set_updates_pending(ddf, NULL);
ddf_sync_metadata(st);
}
return 0;
break;
}
}
- ddf_set_updates_pending(ddf);
+ ddf_set_updates_pending(ddf, NULL);
return;
}
if (!all_ff(ddf->phys->entries[ent].guid))
ddf->phys->entries[ent] = pd->entries[0];
ddf->phys->used_pdes = cpu_to_be16
(1 + be16_to_cpu(ddf->phys->used_pdes));
- ddf_set_updates_pending(ddf);
+ ddf_set_updates_pending(ddf, NULL);
if (ddf->add_list) {
struct active_array *a;
struct dl *al = ddf->add_list;
ddf->virt->entries[ent].state,
ddf->virt->entries[ent].init_state);
}
- ddf_set_updates_pending(ddf);
+ ddf_set_updates_pending(ddf, NULL);
}
else if (be32_eq(*magic, DDF_VD_CONF_MAGIC)) {
pd2++;
}
- ddf_set_updates_pending(ddf);
+ ddf_set_updates_pending(ddf, vc);
}
/* case DDF_SPARE_ASSIGN_MAGIC */
}