FreeBSD/sys/geom/vinum/geom_vinum_plex.c
/*
 * Handle a finished initialization BIO.
 */
Handle a finished initialization BIO.
Handle a finished initialization BIO .
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;
	off_t start, length;
	caddr_t data;
	int error;
	s = bp->bio_caller1;
	start = bp->bio_offset;
	length = bp->bio_length;
	error = bp->bio_error;
	data = bp->bio_data;
	KASSERT(s != NULL, ("gv_init_complete: NULL s"));
	d = s->drive_sc;
	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);
	if (start >= s->drive_offset + s->size) {
		if (data != NULL)
			g_free(data);
		g_topology_assert_not();
		g_topology_lock();
		g_access(cp, 0, -1, 0);
		g_topology_unlock();
		if (error) {
			gv_set_sd_state(s, GV_SD_STALE, GV_SETSTATE_FORCE |
			    GV_SETSTATE_CONFIG);
		} 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);
		}
		return;
	}
	s->initialized += length;
	start += length;
	gv_init_request(s, start, data, length);
}
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 ; off_t start , length ; caddr_t data ; int error ; s = bp -> bio_caller1 ; start = bp -> bio_offset ; length = bp -> bio_length ; error = bp -> bio_error ; data = bp -> bio_data ; KASSERT ( s != NULL , ( " " ) ) ; d = s -> drive_sc ; KASSERT ( d != NULL , ( " " ) ) ; cp = d -> consumer ; KASSERT ( cp != NULL , ( " " ) ) ; sc = p -> vinumconf ; KASSERT ( sc != NULL , ( " " ) ) ; g_destroy_bio ( bp ) ; if ( start >= s -> drive_offset + s -> size ) { if ( data != NULL ) g_free ( data ) ; g_topology_assert_not ( ) ; g_topology_lock ( ) ; g_access ( cp , 0 , -1 , 0 ) ; g_topology_unlock ( ) ; if ( error ) { gv_set_sd_state ( s , GV_SD_STALE , GV_SETSTATE_FORCE | GV_SETSTATE_CONFIG ) ; } 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 , " " " " , s -> name ) ; } return ; } s -> initialized += length ; start += length ; gv_init_request ( s , start , data , length ) ; }
Handle a finished initialization BIO.
Handle a finished initialization BIO .
/*
	 * First we need to find out if it was okay, and abort if it's not.
	 * Then we need to free previous buffers, find out the correct subdisk,
	 * as well as getting the correct starting point and length of the BIO.
	 */ /* Free the data we initialized. */