KKASSERT(bp->b_cmd != BUF_CMD_DONE);
/*
+ * Set when an I/O is issued on the bp. Cleared by consumers
+ * (aka HAMMER), allowing the consumer to determine if I/O had
+ * actually occurred.
+ */
+ bp->b_flags |= B_IODEBUG;
+
+ /*
* Handle the swap cache intercept.
*/
if (vn_cache_strategy(vp, bio))
while ((tbp = bio->bio_caller_info1.cluster_head) != NULL) {
bio->bio_caller_info1.cluster_head = tbp->b_cluster_next;
if (error) {
- tbp->b_flags |= B_ERROR;
+ tbp->b_flags |= B_ERROR | B_IODEBUG;
tbp->b_error = error;
} else {
tbp->b_dirtyoff = tbp->b_dirtyend = 0;
tbp->b_flags &= ~(B_ERROR|B_INVAL);
+ tbp->b_flags |= B_IODEBUG;
/*
* XXX the bdwrite()/bqrelse() issued during
* cluster building clears B_RELBUF (see bqrelse()
#define B_HASBOGUS 0x00000200 /* Contains bogus pages */
#define B_EINTR 0x00000400 /* I/O was interrupted */
#define B_ERROR 0x00000800 /* I/O error occurred. */
-#define B_UNUSED12 0x00001000 /* Unused */
+#define B_IODEBUG 0x00001000 /* (Debugging only bread) */
#define B_INVAL 0x00002000 /* Does not contain valid info. */
#define B_LOCKED 0x00004000 /* Locked in core (not reusable). */
#define B_NOCACHE 0x00008000 /* Destroy buffer AND backing store */
* even if we error out here.
*/
bp = io->bp;
+ if ((hammer_debug_io & 0x0001) && (bp->b_flags & B_IODEBUG)) {
+ const char *metatype;
+
+ switch(io->type) {
+ case HAMMER_STRUCTURE_VOLUME:
+ metatype = "volume";
+ break;
+ case HAMMER_STRUCTURE_META_BUFFER:
+ switch(((struct hammer_buffer *)io)->
+ zoneX_offset & HAMMER_OFF_ZONE_MASK) {
+ case HAMMER_ZONE_BTREE:
+ metatype = "btree";
+ break;
+ case HAMMER_ZONE_META:
+ metatype = "meta";
+ break;
+ case HAMMER_ZONE_FREEMAP:
+ metatype = "freemap";
+ break;
+ default:
+ metatype = "meta?";
+ break;
+ }
+ break;
+ case HAMMER_STRUCTURE_DATA_BUFFER:
+ metatype = "data";
+ break;
+ case HAMMER_STRUCTURE_UNDO_BUFFER:
+ metatype = "undo";
+ break;
+ default:
+ metatype = "unknown";
+ break;
+ }
+ kprintf("doff %016jx %s\n",
+ (intmax_t)bp->b_bio2.bio_offset,
+ metatype);
+ }
+ bp->b_flags &= ~B_IODEBUG;
bp->b_ops = &hammer_bioops;
KKASSERT(LIST_FIRST(&bp->b_dep) == NULL);
LIST_INSERT_HEAD(&bp->b_dep, &io->worklist, node);
*/
volume = buffer->io.volume;
- if (hammer_debug_io & 0x0001) {
+ if (hammer_debug_io & 0x0004) {
kprintf("load_buffer %016llx %016llx isnew=%d od=%p\n",
(long long)buffer->zoneX_offset,
(long long)buffer->zone2_offset,
break;
}
skip:
+ if ((hammer_debug_io & 0x0001) && (bp->b_flags & B_IODEBUG)) {
+ kprintf("doff %016jx read file %016jx@%016jx\n",
+ (intmax_t)bp->b_bio2.bio_offset,
+ (intmax_t)ip->obj_id,
+ (intmax_t)bp->b_loffset);
+ }
+ bp->b_flags &= ~B_IODEBUG;
/* bp->b_flags |= B_CLUSTEROK; temporarily disabled */
n = blksize - offset;