Create: user container_dev rather than subarray for some tests.
It makes more sense to test for container_dev than for subarray for several places in Create where it then uses container_dev. This allows us to subsequently remove subarray. Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
9b63e64836
commit
d1d599ea0d
7
Create.c
7
Create.c
|
@ -672,7 +672,7 @@ int Create(struct supertype *st, char *mddev,
|
|||
|
||||
sysfs_init(&info, mdfd, 0);
|
||||
|
||||
if (st->ss->external && st->subarray[0]) {
|
||||
if (st->ss->external && st->container_dev != NoMdDev) {
|
||||
/* member */
|
||||
|
||||
/* When creating a member, we need to be careful
|
||||
|
@ -775,7 +775,8 @@ int Create(struct supertype *st, char *mddev,
|
|||
if (have_container)
|
||||
fd = -1;
|
||||
else {
|
||||
if (st->ss->external && st->subarray[0])
|
||||
if (st->ss->external &&
|
||||
st->container_dev != NoMdDev)
|
||||
fd = open(dv->devname, O_RDWR);
|
||||
else
|
||||
fd = open(dv->devname, O_RDWR|O_EXCL);
|
||||
|
@ -906,7 +907,7 @@ int Create(struct supertype *st, char *mddev,
|
|||
}
|
||||
if (verbose >= 0)
|
||||
fprintf(stderr, Name ": array %s started.\n", mddev);
|
||||
if (st->ss->external && st->subarray[0]) {
|
||||
if (st->ss->external && st->container_dev != NoMdDev) {
|
||||
if (need_mdmon)
|
||||
start_mdmon(st->container_dev);
|
||||
|
||||
|
|
|
@ -893,6 +893,7 @@ static struct supertype *match_metadata_desc_ddf(char *arg)
|
|||
|
||||
st = malloc(sizeof(*st));
|
||||
memset(st, 0, sizeof(*st));
|
||||
st->container_dev = NoMdDev;
|
||||
st->ss = &super_ddf;
|
||||
st->max_devs = 512;
|
||||
st->minor_version = 0;
|
||||
|
|
|
@ -333,6 +333,7 @@ static struct supertype *match_metadata_desc_imsm(char *arg)
|
|||
if (!st)
|
||||
return NULL;
|
||||
memset(st, 0, sizeof(*st));
|
||||
st->container_dev = NoMdDev;
|
||||
st->ss = &super_imsm;
|
||||
st->max_devs = IMSM_MAX_DEVICES;
|
||||
st->minor_version = 0;
|
||||
|
|
1
super0.c
1
super0.c
|
@ -917,6 +917,7 @@ static struct supertype *match_metadata_desc0(char *arg)
|
|||
if (!st) return st;
|
||||
|
||||
memset(st, 0, sizeof(*st));
|
||||
st->container_dev = NoMdDev;
|
||||
st->ss = &super0;
|
||||
st->info = NULL;
|
||||
st->minor_version = 90;
|
||||
|
|
1
super1.c
1
super1.c
|
@ -1371,6 +1371,7 @@ static struct supertype *match_metadata_desc1(char *arg)
|
|||
if (!st) return st;
|
||||
|
||||
memset(st, 0, sizeof(*st));
|
||||
st->container_dev = NoMdDev;
|
||||
st->ss = &super1;
|
||||
st->max_devs = 384;
|
||||
st->sb = NULL;
|
||||
|
|
Loading…
Reference in New Issue