Pass 'verbose' flag to validate_geometry
That way it can be silent when we are just trying to figure out which metadata to use, and noisy when detecting a real problem.
This commit is contained in:
parent
047d2e49f5
commit
2c514b7120
10
Create.c
10
Create.c
|
@ -245,7 +245,7 @@ int Create(struct supertype *st, char *mddev, int mdfd,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (st && ! st->ss->validate_geometry(st, level, layout, raiddisks,
|
if (st && ! st->ss->validate_geometry(st, level, layout, raiddisks,
|
||||||
chunk, size, NULL, NULL))
|
chunk, size, NULL, NULL, verbose>=0))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* now look at the subdevs */
|
/* now look at the subdevs */
|
||||||
|
@ -281,7 +281,8 @@ int Create(struct supertype *st, char *mddev, int mdfd,
|
||||||
st = superlist[i]->match_metadata_desc(name);
|
st = superlist[i]->match_metadata_desc(name);
|
||||||
if (st && !st->ss->validate_geometry
|
if (st && !st->ss->validate_geometry
|
||||||
(st, level, layout, raiddisks,
|
(st, level, layout, raiddisks,
|
||||||
chunk, size, dname, &freesize))
|
chunk, size, dname, &freesize,
|
||||||
|
verbose > 0))
|
||||||
st = NULL;
|
st = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,7 +299,8 @@ int Create(struct supertype *st, char *mddev, int mdfd,
|
||||||
if (!st->ss->validate_geometry(st, level, layout,
|
if (!st->ss->validate_geometry(st, level, layout,
|
||||||
raiddisks,
|
raiddisks,
|
||||||
chunk, size, dname,
|
chunk, size, dname,
|
||||||
&freesize)) {
|
&freesize,
|
||||||
|
verbose > 0)) {
|
||||||
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
Name ": %s is not suitable for "
|
Name ": %s is not suitable for "
|
||||||
|
@ -360,7 +362,7 @@ int Create(struct supertype *st, char *mddev, int mdfd,
|
||||||
if (!st->ss->validate_geometry(st, level, layout,
|
if (!st->ss->validate_geometry(st, level, layout,
|
||||||
raiddisks,
|
raiddisks,
|
||||||
chunk, minsize,
|
chunk, minsize,
|
||||||
NULL, NULL)) {
|
NULL, NULL, 0)) {
|
||||||
fprintf(stderr, Name ": devices too large for RAID level %d\n", level);
|
fprintf(stderr, Name ": devices too large for RAID level %d\n", level);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
3
mdadm.h
3
mdadm.h
|
@ -514,7 +514,8 @@ extern struct superswitch {
|
||||||
int (*validate_geometry)(struct supertype *st, int level, int layout,
|
int (*validate_geometry)(struct supertype *st, int level, int layout,
|
||||||
int raiddisks,
|
int raiddisks,
|
||||||
int chunk, unsigned long long size,
|
int chunk, unsigned long long size,
|
||||||
char *subdev, unsigned long long *freesize);
|
char *subdev, unsigned long long *freesize,
|
||||||
|
int verbose);
|
||||||
|
|
||||||
struct mdinfo *(*container_content)(struct supertype *st);
|
struct mdinfo *(*container_content)(struct supertype *st);
|
||||||
|
|
||||||
|
|
93
super-ddf.c
93
super-ddf.c
|
@ -2190,20 +2190,24 @@ static __u64 avail_size_ddf(struct supertype *st, __u64 devsize)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef MDASSEMBLE
|
#ifndef MDASSEMBLE
|
||||||
static int validate_geometry_ddf_container(struct supertype *st,
|
static int
|
||||||
|
validate_geometry_ddf_container(struct supertype *st,
|
||||||
int level, int layout, int raiddisks,
|
int level, int layout, int raiddisks,
|
||||||
int chunk, unsigned long long size,
|
int chunk, unsigned long long size,
|
||||||
char *dev, unsigned long long *freesize);
|
char *dev, unsigned long long *freesize,
|
||||||
|
int verbose);
|
||||||
|
|
||||||
static int validate_geometry_ddf_bvd(struct supertype *st,
|
static int validate_geometry_ddf_bvd(struct supertype *st,
|
||||||
int level, int layout, int raiddisks,
|
int level, int layout, int raiddisks,
|
||||||
int chunk, unsigned long long size,
|
int chunk, unsigned long long size,
|
||||||
char *dev, unsigned long long *freesize);
|
char *dev, unsigned long long *freesize,
|
||||||
|
int verbose);
|
||||||
|
|
||||||
static int validate_geometry_ddf(struct supertype *st,
|
static int validate_geometry_ddf(struct supertype *st,
|
||||||
int level, int layout, int raiddisks,
|
int level, int layout, int raiddisks,
|
||||||
int chunk, unsigned long long size,
|
int chunk, unsigned long long size,
|
||||||
char *dev, unsigned long long *freesize)
|
char *dev, unsigned long long *freesize,
|
||||||
|
int verbose)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
struct mdinfo *sra;
|
struct mdinfo *sra;
|
||||||
|
@ -2219,8 +2223,9 @@ static int validate_geometry_ddf(struct supertype *st,
|
||||||
if (level == LEVEL_CONTAINER) {
|
if (level == LEVEL_CONTAINER) {
|
||||||
/* Must be a fresh device to add to a container */
|
/* Must be a fresh device to add to a container */
|
||||||
return validate_geometry_ddf_container(st, level, layout,
|
return validate_geometry_ddf_container(st, level, layout,
|
||||||
raiddisks,
|
raiddisks, chunk,
|
||||||
chunk, size, dev, freesize);
|
size, dev, freesize,
|
||||||
|
verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (st->sb) {
|
if (st->sb) {
|
||||||
|
@ -2229,7 +2234,8 @@ static int validate_geometry_ddf(struct supertype *st,
|
||||||
* Should make a distinction one day.
|
* Should make a distinction one day.
|
||||||
*/
|
*/
|
||||||
return validate_geometry_ddf_bvd(st, level, layout, raiddisks,
|
return validate_geometry_ddf_bvd(st, level, layout, raiddisks,
|
||||||
chunk, size, dev, freesize);
|
chunk, size, dev, freesize,
|
||||||
|
verbose);
|
||||||
}
|
}
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
/* Initial sanity check. Exclude illegal levels. */
|
/* Initial sanity check. Exclude illegal levels. */
|
||||||
|
@ -2263,13 +2269,16 @@ static int validate_geometry_ddf(struct supertype *st,
|
||||||
/* Somehow return the fact that we have enough */
|
/* Somehow return the fact that we have enough */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
Name ": Cannot create this array on device %s\n",
|
Name ": ddf: Cannot create this array "
|
||||||
|
"on device %s\n",
|
||||||
dev);
|
dev);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (errno != EBUSY || (fd = open(dev, O_RDONLY, 0)) < 0) {
|
if (errno != EBUSY || (fd = open(dev, O_RDONLY, 0)) < 0) {
|
||||||
fprintf(stderr, Name ": Cannot open %s: %s\n",
|
if (verbose)
|
||||||
|
fprintf(stderr, Name ": ddf: Cannot open %s: %s\n",
|
||||||
dev, strerror(errno));
|
dev, strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2277,8 +2286,9 @@ static int validate_geometry_ddf(struct supertype *st,
|
||||||
cfd = open_container(fd);
|
cfd = open_container(fd);
|
||||||
if (cfd < 0) {
|
if (cfd < 0) {
|
||||||
close(fd);
|
close(fd);
|
||||||
fprintf(stderr, Name ": Cannot use %s: It is busy\n",
|
if (verbose)
|
||||||
dev);
|
fprintf(stderr, Name ": ddf: Cannot use %s: %s\n",
|
||||||
|
dev, strerror(EBUSY));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
sra = sysfs_read(cfd, 0, GET_VERSION);
|
sra = sysfs_read(cfd, 0, GET_VERSION);
|
||||||
|
@ -2295,7 +2305,8 @@ static int validate_geometry_ddf(struct supertype *st,
|
||||||
close(cfd);
|
close(cfd);
|
||||||
return validate_geometry_ddf_bvd(st, level, layout,
|
return validate_geometry_ddf_bvd(st, level, layout,
|
||||||
raiddisks, chunk, size,
|
raiddisks, chunk, size,
|
||||||
dev, freesize);
|
dev, freesize,
|
||||||
|
verbose);
|
||||||
}
|
}
|
||||||
close(cfd);
|
close(cfd);
|
||||||
} else /* device may belong to a different container */
|
} else /* device may belong to a different container */
|
||||||
|
@ -2304,10 +2315,12 @@ static int validate_geometry_ddf(struct supertype *st,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int validate_geometry_ddf_container(struct supertype *st,
|
static int
|
||||||
|
validate_geometry_ddf_container(struct supertype *st,
|
||||||
int level, int layout, int raiddisks,
|
int level, int layout, int raiddisks,
|
||||||
int chunk, unsigned long long size,
|
int chunk, unsigned long long size,
|
||||||
char *dev, unsigned long long *freesize)
|
char *dev, unsigned long long *freesize,
|
||||||
|
int verbose)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
unsigned long long ldsize;
|
unsigned long long ldsize;
|
||||||
|
@ -2319,7 +2332,8 @@ static int validate_geometry_ddf_container(struct supertype *st,
|
||||||
|
|
||||||
fd = open(dev, O_RDONLY|O_EXCL, 0);
|
fd = open(dev, O_RDONLY|O_EXCL, 0);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
fprintf(stderr, Name ": Cannot open %s: %s\n",
|
if (verbose)
|
||||||
|
fprintf(stderr, Name ": ddf: Cannot open %s: %s\n",
|
||||||
dev, strerror(errno));
|
dev, strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2337,7 +2351,8 @@ static int validate_geometry_ddf_container(struct supertype *st,
|
||||||
static int validate_geometry_ddf_bvd(struct supertype *st,
|
static int validate_geometry_ddf_bvd(struct supertype *st,
|
||||||
int level, int layout, int raiddisks,
|
int level, int layout, int raiddisks,
|
||||||
int chunk, unsigned long long size,
|
int chunk, unsigned long long size,
|
||||||
char *dev, unsigned long long *freesize)
|
char *dev, unsigned long long *freesize,
|
||||||
|
int verbose)
|
||||||
{
|
{
|
||||||
struct stat stb;
|
struct stat stb;
|
||||||
struct ddf_super *ddf = st->sb;
|
struct ddf_super *ddf = st->sb;
|
||||||
|
@ -2382,8 +2397,10 @@ static int validate_geometry_ddf_bvd(struct supertype *st,
|
||||||
free(e);
|
free(e);
|
||||||
}
|
}
|
||||||
if (dcnt < raiddisks) {
|
if (dcnt < raiddisks) {
|
||||||
fprintf(stderr, Name ": Not enough devices with space "
|
if (verbose)
|
||||||
"for this array (%d < %d)\n",
|
fprintf(stderr,
|
||||||
|
Name ": ddf: Not enough devices with "
|
||||||
|
"space for this array (%d < %d)\n",
|
||||||
dcnt, raiddisks);
|
dcnt, raiddisks);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2400,7 +2417,9 @@ static int validate_geometry_ddf_bvd(struct supertype *st,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!dl) {
|
if (!dl) {
|
||||||
fprintf(stderr, Name ": %s is not in the same DDF set\n",
|
if (verbose)
|
||||||
|
fprintf(stderr, Name ": ddf: %s is not in the "
|
||||||
|
"same DDF set\n",
|
||||||
dev);
|
dev);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2645,7 +2664,7 @@ static int compare_super_ddf(struct supertype *st, struct supertype *tst)
|
||||||
*/
|
*/
|
||||||
static int ddf_open_new(struct supertype *c, struct active_array *a, char *inst)
|
static int ddf_open_new(struct supertype *c, struct active_array *a, char *inst)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ddf: open_new %s\n", inst);
|
dprintf("ddf: open_new %s\n", inst);
|
||||||
a->info.container_member = atoi(inst);
|
a->info.container_member = atoi(inst);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2682,7 +2701,7 @@ static void ddf_set_array_state(struct active_array *a, int consistent)
|
||||||
if (old != ddf->virt->entries[inst].init_state)
|
if (old != ddf->virt->entries[inst].init_state)
|
||||||
ddf->updates_pending = 1;
|
ddf->updates_pending = 1;
|
||||||
|
|
||||||
printf("ddf mark %d %s %llu\n", inst, consistent?"clean":"dirty",
|
dprintf("ddf mark %d %s %llu\n", inst, consistent?"clean":"dirty",
|
||||||
a->resync_start);
|
a->resync_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2709,7 +2728,7 @@ static void ddf_set_disk(struct active_array *a, int n, int state)
|
||||||
int i, st, working;
|
int i, st, working;
|
||||||
|
|
||||||
if (vc == NULL) {
|
if (vc == NULL) {
|
||||||
fprintf(stderr, "ddf: cannot find instance %d!!\n", inst);
|
dprintf("ddf: cannot find instance %d!!\n", inst);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (pd < 0) {
|
if (pd < 0) {
|
||||||
|
@ -2734,7 +2753,7 @@ static void ddf_set_disk(struct active_array *a, int n, int state)
|
||||||
ddf->updates_pending = 1;
|
ddf->updates_pending = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "ddf: set_disk %d to %x\n", n, state);
|
dprintf("ddf: set_disk %d to %x\n", n, state);
|
||||||
|
|
||||||
/* Now we need to check the state of the array and update
|
/* Now we need to check the state of the array and update
|
||||||
* virtual_disk.entries[n].state.
|
* virtual_disk.entries[n].state.
|
||||||
|
@ -2804,7 +2823,7 @@ static void ddf_sync_metadata(struct supertype *st)
|
||||||
return;
|
return;
|
||||||
ddf->updates_pending = 0;
|
ddf->updates_pending = 0;
|
||||||
__write_init_super_ddf(st, 0);
|
__write_init_super_ddf(st, 0);
|
||||||
fprintf(stderr, "ddf: sync_metadata\n");
|
dprintf("ddf: sync_metadata\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ddf_process_update(struct supertype *st,
|
static void ddf_process_update(struct supertype *st,
|
||||||
|
@ -2847,7 +2866,7 @@ static void ddf_process_update(struct supertype *st,
|
||||||
int mppe;
|
int mppe;
|
||||||
int ent;
|
int ent;
|
||||||
|
|
||||||
// printf("Process update %x\n", *magic);
|
dprintf("Process update %x\n", *magic);
|
||||||
|
|
||||||
switch (*magic) {
|
switch (*magic) {
|
||||||
case DDF_PHYS_RECORDS_MAGIC:
|
case DDF_PHYS_RECORDS_MAGIC:
|
||||||
|
@ -2887,7 +2906,7 @@ static void ddf_process_update(struct supertype *st,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DDF_VD_CONF_MAGIC:
|
case DDF_VD_CONF_MAGIC:
|
||||||
// printf("len %d %d\n", update->len, ddf->conf_rec_len);
|
dprintf("len %d %d\n", update->len, ddf->conf_rec_len);
|
||||||
|
|
||||||
mppe = __be16_to_cpu(ddf->anchor.max_primary_element_entries);
|
mppe = __be16_to_cpu(ddf->anchor.max_primary_element_entries);
|
||||||
if (update->len != ddf->conf_rec_len * 512)
|
if (update->len != ddf->conf_rec_len * 512)
|
||||||
|
@ -2896,7 +2915,7 @@ static void ddf_process_update(struct supertype *st,
|
||||||
for (vcl = ddf->conflist; vcl ; vcl = vcl->next)
|
for (vcl = ddf->conflist; vcl ; vcl = vcl->next)
|
||||||
if (memcmp(vcl->conf.guid, vc->guid, DDF_GUID_LEN) == 0)
|
if (memcmp(vcl->conf.guid, vc->guid, DDF_GUID_LEN) == 0)
|
||||||
break;
|
break;
|
||||||
// printf("vcl = %p\n", vcl);
|
dprintf("vcl = %p\n", vcl);
|
||||||
if (vcl) {
|
if (vcl) {
|
||||||
/* An update, just copy the phys_refnum and lba_offset
|
/* An update, just copy the phys_refnum and lba_offset
|
||||||
* fields
|
* fields
|
||||||
|
@ -2921,8 +2940,8 @@ static void ddf_process_update(struct supertype *st,
|
||||||
for (dn=0; dn < ddf->mppe ; dn++)
|
for (dn=0; dn < ddf->mppe ; dn++)
|
||||||
if (vcl->conf.phys_refnum[dn] ==
|
if (vcl->conf.phys_refnum[dn] ==
|
||||||
dl->disk.refnum) {
|
dl->disk.refnum) {
|
||||||
// printf("dev %d has %p at %d\n",
|
dprintf("dev %d has %p at %d\n",
|
||||||
// dl->pdnum, vcl, vn);
|
dl->pdnum, vcl, vn);
|
||||||
dl->vlist[vn++] = vcl;
|
dl->vlist[vn++] = vcl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3009,8 +3028,8 @@ static struct mdinfo *ddf_activate_spare(struct active_array *a,
|
||||||
working ++;
|
working ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf("ddf_activate: working=%d (%d) level=%d\n", working, a->info.array.raid_disks,
|
dprintf("ddf_activate: working=%d (%d) level=%d\n", working, a->info.array.raid_disks,
|
||||||
// a->info.array.level);
|
a->info.array.level);
|
||||||
if (working == a->info.array.raid_disks)
|
if (working == a->info.array.raid_disks)
|
||||||
return NULL; /* array not degraded */
|
return NULL; /* array not degraded */
|
||||||
switch (a->info.array.level) {
|
switch (a->info.array.level) {
|
||||||
|
@ -3037,7 +3056,7 @@ static struct mdinfo *ddf_activate_spare(struct active_array *a,
|
||||||
for (d = a->info.devs ; d ; d = d->next)
|
for (d = a->info.devs ; d ; d = d->next)
|
||||||
if (d->disk.raid_disk == i)
|
if (d->disk.raid_disk == i)
|
||||||
break;
|
break;
|
||||||
printf("found %d: %p %x\n", i, d, d?d->curr_state:0);
|
dprintf("found %d: %p %x\n", i, d, d?d->curr_state:0);
|
||||||
if (d && (d->state_fd >= 0))
|
if (d && (d->state_fd >= 0))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -3055,7 +3074,7 @@ static struct mdinfo *ddf_activate_spare(struct active_array *a,
|
||||||
for (d2 = a->info.devs ; d2 ; d2 = d2->next)
|
for (d2 = a->info.devs ; d2 ; d2 = d2->next)
|
||||||
if (d2->disk.major == dl->major &&
|
if (d2->disk.major == dl->major &&
|
||||||
d2->disk.minor == dl->minor) {
|
d2->disk.minor == dl->minor) {
|
||||||
printf("%x:%x already in array\n", dl->major, dl->minor);
|
dprintf("%x:%x already in array\n", dl->major, dl->minor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (d2)
|
if (d2)
|
||||||
|
@ -3083,7 +3102,7 @@ static struct mdinfo *ddf_activate_spare(struct active_array *a,
|
||||||
}
|
}
|
||||||
if ( ! (is_dedicated ||
|
if ( ! (is_dedicated ||
|
||||||
(is_global && global_ok))) {
|
(is_global && global_ok))) {
|
||||||
printf("%x:%x not suitable: %d %d\n", dl->major, dl->minor,
|
dprintf("%x:%x not suitable: %d %d\n", dl->major, dl->minor,
|
||||||
is_dedicated, is_global);
|
is_dedicated, is_global);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -3092,7 +3111,7 @@ static struct mdinfo *ddf_activate_spare(struct active_array *a,
|
||||||
* We need a->info.component_size sectors */
|
* We need a->info.component_size sectors */
|
||||||
ex = get_extents(ddf, dl);
|
ex = get_extents(ddf, dl);
|
||||||
if (!ex) {
|
if (!ex) {
|
||||||
printf("cannot get extents\n");
|
dprintf("cannot get extents\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
j = 0; pos = 0;
|
j = 0; pos = 0;
|
||||||
|
@ -3108,7 +3127,7 @@ static struct mdinfo *ddf_activate_spare(struct active_array *a,
|
||||||
|
|
||||||
free(ex);
|
free(ex);
|
||||||
if (esize < a->info.component_size) {
|
if (esize < a->info.component_size) {
|
||||||
printf("%x:%x has no room: %llu %llu\n", dl->major, dl->minor,
|
dprintf("%x:%x has no room: %llu %llu\n", dl->major, dl->minor,
|
||||||
esize, a->info.component_size);
|
esize, a->info.component_size);
|
||||||
/* No room */
|
/* No room */
|
||||||
continue;
|
continue;
|
||||||
|
@ -3127,7 +3146,7 @@ static struct mdinfo *ddf_activate_spare(struct active_array *a,
|
||||||
di->container_member = dl->pdnum;
|
di->container_member = dl->pdnum;
|
||||||
di->next = rv;
|
di->next = rv;
|
||||||
rv = di;
|
rv = di;
|
||||||
printf("%x:%x to be %d at %llu\n", dl->major, dl->minor,
|
dprintf("%x:%x to be %d at %llu\n", dl->major, dl->minor,
|
||||||
i, pos);
|
i, pos);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1294,7 +1294,8 @@ static int store_zero_imsm(struct supertype *st, int fd)
|
||||||
|
|
||||||
static int validate_geometry_imsm(struct supertype *st, int level, int layout,
|
static int validate_geometry_imsm(struct supertype *st, int level, int layout,
|
||||||
int raiddisks, int chunk, unsigned long long size,
|
int raiddisks, int chunk, unsigned long long size,
|
||||||
char *dev, unsigned long long *freesize)
|
char *dev, unsigned long long *freesize,
|
||||||
|
int verbose)
|
||||||
{
|
{
|
||||||
int fd, cfd;
|
int fd, cfd;
|
||||||
struct mdinfo *sra;
|
struct mdinfo *sra;
|
||||||
|
@ -1309,12 +1310,14 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout,
|
||||||
int rv = st->ss->validate_geometry(st, level, layout,
|
int rv = st->ss->validate_geometry(st, level, layout,
|
||||||
raiddisks, chunk,
|
raiddisks, chunk,
|
||||||
size,
|
size,
|
||||||
NULL, freesize);
|
NULL, freesize,
|
||||||
|
verbose);
|
||||||
if (rv)
|
if (rv)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
return st->ss->validate_geometry(st, level, layout, raiddisks,
|
return st->ss->validate_geometry(st, level, layout, raiddisks,
|
||||||
chunk, size, dev, freesize);
|
chunk, size, dev, freesize,
|
||||||
|
verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (st->sb) {
|
if (st->sb) {
|
||||||
|
@ -1324,12 +1327,14 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout,
|
||||||
int rv = st->ss->validate_geometry(st, level, layout,
|
int rv = st->ss->validate_geometry(st, level, layout,
|
||||||
raiddisks, chunk,
|
raiddisks, chunk,
|
||||||
size,
|
size,
|
||||||
NULL, freesize);
|
NULL, freesize,
|
||||||
|
verbose);
|
||||||
if (rv)
|
if (rv)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
return st->ss->validate_geometry(st, level, layout, raiddisks,
|
return st->ss->validate_geometry(st, level, layout, raiddisks,
|
||||||
chunk, size, dev, freesize);
|
chunk, size, dev, freesize,
|
||||||
|
verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* limit creation to the following levels */
|
/* limit creation to the following levels */
|
||||||
|
@ -1347,14 +1352,16 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout,
|
||||||
/* This device needs to be a device in an 'imsm' container */
|
/* This device needs to be a device in an 'imsm' container */
|
||||||
fd = open(dev, O_RDONLY|O_EXCL, 0);
|
fd = open(dev, O_RDONLY|O_EXCL, 0);
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
|
if (verbose)
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
Name ": Cannot create this array on device %s\n",
|
Name ": imsm: Cannot create this array on "
|
||||||
dev);
|
"device %s\n", dev);
|
||||||
close(fd);
|
close(fd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (errno != EBUSY || (fd = open(dev, O_RDONLY, 0)) < 0) {
|
if (errno != EBUSY || (fd = open(dev, O_RDONLY, 0)) < 0) {
|
||||||
fprintf(stderr, Name ": Cannot open %s: %s\n",
|
if (verbose)
|
||||||
|
fprintf(stderr, Name ": imsm: Cannot open %s: %s\n",
|
||||||
dev, strerror(errno));
|
dev, strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1362,8 +1369,9 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout,
|
||||||
cfd = open_container(fd);
|
cfd = open_container(fd);
|
||||||
if (cfd < 0) {
|
if (cfd < 0) {
|
||||||
close(fd);
|
close(fd);
|
||||||
fprintf(stderr, Name ": Cannot use %s: It is busy\n",
|
if (verbose)
|
||||||
dev);
|
fprintf(stderr, Name ": imsm: Cannot use %s: %s\n",
|
||||||
|
dev, strerror(EBUSY));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
sra = sysfs_read(cfd, 0, GET_VERSION);
|
sra = sysfs_read(cfd, 0, GET_VERSION);
|
||||||
|
@ -1381,7 +1389,8 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout,
|
||||||
close(cfd);
|
close(cfd);
|
||||||
return st->ss->validate_geometry(st, level, layout,
|
return st->ss->validate_geometry(st, level, layout,
|
||||||
raiddisks, chunk, size,
|
raiddisks, chunk, size,
|
||||||
dev, freesize);
|
dev, freesize,
|
||||||
|
verbose);
|
||||||
}
|
}
|
||||||
close(cfd);
|
close(cfd);
|
||||||
} else /* may belong to another container */
|
} else /* may belong to another container */
|
||||||
|
@ -1393,7 +1402,8 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout,
|
||||||
static int validate_geometry_imsm_container(struct supertype *st, int level,
|
static int validate_geometry_imsm_container(struct supertype *st, int level,
|
||||||
int layout, int raiddisks, int chunk,
|
int layout, int raiddisks, int chunk,
|
||||||
unsigned long long size, char *dev,
|
unsigned long long size, char *dev,
|
||||||
unsigned long long *freesize)
|
unsigned long long *freesize,
|
||||||
|
int verbose)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
unsigned long long ldsize;
|
unsigned long long ldsize;
|
||||||
|
@ -1405,7 +1415,8 @@ static int validate_geometry_imsm_container(struct supertype *st, int level,
|
||||||
|
|
||||||
fd = open(dev, O_RDONLY|O_EXCL, 0);
|
fd = open(dev, O_RDONLY|O_EXCL, 0);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
fprintf(stderr, Name ": Cannot open %s: %s\n",
|
if (verbose)
|
||||||
|
fprintf(stderr, Name ": imsm: Cannot open %s: %s\n",
|
||||||
dev, strerror(errno));
|
dev, strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1426,7 +1437,8 @@ static int validate_geometry_imsm_container(struct supertype *st, int level,
|
||||||
static int validate_geometry_imsm_volume(struct supertype *st, int level,
|
static int validate_geometry_imsm_volume(struct supertype *st, int level,
|
||||||
int layout, int raiddisks, int chunk,
|
int layout, int raiddisks, int chunk,
|
||||||
unsigned long long size, char *dev,
|
unsigned long long size, char *dev,
|
||||||
unsigned long long *freesize)
|
unsigned long long *freesize,
|
||||||
|
int verbose)
|
||||||
{
|
{
|
||||||
struct stat stb;
|
struct stat stb;
|
||||||
struct intel_super *super = st->sb;
|
struct intel_super *super = st->sb;
|
||||||
|
@ -1440,8 +1452,9 @@ static int validate_geometry_imsm_volume(struct supertype *st, int level,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (level == 1 && raiddisks > 2) {
|
if (level == 1 && raiddisks > 2) {
|
||||||
fprintf(stderr, Name ": imsm does not support more than 2 "
|
if (verbose)
|
||||||
"in a raid1 configuration\n");
|
fprintf(stderr, Name ": imsm does not support more "
|
||||||
|
"than 2 in a raid1 configuration\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1476,8 +1489,10 @@ static int validate_geometry_imsm_volume(struct supertype *st, int level,
|
||||||
free(e);
|
free(e);
|
||||||
}
|
}
|
||||||
if (dcnt < raiddisks) {
|
if (dcnt < raiddisks) {
|
||||||
fprintf(stderr, Name ": Not enough devices with space "
|
if (verbose)
|
||||||
"for this array (%d < %d)\n",
|
fprintf(stderr, Name ": imsm: Not enough "
|
||||||
|
"devices with space for this array "
|
||||||
|
"(%d < %d)\n",
|
||||||
dcnt, raiddisks);
|
dcnt, raiddisks);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1494,8 +1509,9 @@ static int validate_geometry_imsm_volume(struct supertype *st, int level,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!dl) {
|
if (!dl) {
|
||||||
fprintf(stderr, Name ": %s is not in the same imsm set\n",
|
if (verbose)
|
||||||
dev);
|
fprintf(stderr, Name ": %s is not in the "
|
||||||
|
"same imsm set\n", dev);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
e = get_extents(super, dl);
|
e = get_extents(super, dl);
|
||||||
|
|
7
super0.c
7
super0.c
|
@ -1038,7 +1038,8 @@ static void free_super0(struct supertype *st)
|
||||||
static int validate_geometry0(struct supertype *st, int level,
|
static int validate_geometry0(struct supertype *st, int level,
|
||||||
int layout, int raiddisks,
|
int layout, int raiddisks,
|
||||||
int chunk, unsigned long long size,
|
int chunk, unsigned long long size,
|
||||||
char *subdev, unsigned long long *freesize)
|
char *subdev, unsigned long long *freesize,
|
||||||
|
int verbose)
|
||||||
{
|
{
|
||||||
unsigned long long ldsize;
|
unsigned long long ldsize;
|
||||||
int fd;
|
int fd;
|
||||||
|
@ -1054,10 +1055,12 @@ static int validate_geometry0(struct supertype *st, int level,
|
||||||
|
|
||||||
fd = open(subdev, O_RDONLY|O_EXCL, 0);
|
fd = open(subdev, O_RDONLY|O_EXCL, 0);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
fprintf(stderr, Name ": Cannot open %s: %s\n",
|
if (verbose)
|
||||||
|
fprintf(stderr, Name ": super0.90 cannot open %s: %s\n",
|
||||||
subdev, strerror(errno));
|
subdev, strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!get_dev_size(fd, subdev, &ldsize)) {
|
if (!get_dev_size(fd, subdev, &ldsize)) {
|
||||||
close(fd);
|
close(fd);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
7
super1.c
7
super1.c
|
@ -1465,7 +1465,8 @@ static void free_super1(struct supertype *st)
|
||||||
static int validate_geometry1(struct supertype *st, int level,
|
static int validate_geometry1(struct supertype *st, int level,
|
||||||
int layout, int raiddisks,
|
int layout, int raiddisks,
|
||||||
int chunk, unsigned long long size,
|
int chunk, unsigned long long size,
|
||||||
char *subdev, unsigned long long *freesize)
|
char *subdev, unsigned long long *freesize,
|
||||||
|
int verbose)
|
||||||
{
|
{
|
||||||
unsigned long long ldsize;
|
unsigned long long ldsize;
|
||||||
int fd;
|
int fd;
|
||||||
|
@ -1477,10 +1478,12 @@ static int validate_geometry1(struct supertype *st, int level,
|
||||||
|
|
||||||
fd = open(subdev, O_RDONLY|O_EXCL, 0);
|
fd = open(subdev, O_RDONLY|O_EXCL, 0);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
fprintf(stderr, Name ": Cannot open %s: %s\n",
|
if (verbose)
|
||||||
|
fprintf(stderr, Name ": super1.x cannot open %s: %s\n",
|
||||||
subdev, strerror(errno));
|
subdev, strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!get_dev_size(fd, subdev, &ldsize)) {
|
if (!get_dev_size(fd, subdev, &ldsize)) {
|
||||||
close(fd);
|
close(fd);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue