PERFORCE change 122871 for review
Ulf Lilleengen
lulf at FreeBSD.org
Wed Jul 4 18:16:34 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=122871
Change 122871 by lulf at 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,
More information about the p4-projects
mailing list