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.
This commit is contained in:
Pawel Jakub Dawidek 2006-06-05 21:13:22 +00:00
parent ce142d9ec0
commit 4bec0ff1c4
2 changed files with 26 additions and 0 deletions

View File

@ -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);

View File

@ -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()
{