From 0aade3f175756813bffa2ed394d419c4612e9f00 Mon Sep 17 00:00:00 2001 From: phk Date: Fri, 27 Sep 2002 20:53:47 +0000 Subject: Allocate bio's with M_NOWAIT and let the caller deal with the problems. Sponsored by: DARPA & NAI Labs. --- sys/geom/geom_io.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'sys/geom/geom_io.c') diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c index db6db80..ac71f66 100644 --- a/sys/geom/geom_io.c +++ b/sys/geom/geom_io.c @@ -124,7 +124,7 @@ g_new_bio(void) bp = g_bioq_first(&g_bio_idle); if (bp == NULL) - bp = g_malloc(sizeof *bp, M_WAITOK | M_ZERO); + bp = g_malloc(sizeof *bp, M_NOWAIT | M_ZERO); g_trace(G_T_BIO, "g_new_bio() = %p", bp); return (bp); } @@ -144,12 +144,14 @@ g_clone_bio(struct bio *bp) struct bio *bp2; bp2 = g_new_bio(); - bp2->bio_linkage = bp; - bp2->bio_cmd = bp->bio_cmd; - bp2->bio_length = bp->bio_length; - bp2->bio_offset = bp->bio_offset; - bp2->bio_data = bp->bio_data; - bp2->bio_attribute = bp->bio_attribute; + if (bp2 != NULL) { + bp2->bio_linkage = bp; + bp2->bio_cmd = bp->bio_cmd; + bp2->bio_length = bp->bio_length; + bp2->bio_offset = bp->bio_offset; + bp2->bio_data = bp->bio_data; + bp2->bio_attribute = bp->bio_attribute; + } g_trace(G_T_BIO, "g_clone_bio(%p) = %p", bp, bp2); return(bp2); } -- cgit v1.1