]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Examine: fix MD_DISK_SYNC is a bit not a flag
authorDan Williams <dan.j.williams@intel.com>
Tue, 28 Oct 2008 17:55:31 +0000 (10:55 -0700)
committerDan Williams <dan.j.williams@intel.com>
Tue, 28 Oct 2008 17:55:31 +0000 (10:55 -0700)
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>
Examine.c
super-intel.c

index 5de92028acd4c0bf971a859203bd363ca371ddae..d213664f965eaa1b14d4666ff8e5bf0b6caa4275 100644 (file)
--- a/Examine.c
+++ b/Examine.c
@@ -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);
index 17c22f5653b7ffe03e9acaec4bae4e57cae96acf..d176dfd068601a28e104640fb320f7acc2c107c6 100644 (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,