aboutsummaryrefslogtreecommitdiff
path: root/sys/geom/geom_subr.c
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2002-10-09 07:11:59 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2002-10-09 07:11:59 +0000
commit3f521b6022ea6f9efdb4b388551e4216436cc30a (patch)
treea44664bc7d5852c7393f6ea401ff5c37d19c26dc /sys/geom/geom_subr.c
parent61e1c1f39ee6e1e15e19789d7b8d6bee1b89ec58 (diff)
downloadsrc-3f521b6022ea6f9efdb4b388551e4216436cc30a.tar.gz
src-3f521b6022ea6f9efdb4b388551e4216436cc30a.zip
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.
Notes
Notes: svn path=/head/; revision=104701
Diffstat (limited to 'sys/geom/geom_subr.c')
-rw-r--r--sys/geom/geom_subr.c10
1 files changed, 6 insertions, 4 deletions
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 */