From owner-p4-projects@FreeBSD.ORG Sat Jun 23 15:59:57 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3D25016A469; Sat, 23 Jun 2007 15:59:57 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D951516A421 for ; Sat, 23 Jun 2007 15:59:56 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id CBDAF13C45D for ; Sat, 23 Jun 2007 15:59:56 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l5NFxugC004353 for ; Sat, 23 Jun 2007 15:59:56 GMT (envelope-from lulf@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l5NFxuV1004350 for perforce@freebsd.org; Sat, 23 Jun 2007 15:59:56 GMT (envelope-from lulf@FreeBSD.org) Date: Sat, 23 Jun 2007 15:59:56 GMT Message-Id: <200706231559.l5NFxuV1004350@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to lulf@FreeBSD.org using -f From: Ulf Lilleengen To: Perforce Change Reviews Cc: Subject: PERFORCE change 122210 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2007 15:59:57 -0000 http://perforce.freebsd.org/chv.cgi?CH=122210 Change 122210 by lulf@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,