svn commit: r187096 - projects/gvinum/sys/geom/vinum
Ulf Lilleengen
lulf at FreeBSD.org
Mon Jan 12 03:51:19 PST 2009
Author: lulf
Date: Mon Jan 12 11:51:18 2009
New Revision: 187096
URL: http://svn.freebsd.org/changeset/base/187096
Log:
- Save configuration automatically after a initialization, rebuild, resync or
growing.
Modified:
projects/gvinum/sys/geom/vinum/geom_vinum_plex.c
Modified: projects/gvinum/sys/geom/vinum/geom_vinum_plex.c
==============================================================================
--- projects/gvinum/sys/geom/vinum/geom_vinum_plex.c Mon Jan 12 11:47:24 2009 (r187095)
+++ projects/gvinum/sys/geom/vinum/geom_vinum_plex.c Mon Jan 12 11:51:18 2009 (r187096)
@@ -636,6 +636,7 @@ gv_sync_complete(struct gv_plex *to, str
gv_set_sd_state(s, GV_SD_UP, 0);
to->flags &= ~GV_PLEX_SYNCING;
to->synced = 0;
+ gv_post_event(sc, GV_EVENT_SAVE_CONFIG, sc, NULL, 0, 0);
} else {
offset = bp->bio_offset + bp->bio_length;
err = gv_sync_request(from, to, offset,
@@ -711,12 +712,16 @@ gv_grow_request(struct gv_plex *p, off_t
void
gv_grow_complete(struct gv_plex *p, struct bio *bp)
{
+ struct gv_softc *sc;
struct gv_sd *s;
struct gv_volume *v;
off_t origsize, offset;
int sdcount, err;
v = p->vol_sc;
+ KASSERT(v != NULL, ("gv_grow_complete: NULL v"));
+ sc = v->vinumconf;
+ KASSERT(sc != NULL, ("gv_grow_complete: NULL sc"));
err = 0;
/* If it was a read, write it. */
@@ -748,6 +753,7 @@ gv_grow_complete(struct gv_plex *p, stru
gv_access(v->provider, -1, -1, 0);
g_topology_unlock();
p->synced = 0;
+ gv_post_event(sc, GV_EVENT_SAVE_CONFIG, sc, NULL, 0, 0);
/* Issue delayed requests. */
gv_plex_flush(p);
} else {
@@ -819,6 +825,7 @@ gv_init_request(struct gv_sd *s, off_t s
void
gv_init_complete(struct gv_plex *p, struct bio *bp)
{
+ struct gv_softc *sc;
struct gv_drive *d;
struct g_consumer *cp;
struct gv_sd *s;
@@ -837,6 +844,8 @@ gv_init_complete(struct gv_plex *p, stru
KASSERT(d != NULL, ("gv_init_complete: NULL d"));
cp = d->consumer;
KASSERT(cp != NULL, ("gv_init_complete: NULL cp"));
+ sc = p->vinumconf;
+ KASSERT(sc != NULL, ("gv_init_complete: NULL sc"));
g_destroy_bio(bp);
@@ -859,6 +868,7 @@ gv_init_complete(struct gv_plex *p, stru
} else {
gv_set_sd_state(s, GV_SD_UP, GV_SETSTATE_CONFIG);
s->initialized = 0;
+ gv_post_event(sc, GV_EVENT_SAVE_CONFIG, sc, NULL, 0, 0);
G_VINUM_DEBUG(1, "subdisk '%s' init: finished "
"successfully", s->name);
}
@@ -920,12 +930,16 @@ gv_parity_request(struct gv_plex *p, int
void
gv_parity_complete(struct gv_plex *p, struct bio *bp)
{
+ struct gv_softc *sc;
int error, flags;
error = bp->bio_error;
flags = bp->bio_cflags;
flags &= ~GV_BIO_MALLOC;
+ sc = p->vinumconf;
+ KASSERT(sc != NULL, ("gv_parity_complete: NULL sc"));
+
/* Clean up what we allocated. */
if (bp->bio_cflags & GV_BIO_MALLOC)
g_free(bp->bio_data);
@@ -960,6 +974,7 @@ gv_parity_complete(struct gv_plex *p, st
/* We're finished. */
G_VINUM_DEBUG(1, "parity operation on %s finished", p->name);
p->synced = 0;
+ gv_post_event(sc, GV_EVENT_SAVE_CONFIG, sc, NULL, 0, 0);
return;
}
@@ -973,6 +988,7 @@ gv_parity_complete(struct gv_plex *p, st
void
gv_rebuild_complete(struct gv_plex *p, struct bio *bp)
{
+ struct gv_softc *sc;
struct gv_sd *s;
int error, flags;
off_t offset;
@@ -981,6 +997,8 @@ gv_rebuild_complete(struct gv_plex *p, s
flags = bp->bio_cflags;
offset = bp->bio_offset;
flags &= ~GV_BIO_MALLOC;
+ sc = p->vinumconf;
+ KASSERT(sc != NULL, ("gv_rebuild_complete: NULL sc"));
/* Clean up what we allocated. */
if (bp->bio_cflags & GV_BIO_MALLOC)
@@ -1016,6 +1034,7 @@ gv_rebuild_complete(struct gv_plex *p, s
/* Try to up all subdisks. */
LIST_FOREACH(s, &p->subdisks, in_plex)
gv_update_sd_state(s);
+ gv_post_event(sc, GV_EVENT_SAVE_CONFIG, sc, NULL, 0, 0);
gv_plex_flush(p); /* Flush out remaining rebuild BIOs. */
return;
}
More information about the svn-src-projects
mailing list