summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_io.c
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2005-08-29 11:39:24 +0000
committerpjd <pjd@FreeBSD.org>2005-08-29 11:39:24 +0000
commitaa258f8f8554a90d49c4cdfb9f4fc26c8117144d (patch)
treee9d4aefd4f204b730e3f8e98070c420c358a734b /sys/geom/geom_io.c
parenta520307ce1003200de2b34850148fa2cb96c5af9 (diff)
downloadFreeBSD-src-aa258f8f8554a90d49c4cdfb9f4fc26c8117144d.zip
FreeBSD-src-aa258f8f8554a90d49c4cdfb9f4fc26c8117144d.tar.gz
Use KTR to log allocations and destructions of bios.
This should hopefully allow to track down "duplicate free of g_bio" panics.
Diffstat (limited to 'sys/geom/geom_io.c')
-rw-r--r--sys/geom/geom_io.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c
index ca7e1f0..f50dad9 100644
--- a/sys/geom/geom_io.c
+++ b/sys/geom/geom_io.c
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <sys/bio.h>
#include <sys/ktr.h>
+#include <sys/stack.h>
#include <sys/errno.h>
#include <geom/geom.h>
@@ -112,6 +113,15 @@ g_new_bio(void)
struct bio *bp;
bp = uma_zalloc(biozone, M_NOWAIT | M_ZERO);
+#ifdef KTR
+ if (KTR_COMPILE & KTR_GEOM) {
+ struct stack st;
+
+ CTR1(KTR_GEOM, "g_new_bio(): %p", bp);
+ stack_save(&st);
+ CTRSTACK(KTR_GEOM, &st, 3, 0);
+ }
+#endif
return (bp);
}
@@ -121,13 +131,30 @@ g_alloc_bio(void)
struct bio *bp;
bp = uma_zalloc(biozone, M_WAITOK | M_ZERO);
+#ifdef KTR
+ if (KTR_COMPILE & KTR_GEOM) {
+ struct stack st;
+
+ CTR1(KTR_GEOM, "g_alloc_bio(): %p", bp);
+ stack_save(&st);
+ CTRSTACK(KTR_GEOM, &st, 3, 0);
+ }
+#endif
return (bp);
}
void
g_destroy_bio(struct bio *bp)
{
+#ifdef KTR
+ if (KTR_COMPILE & KTR_GEOM) {
+ struct stack st;
+ CTR1(KTR_GEOM, "g_destroy_bio(): %p", bp);
+ stack_save(&st);
+ CTRSTACK(KTR_GEOM, &st, 3, 0);
+ }
+#endif
uma_zfree(biozone, bp);
}
@@ -146,6 +173,15 @@ g_clone_bio(struct bio *bp)
bp2->bio_attribute = bp->bio_attribute;
bp->bio_children++;
}
+#ifdef KTR
+ if (KTR_COMPILE & KTR_GEOM) {
+ struct stack st;
+
+ CTR2(KTR_GEOM, "g_close_bio(%p): %p", bp, bp2);
+ stack_save(&st);
+ CTRSTACK(KTR_GEOM, &st, 3, 0);
+ }
+#endif
return(bp2);
}
OpenPOWER on IntegriCloud