Index: sys/bio.h =================================================================== RCS file: /usr/repo/src/sys/sys/bio.h,v retrieving revision 1.145 diff -u -p -r1.145 bio.h --- sys/bio.h 24 Nov 2005 00:53:14 -0000 1.145 +++ sys/bio.h 1 Mar 2006 18:58:53 -0000 @@ -78,6 +78,11 @@ struct bio { bio_task_t *bio_task; /* Task_queue handler */ void *bio_task_arg; /* Argument to above */ +#ifdef DIAGNOSTIC + void *_bio_caller1; + void *_bio_caller2; + uint8_t _bio_cflags; +#endif /* XXX: these go away when bio chaining is introduced */ daddr_t bio_pblkno; /* physical block number */ Index: geom/geom_io.c =================================================================== RCS file: /usr/repo/src/sys/geom/geom_io.c,v retrieving revision 1.67 diff -u -p -r1.67 geom_io.c --- geom/geom_io.c 15 Sep 2005 19:05:37 -0000 1.67 +++ geom/geom_io.c 1 Mar 2006 18:58:35 -0000 @@ -282,6 +282,21 @@ g_io_request(struct bio *bp, struct g_co KASSERT(bp->bio_data != NULL, ("NULL bp->data in g_io_request")); pp = cp->provider; KASSERT(pp != NULL, ("consumer not attached in g_io_request")); +#ifdef DIAGNOSTIC + KASSERT(bp->bio_driver1 == NULL, + ("bio_driver1 used by the consumer (geom %s)", cp->geom->name)); + KASSERT(bp->bio_driver2 == NULL, + ("bio_driver2 used by the consumer (geom %s)", cp->geom->name)); + KASSERT(bp->bio_pflags == 0, + ("bio_pflags used by the consumer (geom %s)", cp->geom->name)); + /* + * Remember consumer's private fields, so we can detect if they were + * modified by the provider. + */ + bp->_bio_caller1 = bp->bio_caller1; + bp->_bio_caller2 = bp->bio_caller2; + bp->_bio_cflags = bp->bio_cflags; +#endif if (bp->bio_cmd & (BIO_READ|BIO_WRITE|BIO_DELETE)) { KASSERT(bp->bio_offset % cp->provider->sectorsize == 0, @@ -336,6 +351,14 @@ g_io_deliver(struct bio *bp, int error) KASSERT(bp != NULL, ("NULL bp in g_io_deliver")); pp = bp->bio_to; KASSERT(pp != NULL, ("NULL bio_to in g_io_deliver")); +#ifdef DIAGNOSTIC + KASSERT(bp->bio_caller1 == bp->_bio_caller1, + ("bio_caller1 used by the provider %s", pp->name)); + KASSERT(bp->bio_caller2 == bp->_bio_caller2, + ("bio_caller2 used by the provider %s", pp->name)); + KASSERT(bp->bio_cflags == bp->_bio_cflags, + ("bio_cflags used by the provider %s", pp->name)); +#endif cp = bp->bio_from; if (cp == NULL) { bp->bio_error = error;