From owner-p4-projects@FreeBSD.ORG Wed Jul 4 18:16:34 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 3BF3C16A474; Wed, 4 Jul 2007 18:16:34 +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 0978816A41F for ; Wed, 4 Jul 2007 18:16:34 +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 EE26613C45E for ; Wed, 4 Jul 2007 18:16:33 +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 l64IGXQM010499 for ; Wed, 4 Jul 2007 18:16:33 GMT (envelope-from lulf@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l64IGXug010496 for perforce@freebsd.org; Wed, 4 Jul 2007 18:16:33 GMT (envelope-from lulf@FreeBSD.org) Date: Wed, 4 Jul 2007 18:16:33 GMT Message-Id: <200707041816.l64IGXug010496@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 122871 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: Wed, 04 Jul 2007 18:16:34 -0000 http://perforce.freebsd.org/chv.cgi?CH=122871 Change 122871 by lulf@lulf_carrot on 2007/07/04 18:15:53 - Remember to take into account that size (although highly unlikely) can be lower than GV_DFLT_SYNCSIZE. - Make gv_sync update plex->synced when a plex is synced. This means we can keep track on where we lost our last sync if we did. - Modify list to show how far a sync has come when displaying plexes. - Make plexes go up automatically when finished syncing. Affected files ... .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_init.c#13 edit .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_list.c#2 edit .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_volume.c#12 edit Differences ... ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_init.c#13 (text+ko) ==== @@ -202,10 +202,12 @@ if (p->flags & GV_PLEX_SYNCING) { return (EINPROGRESS); } + p->synced = 0; p->flags |= GV_PLEX_SYNCING; printf("VINUM: starting sync of plex %s\n", p->name); - error = gv_sync_request(up, p, 0, GV_DFLT_SYNCSIZE, BIO_READ, - NULL); + error = gv_sync_request(up, p, p->synced, + MIN(GV_DFLT_SYNCSIZE, up->size - p->synced), + BIO_READ, NULL); if (error) { printf("VINUM: error syncing plex %s\n", p->name); break; ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_list.c#2 (text+ko) ==== @@ -294,8 +294,14 @@ sbuf_printf(sb, "Plex %s:\tSize:\t%9jd bytes (%jd MB)\n", p->name, (intmax_t)p->size, (intmax_t)p->size / MEGABYTE); sbuf_printf(sb, "\t\tSubdisks: %8d\n", p->sdcount); - sbuf_printf(sb, "\t\tState: %s\n\t\tOrganization: %s", - gv_plexstate(p->state), gv_plexorg(p->org)); + sbuf_printf(sb, "\t\tState: %s\n", gv_plexstate(p->state)); + if (p->flags & GV_PLEX_SYNCING) { + sbuf_printf(sb, "\t\tSynced: "); + sbuf_printf(sb, "%16jd bytes (%d%%)\n", + (intmax_t)p->synced, + (int)((p->synced * 100) / p->size)); + } + printf("\t\tOrganization: %s", gv_plexorg(p->org)); if (gv_is_striped(p)) { sbuf_printf(sb, "\tStripe size: %s\n", gv_roughlength(p->stripesize, 1)); @@ -305,9 +311,15 @@ sbuf_printf(sb, "\t\tPart of volume %s\n", p->volume); } } else { - sbuf_printf(sb, "P %-18s %2s State: %s\tSubdisks: %5d" - "\tSize: %s\n", p->name, gv_plexorg_short(p->org), - gv_plexstate(p->state), p->sdcount, + sbuf_printf(sb, "P %-18s %2s State: ", p->name, + gv_plexorg_short(p->org)); + if (p->flags & GV_PLEX_SYNCING) { + sbuf_printf(sb, "S %d%%\t", (int)((p->synced * 100) / + p->size)); + } else { + sbuf_printf(sb, "%s\t", gv_plexstate(p->state)); + } + sbuf_printf(sb, "Subdisks: %5d\tSize: %s\n", p->sdcount, gv_roughlength(p->size, 0)); } ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_volume.c#12 (text+ko) ==== @@ -185,14 +185,16 @@ } else if (bp->bio_cmd == BIO_WRITE) { if (bp->bio_cflags & GV_BIO_MALLOC) g_free(bp->bio_data); + to->synced += bp->bio_length; /* If we're finished, clean up. */ if (bp->bio_offset + bp->bio_length >= from->size) { printf("VINUM: syncing of %s from %s completed\n", to->name, from->name); to->flags &= ~GV_PLEX_SYNCING; + to->synced = 0; /* Update our state. */ LIST_FOREACH(s, &to->subdisks, in_plex) - gv_update_sd_state(s); + gv_set_sd_state(s, GV_SD_UP, 0); } else { offset = bp->bio_offset + bp->bio_length; err = gv_sync_request(from, to, offset,