Examine: fix MD_DISK_SYNC is a bit not a flag

Examine() is actually looking at the ACTIVE bit.  This happened to work for
imsm spares but now it needs to be fixed up.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
Dan Williams 2008-10-28 10:55:31 -07:00
parent 072b727f72
commit 032e9e2953
2 changed files with 5 additions and 8 deletions

View File

@ -123,7 +123,7 @@ int Examine(mddev_dev_t devlist, int brief, int export, int scan,
st->ss->getinfo_super(st, &ap->info);
st->ss->free_super(st);
}
if (!(ap->info.disk.state & MD_DISK_SYNC))
if (!(ap->info.disk.state & (1<<MD_DISK_SYNC)))
ap->spares++;
d = dl_strdup(devlist->devname);
dl_add(ap->devs, d);

View File

@ -785,7 +785,6 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info)
struct intel_super *super = st->sb;
struct imsm_disk *disk;
__u32 s;
int is_spare = 0;
if (super->current_vol >= 0) {
getinfo_super_imsm_volume(st, info);
@ -824,14 +823,12 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info)
s = __le32_to_cpu(disk->status);
info->disk.state = s & CONFIGURED_DISK ? (1 << MD_DISK_ACTIVE) : 0;
info->disk.state |= s & FAILED_DISK ? (1 << MD_DISK_FAULTY) : 0;
info->disk.state |= s & USABLE_DISK ? (1 << MD_DISK_SYNC) : 0;
if (s & SPARE_DISK)
is_spare = 1;
info->disk.state |= s & SPARE_DISK ? 0 : (1 << MD_DISK_SYNC);
}
if (is_spare)
memcpy(info->uuid, uuid_match_any, sizeof(int[4]));
else
if (info->disk.state & (1 << MD_DISK_SYNC))
uuid_from_super_imsm(st, info->uuid);
else
memcpy(info->uuid, uuid_match_any, sizeof(int[4]));
}
static int update_super_imsm(struct supertype *st, struct mdinfo *info,