From 3f521b6022ea6f9efdb4b388551e4216436cc30a Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Wed, 9 Oct 2002 07:11:59 +0000 Subject: Add support g_clone_bio() and g_std_done() to spawn multiple children of a bio and correctly gather status when done. Sponsored by: DARPA & NAI Labs. --- sys/geom/geom_subr.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'sys/geom/geom_subr.c') diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c index bfb07323a545..45130c6f8d94 100644 --- a/sys/geom/geom_subr.c +++ b/sys/geom/geom_subr.c @@ -495,13 +495,15 @@ void g_std_done(struct bio *bp) { struct bio *bp2; - int error; bp2 = bp->bio_linkage; - error = bp->bio_error; - bp2->bio_completed = bp->bio_completed; + if (bp2->bio_error == 0) + bp2->bio_error = bp->bio_error; + bp2->bio_completed += bp->bio_completed; g_destroy_bio(bp); - g_io_deliver(bp2, error); + bp2->bio_children--; /* XXX: atomic ? */ + if (bp2->bio_children == 0) + g_io_deliver(bp2, bp2->bio_error); } /* XXX: maybe this is only g_slice_spoiled */ -- cgit v1.2.3