summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_io.c
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2006-06-05 21:13:22 +0000
committerpjd <pjd@FreeBSD.org>2006-06-05 21:13:22 +0000
commit280370a7dad3c18a14bdf5c30359d73f8c68695e (patch)
treed5449898299d34dae7aa204b03a6602cb1c6be83 /sys/geom/geom_io.c
parentff4adb11fea6aec1b2e943f8d750e9b222b7c687 (diff)
downloadFreeBSD-src-280370a7dad3c18a14bdf5c30359d73f8c68695e.zip
FreeBSD-src-280370a7dad3c18a14bdf5c30359d73f8c68695e.tar.gz
Add g_duplicate_bio() function which does the same thing what g_clone_bio()
is doing, but g_duplicate_bio() allocates new bio with M_WAITOK flag.
Diffstat (limited to 'sys/geom/geom_io.c')
-rw-r--r--sys/geom/geom_io.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c
index 77f446c..c95dbf8 100644
--- a/sys/geom/geom_io.c
+++ b/sys/geom/geom_io.c
@@ -186,6 +186,31 @@ g_clone_bio(struct bio *bp)
return(bp2);
}
+struct bio *
+g_duplicate_bio(struct bio *bp)
+{
+ struct bio *bp2;
+
+ bp2 = uma_zalloc(biozone, M_WAITOK | M_ZERO);
+ bp2->bio_parent = 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;
+ bp->bio_children++;
+#ifdef KTR
+ if (KTR_COMPILE & KTR_GEOM) {
+ struct stack st;
+
+ CTR2(KTR_GEOM, "g_duplicate_bio(%p): %p", bp, bp2);
+ stack_save(&st);
+ CTRSTACK(KTR_GEOM, &st, 3, 0);
+ }
+#endif
+ return(bp2);
+}
+
void
g_io_init()
{
OpenPOWER on IntegriCloud