FreeBSD/sys/geom/eli/g_eli.c
/*
 * The function is called after we encrypt and write data.
 *
 * g_eli_start -> g_eli_crypto_run -> g_eli_crypto_write_done -> g_io_request -> G_ELI_WRITE_DONE -> g_io_deliver
 */
The function is called after we encrypt and write data.
The function is called after we encrypt and write data .
void
g_eli_write_done(struct bio *bp)
{
	struct g_eli_softc *sc;
	struct bio *pbp;
	G_ELI_LOGREQ(2, bp, "Request done.");
	pbp = bp->bio_parent;
	if (pbp->bio_error == 0 && bp->bio_error != 0)
		pbp->bio_error = bp->bio_error;
	g_destroy_bio(bp);
	pbp->bio_inbed++;
	if (pbp->bio_inbed < pbp->bio_children)
		return;
	free(pbp->bio_driver2, M_ELI);
	pbp->bio_driver2 = NULL;
	if (pbp->bio_error != 0) {
		G_ELI_LOGREQ(0, pbp, "%s() failed (error=%d)", __func__,
		    pbp->bio_error);
		pbp->bio_completed = 0;
	} else
		pbp->bio_completed = pbp->bio_length;
	sc = pbp->bio_to->geom->softc;
	g_io_deliver(pbp, pbp->bio_error);
	atomic_subtract_int(&sc->sc_inflight, 1);
}
void g_eli_write_done ( struct bio * bp ) { struct g_eli_softc * sc ; struct bio * pbp ; G_ELI_LOGREQ ( 2 , bp , " " ) ; pbp = bp -> bio_parent ; if ( pbp -> bio_error == 0 && bp -> bio_error != 0 ) pbp -> bio_error = bp -> bio_error ; g_destroy_bio ( bp ) ; pbp -> bio_inbed ++ ; if ( pbp -> bio_inbed < pbp -> bio_children ) return ; free ( pbp -> bio_driver2 , M_ELI ) ; pbp -> bio_driver2 = NULL ; if ( pbp -> bio_error != 0 ) { G_ELI_LOGREQ ( 0 , pbp , " " , __func__ , pbp -> bio_error ) ; pbp -> bio_completed = 0 ; } else pbp -> bio_completed = pbp -> bio_length ; sc = pbp -> bio_to -> geom -> softc ; g_io_deliver ( pbp , pbp -> bio_error ) ; atomic_subtract_int ( & sc -> sc_inflight , 1 ) ; }
The function is called after we encrypt and write data.
The function is called after we encrypt and write data .
/*
	 * Do we have all sectors already?
	 */ /*
	 * Write is finished, send it up.
	 */