PERFORCE change 122210 for review
Ulf Lilleengen
lulf at FreeBSD.org
Sat Jun 23 15:59:57 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=122210
Change 122210 by lulf at lulf_carrot on 2007/06/23 15:59:52
- Use gv_plex_size where it should be used.
- Modify to adjust subdisk size according to the stripesize in
gv_sd_to_plex.
- Consistency in output.
Affected files ...
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_subr.c#10 edit
Differences ...
==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_subr.c#10 (text+ko) ====
@@ -275,11 +275,16 @@
/* Check correct size of this subdisk. */
s2 = LIST_FIRST(&p->subdisks);
- if (s2 != NULL && gv_is_striped(p) && (s2->size != s->size)) {
- printf("VINUM: need equal sized subdisks for this plex "
- "organisation - %s (%jd) <-> %s (%jd)\n",
- s2->name, s2->size, s->name, s->size);
- return (GV_ERR_BADSIZE);
+ /* Adjust the subdisk-size if necessary. */
+ if (s2 != NULL && gv_is_striped(p)) {
+ remainder = s->size % p->stripesize;
+ if (remainder) {
+ printf("VINUM: size of sd %s is not a "
+ "multiple of plex stripesize, taking off "
+ "%jd bytes\n", s->name,
+ (intmax_t)remainder);
+ gv_adjust_freespace(s, remainder);
+ }
}
/* Find the correct plex offset for this subdisk, if needed. */
@@ -451,7 +456,7 @@
LIST_FOREACH(s, &p->subdisks, in_plex) {
remainder = s->size % p->stripesize;
if (remainder) {
- printf("gvinum: size of sd %s is not a "
+ printf("VINUM: size of sd %s is not a "
"multiple of plex stripesize, taking off "
"%jd bytes\n", s->name,
(intmax_t)remainder);
@@ -460,30 +465,7 @@
}
}
- /* Adjust the size of our plex. */
- if (p->sdcount > 0) {
- p->size = 0;
- switch (p->org) {
- case GV_PLEX_CONCAT:
- LIST_FOREACH(s, &p->subdisks, in_plex)
- p->size += s->size;
- break;
-
- case GV_PLEX_STRIPED:
- s = LIST_FIRST(&p->subdisks);
- p->size = p->sdcount * s->size;
- break;
-
- case GV_PLEX_RAID5:
- s = LIST_FIRST(&p->subdisks);
- p->size = (p->sdcount - 1) * s->size;
- break;
-
- default:
- break;
- }
- }
-
+ p->size = gv_plex_size(p);
if (p->sdcount == 0)
state = GV_PLEX_DOWN;
else if ((p->flags & GV_PLEX_ADDED) ||
@@ -1120,6 +1102,7 @@
error = gv_sd_to_plex(s, p);
if (error)
return (error);
+ gv_update_plex_config(p);
if (rename) {
snprintf(s->name, GV_MAXSDNAME, "%s.%d", s->plex,
More information about the p4-projects
mailing list