mdstat: discard 'dev' field, just use 'devnm'
These both have the same value, and have done since the 'devnm' concept was introduced. So discard the pointless duplicate. Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
caf9ac0ca4
commit
9581efb1ae
|
@ -1726,7 +1726,7 @@ int IncrementalRemove(char *devname, char *id_path, int verbose)
|
|||
mdfd = open_dev(ent->devnm);
|
||||
if (mdfd < 0) {
|
||||
if (verbose >= 0)
|
||||
pr_err("Cannot open array %s!!\n", ent->dev);
|
||||
pr_err("Cannot open array %s!!\n", ent->devnm);
|
||||
free_mdstat(ent);
|
||||
return 1;
|
||||
}
|
||||
|
@ -1748,11 +1748,11 @@ int IncrementalRemove(char *devname, char *id_path, int verbose)
|
|||
struct mdstat_ent *mdstat = mdstat_read(0, 0);
|
||||
struct mdstat_ent *memb;
|
||||
for (memb = mdstat ; memb ; memb = memb->next)
|
||||
if (is_container_member(memb, ent->dev)) {
|
||||
if (is_container_member(memb, ent->devnm)) {
|
||||
int subfd = open_dev(memb->devnm);
|
||||
if (subfd >= 0) {
|
||||
rv |= Manage_subdevs(
|
||||
memb->dev, subfd,
|
||||
memb->devnm, subfd,
|
||||
&devlist, verbose, 0,
|
||||
NULL, 0);
|
||||
close(subfd);
|
||||
|
@ -1760,7 +1760,7 @@ int IncrementalRemove(char *devname, char *id_path, int verbose)
|
|||
}
|
||||
free_mdstat(mdstat);
|
||||
} else
|
||||
rv |= Manage_subdevs(ent->dev, mdfd, &devlist,
|
||||
rv |= Manage_subdevs(ent->devnm, mdfd, &devlist,
|
||||
verbose, 0, NULL, 0);
|
||||
if (rv & 2) {
|
||||
/* Failed due to EBUSY, try to stop the array.
|
||||
|
@ -1768,7 +1768,7 @@ int IncrementalRemove(char *devname, char *id_path, int verbose)
|
|||
*/
|
||||
int devid = devnm2devid(ent->devnm);
|
||||
run_udisks("--unmount", map_dev(major(devid),minor(devid), 0));
|
||||
rv = Manage_stop(ent->dev, mdfd, verbose, 1);
|
||||
rv = Manage_stop(ent->devnm, mdfd, verbose, 1);
|
||||
if (rv)
|
||||
/* At least we can try to trigger a 'remove' */
|
||||
sysfs_uevent(&mdi, "remove");
|
||||
|
@ -1778,7 +1778,7 @@ int IncrementalRemove(char *devname, char *id_path, int verbose)
|
|||
}
|
||||
} else {
|
||||
devlist.disposition = 'r';
|
||||
rv = Manage_subdevs(ent->dev, mdfd, &devlist,
|
||||
rv = Manage_subdevs(ent->devnm, mdfd, &devlist,
|
||||
verbose, 0, NULL, 0);
|
||||
}
|
||||
close(mdfd);
|
||||
|
|
2
Manage.c
2
Manage.c
|
@ -316,7 +316,7 @@ int Manage_stop(char *devname, int fd, int verbose, int will_retry)
|
|||
devnm)) {
|
||||
if (verbose >= 0)
|
||||
pr_err("Cannot stop container %s: member %s still active\n",
|
||||
devname, m->dev);
|
||||
devname, m->devnm);
|
||||
free_mdstat(mds);
|
||||
rv = 1;
|
||||
goto out;
|
||||
|
|
4
config.c
4
config.c
|
@ -167,10 +167,10 @@ struct mddev_dev *load_containers(void)
|
|||
!is_subarray(&ent->metadata_version[9])) {
|
||||
d = xmalloc(sizeof(*d));
|
||||
memset(d, 0, sizeof(*d));
|
||||
me = map_by_devnm(&map, ent->dev);
|
||||
me = map_by_devnm(&map, ent->devnm);
|
||||
if (me)
|
||||
d->devname = xstrdup(me->path);
|
||||
else if (asprintf(&d->devname, "/dev/%s", ent->dev) < 0) {
|
||||
else if (asprintf(&d->devname, "/dev/%s", ent->devnm) < 0) {
|
||||
free(d);
|
||||
continue;
|
||||
}
|
||||
|
|
4
mdadm.c
4
mdadm.c
|
@ -1675,7 +1675,7 @@ static int misc_scan(char devmode, struct context *c)
|
|||
|
||||
if (!name) {
|
||||
pr_err("cannot find device file for %s\n",
|
||||
e->dev);
|
||||
e->devnm);
|
||||
continue;
|
||||
}
|
||||
if (devmode == 'D')
|
||||
|
@ -1710,7 +1710,7 @@ static int stop_scan(int verbose)
|
|||
|
||||
if (!name) {
|
||||
pr_err("cannot find device file for %s\n",
|
||||
e->dev);
|
||||
e->devnm);
|
||||
continue;
|
||||
}
|
||||
mdfd = open_mddev(name, 1);
|
||||
|
|
1
mdadm.h
1
mdadm.h
|
@ -453,7 +453,6 @@ typedef struct mapping {
|
|||
} mapping_t;
|
||||
|
||||
struct mdstat_ent {
|
||||
char *dev;
|
||||
char devnm[32];
|
||||
int active;
|
||||
char *level;
|
||||
|
|
4
mdstat.c
4
mdstat.c
|
@ -114,7 +114,6 @@ void free_mdstat(struct mdstat_ent *ms)
|
|||
{
|
||||
while (ms) {
|
||||
struct mdstat_ent *t;
|
||||
free(ms->dev);
|
||||
free(ms->level);
|
||||
free(ms->pattern);
|
||||
free(ms->metadata_version);
|
||||
|
@ -169,7 +168,7 @@ struct mdstat_ent *mdstat_read(int hold, int start)
|
|||
strcpy(devnm, line);
|
||||
|
||||
ent = xmalloc(sizeof(*ent));
|
||||
ent->dev = ent->level = ent->pattern= NULL;
|
||||
ent->level = ent->pattern= NULL;
|
||||
ent->next = NULL;
|
||||
ent->percent = RESYNC_NONE;
|
||||
ent->active = -1;
|
||||
|
@ -179,7 +178,6 @@ struct mdstat_ent *mdstat_read(int hold, int start)
|
|||
ent->devcnt = 0;
|
||||
ent->members = NULL;
|
||||
|
||||
ent->dev = xstrdup(line);
|
||||
strcpy(ent->devnm, devnm);
|
||||
|
||||
for (w=dl_next(line); w!= line ; w=dl_next(w)) {
|
||||
|
|
4
msg.c
4
msg.c
|
@ -395,7 +395,7 @@ int block_monitor(char *container, const int freeze)
|
|||
sysfs_free(sra);
|
||||
sra = sysfs_read(-1, e2->devnm, GET_VERSION);
|
||||
if (unblock_subarray(sra, freeze))
|
||||
pr_err("Failed to unfreeze %s\n", e2->dev);
|
||||
pr_err("Failed to unfreeze %s\n", e2->devnm);
|
||||
}
|
||||
|
||||
ping_monitor(container); /* cleared frozen */
|
||||
|
@ -431,7 +431,7 @@ void unblock_monitor(char *container, const int unfreeze)
|
|||
if (sra->array.level > 0)
|
||||
to_ping++;
|
||||
if (unblock_subarray(sra, unfreeze))
|
||||
pr_err("Failed to unfreeze %s\n", e->dev);
|
||||
pr_err("Failed to unfreeze %s\n", e->devnm);
|
||||
}
|
||||
if (to_ping)
|
||||
ping_monitor(container);
|
||||
|
|
|
@ -5585,15 +5585,15 @@ active_arrays_by_format(char *name, char* hba, struct md_list **devlist,
|
|||
for (vol = mdstat ; vol ; vol = vol->next) {
|
||||
if ((vol->active > 0) &&
|
||||
vol->metadata_version &&
|
||||
is_container_member(vol, memb->dev)) {
|
||||
is_container_member(vol, memb->devnm)) {
|
||||
found++;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (*devlist && (found < dpa)) {
|
||||
dv = xcalloc(1, sizeof(*dv));
|
||||
dv->devname = xmalloc(strlen(memb->dev) + strlen("/dev/") + 1);
|
||||
sprintf(dv->devname, "%s%s", "/dev/", memb->dev);
|
||||
dv->devname = xmalloc(strlen(memb->devnm) + strlen("/dev/") + 1);
|
||||
sprintf(dv->devname, "%s%s", "/dev/", memb->devnm);
|
||||
dv->found = found;
|
||||
dv->used = 0;
|
||||
dv->next = *devlist;
|
||||
|
|
Loading…
Reference in New Issue