DDF: add_to_super_ddf_bvd: use get_svd_state()
Reuse get_svd_state() rather than own state algorithm. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
475ccbdbf6
commit
63eb245403
28
super-ddf.c
28
super-ddf.c
|
@ -2440,6 +2440,8 @@ static int init_super_ddf_bvd(struct supertype *st,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int get_svd_state(const struct ddf_super *, const struct vcl *);
|
||||||
|
|
||||||
#ifndef MDASSEMBLE
|
#ifndef MDASSEMBLE
|
||||||
static void add_to_super_ddf_bvd(struct supertype *st,
|
static void add_to_super_ddf_bvd(struct supertype *st,
|
||||||
mdu_disk_info_t *dk, int fd, char *devname)
|
mdu_disk_info_t *dk, int fd, char *devname)
|
||||||
|
@ -2457,7 +2459,6 @@ static void add_to_super_ddf_bvd(struct supertype *st,
|
||||||
struct dl *dl;
|
struct dl *dl;
|
||||||
struct ddf_super *ddf = st->sb;
|
struct ddf_super *ddf = st->sb;
|
||||||
struct vd_config *vc;
|
struct vd_config *vc;
|
||||||
unsigned int working;
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned long long blocks, pos, esize;
|
unsigned long long blocks, pos, esize;
|
||||||
struct extent *ex;
|
struct extent *ex;
|
||||||
|
@ -2521,28 +2522,11 @@ static void add_to_super_ddf_bvd(struct supertype *st,
|
||||||
if (devname)
|
if (devname)
|
||||||
dl->devname = devname;
|
dl->devname = devname;
|
||||||
|
|
||||||
/* Check how many working raid_disks, and if we can mark
|
/* Check if we can mark array as optimal yet */
|
||||||
* array as optimal yet
|
|
||||||
*/
|
|
||||||
working = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < __be16_to_cpu(vc->prim_elmnt_count); i++)
|
|
||||||
if (vc->phys_refnum[i] != 0xffffffff)
|
|
||||||
working++;
|
|
||||||
|
|
||||||
/* Find which virtual_entry */
|
|
||||||
i = ddf->currentconf->vcnum;
|
i = ddf->currentconf->vcnum;
|
||||||
if (working == __be16_to_cpu(vc->prim_elmnt_count))
|
ddf->virt->entries[i].state =
|
||||||
ddf->virt->entries[i].state =
|
(ddf->virt->entries[i].state & ~DDF_state_mask)
|
||||||
(ddf->virt->entries[i].state & ~DDF_state_mask)
|
| get_svd_state(ddf, ddf->currentconf);
|
||||||
| DDF_state_optimal;
|
|
||||||
|
|
||||||
if (vc->prl == DDF_RAID6 &&
|
|
||||||
working+1 == __be16_to_cpu(vc->prim_elmnt_count))
|
|
||||||
ddf->virt->entries[i].state =
|
|
||||||
(ddf->virt->entries[i].state & ~DDF_state_mask)
|
|
||||||
| DDF_state_part_optimal;
|
|
||||||
|
|
||||||
ddf->phys->entries[dl->pdnum].type &= ~__cpu_to_be16(DDF_Global_Spare);
|
ddf->phys->entries[dl->pdnum].type &= ~__cpu_to_be16(DDF_Global_Spare);
|
||||||
ddf->phys->entries[dl->pdnum].type |= __cpu_to_be16(DDF_Active_in_VD);
|
ddf->phys->entries[dl->pdnum].type |= __cpu_to_be16(DDF_Active_in_VD);
|
||||||
ddf_set_updates_pending(ddf);
|
ddf_set_updates_pending(ddf);
|
||||||
|
|
Loading…
Reference in New Issue