FreeBSD/sys/geom/vinum/geom_vinum_plex.c
/*
 * Handle a finished plex rebuild bio.
 */
Handle a finished plex rebuild bio.
Handle a finished plex rebuild bio .
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;
	error = bp->bio_error;
	flags = bp->bio_pflags;
	offset = bp->bio_offset;
	flags &= ~GV_BIO_MALLOC;
	sc = p->vinumconf;
	KASSERT(sc != NULL, ("gv_rebuild_complete: NULL sc"));
	if (bp->bio_pflags & GV_BIO_MALLOC)
		g_free(bp->bio_data);
	g_destroy_bio(bp);
	if (error) {
		g_topology_assert_not();
		g_topology_lock();
		gv_access(p->vol_sc->provider, -1, -1, 0);
		g_topology_unlock();
		G_VINUM_DEBUG(0, "rebuild of %s failed at offset %jd errno: %d",
		    p->name, (intmax_t)offset, error);
		p->flags &= ~GV_PLEX_REBUILDING;
		p->synced = 0;
		gv_plex_flush(p); 
		return;
	}
	offset += (p->stripesize * (gv_sdcount(p, 1) - 1));
	if (offset >= p->size) {
		g_topology_assert_not();
		g_topology_lock();
		gv_access(p->vol_sc->provider, -1, -1, 0);
		g_topology_unlock();
		G_VINUM_DEBUG(1, "rebuild of %s finished", p->name);
		gv_save_config(p->vinumconf);
		p->flags &= ~GV_PLEX_REBUILDING;
		p->synced = 0;
		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); 
		return;
	}
	gv_parity_request(p, flags, offset);
}
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 ; error = bp -> bio_error ; flags = bp -> bio_pflags ; offset = bp -> bio_offset ; flags &= ~ GV_BIO_MALLOC ; sc = p -> vinumconf ; KASSERT ( sc != NULL , ( " " ) ) ; if ( bp -> bio_pflags & GV_BIO_MALLOC ) g_free ( bp -> bio_data ) ; g_destroy_bio ( bp ) ; if ( error ) { g_topology_assert_not ( ) ; g_topology_lock ( ) ; gv_access ( p -> vol_sc -> provider , -1 , -1 , 0 ) ; g_topology_unlock ( ) ; G_VINUM_DEBUG ( 0 , " " , p -> name , ( intmax_t ) offset , error ) ; p -> flags &= ~ GV_PLEX_REBUILDING ; p -> synced = 0 ; gv_plex_flush ( p ) ; return ; } offset += ( p -> stripesize * ( gv_sdcount ( p , 1 ) - 1 ) ) ; if ( offset >= p -> size ) { g_topology_assert_not ( ) ; g_topology_lock ( ) ; gv_access ( p -> vol_sc -> provider , -1 , -1 , 0 ) ; g_topology_unlock ( ) ; G_VINUM_DEBUG ( 1 , " " , p -> name ) ; gv_save_config ( p -> vinumconf ) ; p -> flags &= ~ GV_PLEX_REBUILDING ; p -> synced = 0 ; 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 ) ; return ; } gv_parity_request ( p , flags , offset ) ; }
Handle a finished plex rebuild bio.
Handle a finished plex rebuild bio .
/* Clean up what we allocated. */ /* Flush out remaining rebuild BIOs. */ /* We're finished. */ /* Try to up all subdisks. */ /* Flush out remaining rebuild BIOs. */ /* Send down next. It will determine if we need to itself. */