summaryrefslogtreecommitdiffstats
path: root/sys
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
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')
-rw-r--r--sys/geom/geom.h1
-rw-r--r--sys/geom/geom_io.c25
2 files changed, 26 insertions, 0 deletions
diff --git a/sys/geom/geom.h b/sys/geom/geom.h
index 79a2e3b..c3863c5 100644
--- a/sys/geom/geom.h
+++ b/sys/geom/geom.h
@@ -262,6 +262,7 @@ int g_modevent(module_t, int, void *);
/* geom_io.c */
struct bio * g_clone_bio(struct bio *);
+struct bio * g_duplicate_bio(struct bio *);
void g_destroy_bio(struct bio *);
void g_io_deliver(struct bio *bp, int error);
int g_io_getattr(const char *attr, struct g_consumer *cp, int *len, void *ptr);
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