DDF: ddf_process_update: Fix vlist treatment for SVDs

With secondary RAID level, disks may belong to other BVDs in
a given conf record. This needs to be taken into account
when fixing the vlist.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
mwilck@arcor.de 2013-07-03 22:28:06 +02:00 committed by NeilBrown
parent 21a635519e
commit 5838fccdd2
1 changed files with 26 additions and 22 deletions

View File

@ -4326,30 +4326,34 @@ static void ddf_process_update(struct supertype *st,
|= __be16_to_cpu(DDF_Transition); |= __be16_to_cpu(DDF_Transition);
/* Now make sure vlist is correct for each dl. */ /* Now make sure vlist is correct for each dl. */
for (dl = ddf->dlist; dl; dl = dl->next) { for (dl = ddf->dlist; dl; dl = dl->next) {
unsigned int dn;
unsigned int vn = 0; unsigned int vn = 0;
int in_degraded = 0; int in_degraded = 0;
for (vcl = ddf->conflist; vcl ; vcl = vcl->next) for (vcl = ddf->conflist; vcl ; vcl = vcl->next) {
for (dn=0; dn < ddf->mppe ; dn++) unsigned int dn, ibvd;
if (vcl->conf.phys_refnum[dn] == const struct vd_config *conf;
dl->disk.refnum) { int vstate;
int vstate; dn = get_pd_index_from_refnum(vcl,
dprintf("dev %d has %p at %d\n", dl->disk.refnum,
dl->pdnum, vcl, vn); ddf->mppe,
/* Clear the Transition flag */ &conf, &ibvd);
if (ddf->phys->entries[dl->pdnum].state if (dn == DDF_NOTFOUND)
& __be16_to_cpu(DDF_Failed)) continue;
ddf->phys->entries[dl->pdnum].state &= dprintf("dev %d/%08x has %s (sec=%u) at %d\n",
~__be16_to_cpu(DDF_Transition); dl->pdnum, dl->disk.refnum,
guid_str(conf->guid),
dl->vlist[vn++] = vcl; conf->sec_elmnt_seq, vn);
vstate = ddf->virt->entries[vcl->vcnum].state /* Clear the Transition flag */
& DDF_state_mask; if (ddf->phys->entries[dl->pdnum].state
if (vstate == DDF_state_degraded || & __be16_to_cpu(DDF_Failed))
vstate == DDF_state_part_optimal) ddf->phys->entries[dl->pdnum].state &=
in_degraded = 1; ~__be16_to_cpu(DDF_Transition);
break; dl->vlist[vn++] = vcl;
} vstate = ddf->virt->entries[vcl->vcnum].state
& DDF_state_mask;
if (vstate == DDF_state_degraded ||
vstate == DDF_state_part_optimal)
in_degraded = 1;
}
while (vn < ddf->max_part) while (vn < ddf->max_part)
dl->vlist[vn++] = NULL; dl->vlist[vn++] = NULL;
if (dl->vlist[0]) { if (dl->vlist[0]) {