summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Assemble.c2
-rw-r--r--Incremental.c2
-rw-r--r--mdadm.h2
-rw-r--r--super-ddf.c9
-rw-r--r--super-intel.c17
-rw-r--r--super0.c12
-rw-r--r--super1.c13
7 files changed, 49 insertions, 8 deletions
diff --git a/Assemble.c b/Assemble.c
index f66a21b..37b8413 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -331,7 +331,7 @@ int Assemble(struct supertype *st, char *mddev,
if (tmpdev->content)
content = tmpdev->content;
else
- content = tst->ss->container_content(tst);
+ content = tst->ss->container_content(tst, NULL);
if (!content)
goto loop; /* empty container */
diff --git a/Incremental.c b/Incremental.c
index e74e52b..0978a81 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -1190,7 +1190,7 @@ int Incremental_container(struct supertype *st, char *devname, int verbose,
* array, choose a device name and assemble the array.
*/
- struct mdinfo *list = st->ss->container_content(st);
+ struct mdinfo *list = st->ss->container_content(st, NULL);
struct mdinfo *ra;
struct map_ent *map = NULL;
diff --git a/mdadm.h b/mdadm.h
index deff948..d46139c 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -621,7 +621,7 @@ extern struct superswitch {
char *subdev, unsigned long long *freesize,
int verbose);
- struct mdinfo *(*container_content)(struct supertype *st);
+ struct mdinfo *(*container_content)(struct supertype *st, char *subarray);
/* Allow a metadata handler to override mdadm's default layouts */
int (*default_layout)(int level); /* optional */
/* query the supertype for default chunk size */
diff --git a/super-ddf.c b/super-ddf.c
index 30e228d..83e4a31 100644
--- a/super-ddf.c
+++ b/super-ddf.c
@@ -2924,7 +2924,7 @@ static int load_super_ddf_all(struct supertype *st, int fd,
}
#endif /* MDASSEMBLE */
-static struct mdinfo *container_content_ddf(struct supertype *st)
+static struct mdinfo *container_content_ddf(struct supertype *st, char *subarray)
{
/* Given a container loaded by load_super_ddf_all,
* extract information about all the arrays into
@@ -2943,6 +2943,13 @@ static struct mdinfo *container_content_ddf(struct supertype *st)
unsigned int i;
unsigned int j;
struct mdinfo *this;
+ char *ep;
+
+ if (subarray &&
+ (strtoul(subarray, &ep, 10) != vc->vcnum ||
+ *ep != '\0'))
+ continue;
+
this = malloc(sizeof(*this));
memset(this, 0, sizeof(*this));
this->next = rest;
diff --git a/super-intel.c b/super-intel.c
index 156585c..f64731b 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -4327,11 +4327,12 @@ static void update_recovery_start(struct imsm_dev *dev, struct mdinfo *array)
}
-static struct mdinfo *container_content_imsm(struct supertype *st)
+static struct mdinfo *container_content_imsm(struct supertype *st, char *subarray)
{
/* Given a container loaded by load_super_imsm_all,
* extract information about all the arrays into
* an mdinfo tree.
+ * If 'subarray' is given, just extract info about that array.
*
* For each imsm_dev create an mdinfo, fill it in,
* then look for matching devices in super->disks
@@ -4340,7 +4341,7 @@ static struct mdinfo *container_content_imsm(struct supertype *st)
struct intel_super *super = st->sb;
struct imsm_super *mpb = super->anchor;
struct mdinfo *rest = NULL;
- int i;
+ unsigned int i;
/* do not assemble arrays that might have bad blocks */
if (imsm_bbm_log_size(super->anchor)) {
@@ -4350,10 +4351,18 @@ static struct mdinfo *container_content_imsm(struct supertype *st)
}
for (i = 0; i < mpb->num_raid_devs; i++) {
- struct imsm_dev *dev = get_imsm_dev(super, i);
- struct imsm_map *map = get_imsm_map(dev, 0);
+ struct imsm_dev *dev;
+ struct imsm_map *map;
struct mdinfo *this;
int slot;
+ char *ep;
+
+ if (subarray &&
+ (i != strtoul(subarray, &ep, 10) || *ep != '\0'))
+ continue;
+
+ dev = get_imsm_dev(super, i);
+ map = get_imsm_map(dev, 0);
/* do not publish arrays that are in the middle of an
* unsupported migration
diff --git a/super0.c b/super0.c
index b9d149e..3e17b80 100644
--- a/super0.c
+++ b/super0.c
@@ -401,6 +401,17 @@ static void getinfo_super0(struct supertype *st, struct mdinfo *info, char *map)
info->array.working_disks = working;
}
+static struct mdinfo *container_content0(struct supertype *st, char *subarray)
+{
+ struct mdinfo *info;
+
+ if (subarray)
+ return NULL;
+
+ info = malloc(sizeof(*info));
+ getinfo_super0(st, info, NULL);
+ return info;
+}
static int update_super0(struct supertype *st, struct mdinfo *info,
char *update,
@@ -1136,6 +1147,7 @@ struct superswitch super0 = {
.match_home = match_home0,
.uuid_from_super = uuid_from_super0,
.getinfo_super = getinfo_super0,
+ .container_content = container_content0,
.update_super = update_super0,
.init_super = init_super0,
.store_super = store_super0,
diff --git a/super1.c b/super1.c
index a52df64..bc5f4a7 100644
--- a/super1.c
+++ b/super1.c
@@ -645,6 +645,18 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
info->array.working_disks = working;
}
+static struct mdinfo *container_content1(struct supertype *st, char *subarray)
+{
+ struct mdinfo *info;
+
+ if (subarray)
+ return NULL;
+
+ info = malloc(sizeof(*info));
+ getinfo_super1(st, info, NULL);
+ return info;
+}
+
static int update_super1(struct supertype *st, struct mdinfo *info,
char *update,
char *devname, int verbose,
@@ -1683,6 +1695,7 @@ struct superswitch super1 = {
.match_home = match_home1,
.uuid_from_super = uuid_from_super1,
.getinfo_super = getinfo_super1,
+ .container_content = container_content1,
.update_super = update_super1,
.init_super = init_super1,
.store_super = store_super1,