From: Czarnowska, Anna Sent: Monday, July 05, 2010 11:27 AM To: Neil Brown Cc: linux-raid@xxxxxxxxxxxxxxx; Czarnowska, Anna; Hawrylewicz Czarnowski, Przemyslaw; Labun, Marcin; Neubauer, Wojciech; Williams, Dan J; Ciechanowski, Ed; dledford@xxxxxxxxxx Subject: [PATCH 13/33] create: respect domains/subsets during create process From: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@xxxxxxxxx> Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@xxxxxxxxx> --- Create.c | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-) diff --git a/Create.c b/Create.c index b04388f..2ea4205 100644 --- a/Create.c +++ b/Create.c @@ -116,6 +116,8 @@ int Create(struct supertype *st, char *mddev, char chosen_name[1024]; struct map_ent *map = NULL; unsigned long long newsize; + struct domain_ent *base_de = NULL; + struct subset *base_ss; int major_num = BITMAP_MAJOR_HI; @@ -281,6 +283,8 @@ int Create(struct supertype *st, char *mddev, info.array.working_disks = 0; dnum = 0; for (dv=devlist; dv && !have_container; dv=dv->next, dnum++) { + struct domain_ent *de; + struct subset *ss; char *dname = dv->devname; unsigned long long freesize; if (strcasecmp(dname, "missing")==0) { @@ -343,6 +347,31 @@ int Create(struct supertype *st, char *mddev, } } + de = conf_get_domain(dname, (char *)st->ss->name); + if (!de) { + fprintf(stderr, Name ": Can't determine domain of %s.", + dname); + if (st) + st->ss->free_super(st); + return 1; + } + ss = conf_get_subset(dname, st, de); + if (!base_de) { + base_de = de; + base_ss = ss; + if (verbose > 0) + fprintf(stderr, Name ": Base domain set for " + "device: %s\n", dname); + } else { + if (base_de != de || base_ss != ss) { + if (verbose > 0) + fprintf(stderr, Name ": %s does not belong to the same " + "domain/subset.\n", + dname); + return 1; + } + } + freesize /= 2; /* convert to K */ if (chunk) { /* round to chunk size */ -- 1.6.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html