imsm: set imsm spare uuid to 0

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>
This commit is contained in:
Anna Czarnowska 2010-12-26 21:59:31 +11:00 committed by NeilBrown
parent 4f8a3e5baf
commit 22e263f64a
4 changed files with 8 additions and 45 deletions

View File

@ -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;
}

View File

@ -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);

View 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) {

7
util.c
View File

@ -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