]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
imsm: set imsm spare uuid to 0
authorAnna Czarnowska <anna.czarnowska@intel.com>
Sun, 26 Dec 2010 10:59:31 +0000 (21:59 +1100)
committerNeilBrown <neilb@suse.de>
Sun, 26 Dec 2010 10:59:31 +0000 (21:59 +1100)
uuid_match_any is replaced by uuid_zero for imsm spares.

Function fixup_container_spare_uuid not needed as it gives
unwanted uuid to spares.

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Detail.c
mdadm.h
super-intel.c
util.c

index 94156288a19fc50be64fd1c881cf6371c64bfdb7..e68a88ac155e7716727da95623ea4b23149f093e 100644 (file)
--- a/Detail.c
+++ b/Detail.c
@@ -159,16 +159,16 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
                        continue;
                }
                /* some formats (imsm) have free-floating-spares
-                * with a uuid of uuid_match_any, they don't
+                * with a uuid of uuid_zero, they don't
                 * have very good info about the rest of the
                 * container, so keep searching when
                 * encountering such a device.  Otherwise, stop
                 * after the first successful call to
                 * ->load_super.
                 */
-               if (memcmp(uuid_match_any,
+               if (memcmp(uuid_zero,
                           info->uuid,
-                          sizeof(uuid_match_any)) == 0) {
+                          sizeof(uuid_zero)) == 0) {
                        st->ss->free_super(st);
                        continue;
                }
diff --git a/mdadm.h b/mdadm.h
index 36124dea9a0dd5198aa62602c4390cbdff6e49be..d3e88bc7fc4cf801c3b9c7ac60eb7f3130b202d1 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -1074,7 +1074,7 @@ extern int experimental(void);
 extern void free_line(char *line);
 extern int match_oneof(char *devices, char *devname);
 extern void uuid_from_super(int uuid[4], mdp_super_t *super);
-extern const int uuid_match_any[4];
+extern const int uuid_zero[4];
 extern int same_uuid(int a[4], int b[4], int swapuuid);
 extern void copy_uuid(void *a, int b[4], int swapuuid);
 extern char *__fname_from_uuid(int id[4], int swap, char *buf, char sep);
index adb85b23e085957433994524ed43bae28b8caf4b..c4100efc2a2ab0a7d3b0f9033ce2d644b716066e 100644 (file)
@@ -1625,38 +1625,6 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
        }
 }
 
-/* check the config file to see if we can return a real uuid for this spare */
-static void fixup_container_spare_uuid(struct mdinfo *inf)
-{
-       struct mddev_ident *array_list;
-
-       if (inf->array.level != LEVEL_CONTAINER ||
-           memcmp(inf->uuid, uuid_match_any, sizeof(int[4])) != 0)
-               return;
-
-       array_list = conf_get_ident(NULL);
-
-       for (; array_list; array_list = array_list->next) {
-               if (array_list->uuid_set) {
-                       struct supertype *_sst; /* spare supertype */
-                       struct supertype *_cst; /* container supertype */
-
-                       _cst = array_list->st;
-                       if (_cst)
-                               _sst = _cst->ss->match_metadata_desc(inf->text_version);
-                       else
-                               _sst = NULL;
-
-                       if (_sst) {
-                               memcpy(inf->uuid, array_list->uuid, sizeof(int[4]));
-                               free(_sst);
-                               break;
-                       }
-               }
-       }
-}
-
-
 static __u8 imsm_check_degraded(struct intel_super *super, struct imsm_dev *dev, int failed);
 static int imsm_count_failed(struct intel_super *super, struct imsm_dev *dev);
 
@@ -1771,10 +1739,8 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info, char *
         */
        if (info->disk.state & (1 << MD_DISK_SYNC) || super->anchor->num_raid_devs)
                uuid_from_super_imsm(st, info->uuid);
-       else {
-               memcpy(info->uuid, uuid_match_any, sizeof(int[4]));
-               fixup_container_spare_uuid(info);
-       }
+       else
+               memcpy(info->uuid, uuid_zero, sizeof(uuid_zero));
 
        /* I don't know how to compute 'map' on imsm, so use safe default */
        if (map) {
diff --git a/util.c b/util.c
index 7544ce17a3c760c9817a11d1f0b14208584c515b..c4c31a315f689c3878b4cfa1cd719be054f87fe6 100644 (file)
--- a/util.c
+++ b/util.c
@@ -375,13 +375,10 @@ int enough_fd(int fd)
 }
 
 
-const int uuid_match_any[4] = { ~0, ~0, ~0, ~0 };
+const int uuid_zero[4] = { 0, 0, 0, 0 };
+
 int same_uuid(int a[4], int b[4], int swapuuid)
 {
-       if (memcmp(a, uuid_match_any, sizeof(int[4])) == 0 ||
-           memcmp(b, uuid_match_any, sizeof(int[4])) == 0)
-               return 1;
-
        if (swapuuid) {
                /* parse uuids are hostendian.
                 * uuid's from some superblocks are big-ending