From 447a0ebcacea15169ba671af1ffc5fdd8ba6eb72 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 25 Jun 2010 20:57:31 +1000 Subject: [PATCH] Add some more tracing. Just stuff that I have thought might be useful recently. Signed-off-by: NeilBrown --- cluster.c | 2 ++ inode.c | 11 +++++++++-- modify.c | 35 +++++++++++++++++++++++++++++++++++ orphan.c | 8 ++++++++ segments.c | 2 +- super.c | 2 ++ 6 files changed, 57 insertions(+), 3 deletions(-) diff --git a/cluster.c b/cluster.c index 9a10bac..f1685ca 100644 --- a/cluster.c +++ b/cluster.c @@ -1231,6 +1231,7 @@ static void cluster_flush(struct fs *fs, int cnum) while (!list_empty(&wc->clhead)) { int credits = 0; b = list_entry(wc->clhead.next, struct block, lru); + dprintk("flushing %s\n", strblk(b)); if (test_bit(B_Phase1, &b->flags)) set_bit(B_WritePhase1, &b->flags); else @@ -1319,6 +1320,7 @@ static void cluster_flush(struct fs *fs, int cnum) void lafs_cluster_flush(struct fs *fs, int cnum) { struct wc *wc = &fs->wc[cnum]; + dprintk("LAFS_cluster_flush %d\n", cnum); mutex_lock(&wc->lock); if (!list_empty(&wc->clhead) || (fs->checkpointing & CH_CheckpointEnd) diff --git a/inode.c b/inode.c index 99a7deb..7d7224d 100644 --- a/inode.c +++ b/inode.c @@ -523,9 +523,9 @@ static int prune(void *data, u32 addr, u64 paddr, int len) struct fs *fs = fs_from_inode(ino); int ph = !!test_bit(B_Phase1, &ib->b.flags); int i; + dprintk("PRUNE %d for %d at %lld\n", addr, len, (long long)paddr); if (paddr == 0 || len == 0) return 0; - dprintk("PRUNE %d for %d at %lld\n", addr, len, (long long)paddr); for (i = 0 ; i < len ; i++) lafs_summary_update(fs, ino, paddr+i, 0, 0, ph, 0); return len; @@ -591,6 +591,11 @@ void lafs_inode_handle_orphan(struct datablock *b) if (!test_bit(I_Trunc, &LAFSI(ino)->iflags)) { if (test_bit(I_Deleting, &LAFSI(ino)->iflags)) { LAFS_BUG(ino->i_nlink, &b->b); + if (LAFSI(ino)->cblocks + + LAFSI(ino)->pblocks + + LAFSI(ino)->ablocks + + LAFSI(ino)->ciblocks + + LAFSI(ino)->piblocks) printk("Deleting inode %lu: %ld+%ld+%ld %ld+%ld\n", ino->i_ino, LAFSI(ino)->cblocks, @@ -835,6 +840,8 @@ void lafs_inode_handle_orphan(struct datablock *b) } if (test_bit(B_Dirty, &ib->b.flags)) lafs_incorporate(fs, ib); + if (!list_empty(&ib->children)) + lafs_print_tree(&ib->b, 2); LAFS_BUG(!list_empty(&ib->children), &ib->b); out: @@ -1378,7 +1385,7 @@ lafs_new_inode(struct fs *fs, struct inode *dir, int type, int inum, int mode, abort: inode_map_new_abort(&imni); lafs_cluster_update_abort(&ui); - printk("After abort: %s\n", strblk(&imni.ib->b)); + dprintk("After abort %d: %s\n", err, strblk(&imni.ib->b)); return ERR_PTR(err); } diff --git a/modify.c b/modify.c index 20a0574..ab03a51 100644 --- a/modify.c +++ b/modify.c @@ -183,6 +183,10 @@ static int incorporate_extent(struct uninc *ui, char *buf, int size) buf += e*12; for (i = 0; i < ui->pending_cnt; i++) if (ui->pending_addr[i].physaddr) { + dprintk("AddedX %llu %u %lu\n", + (unsigned long long)ui->pending_addr[i].physaddr, + (unsigned) ui->pending_addr[i].cnt, + (unsigned long)ui->pending_addr[i].fileaddr); credits += ui->pending_addr[i].cnt; encode48(buf, ui->pending_addr[i].physaddr); encode16(buf, ui->pending_addr[i].cnt); @@ -600,6 +604,7 @@ static int add_extent(void *data, u32 addr, u64 phys, int len) if (len == 0) { /* finalise */ /* close off an extent if there is one */ + dprintk("Finalise: %d\n", (int)li->esize); if (li->esize) { p = li->data - 6; encode16(p, li->esize); @@ -611,6 +616,10 @@ static int add_extent(void *data, u32 addr, u64 phys, int len) if (li->esize && li->lastaddr == addr && li->lastphys == phys) { /* just extend the extent */ + dprintk("Extending %llu %u %lu\n", + (unsigned long long)phys, + (unsigned) len, + (unsigned long)addr); li->esize += len; li->lastaddr += len; li->lastphys += len; @@ -632,6 +641,10 @@ static int add_extent(void *data, u32 addr, u64 phys, int len) encode48(p, phys); encode16(p, len); encode32(p, addr); + dprintk("Added %llu %u %lu\n", + (unsigned long long)phys, + (unsigned) len, + (unsigned long)addr); li->esize = len; li->data = p; li->size -= 12; @@ -854,6 +867,10 @@ static u32 walk_extent(u32 addr, char **bufp, int len, struct uninc *ui, eaddr = decode32(buf); len -= 12; BUG_ON(ephys == 0 && elen != 0); // FIXME fail gracefully + dprintk("Found %llu %u %lu at %d\n", + (unsigned long long) ephys, + (unsigned) elen, + (unsigned long)eaddr, len); if (ephys == 0) { eaddr = 0xFFFFFFFFUL; found_end = 1; @@ -1171,6 +1188,7 @@ static int do_incorporate_leaf(struct fs *fs, struct indexblock *ib, check_leaf, &leafinfo); break; default: + printk("Current is %d\n", current_layout); LAFS_BUG(1, &ib->b); // FIXME should be IO error ?? } @@ -1613,6 +1631,14 @@ void lafs_incorporate(struct fs *fs, struct indexblock *ib) char *b; u16 type; u32 start; + + if (ib->uninc) { + struct block *x = ib->uninc; + while (x) { + printk("x=%s\n", strblk(x)); + x = x->chain; + } + } LAFS_BUG(ib->uninc, &ib->b); spin_lock(&ib->b.inode->i_data.private_lock); @@ -1642,6 +1668,15 @@ void lafs_incorporate(struct fs *fs, struct indexblock *ib) unmap_iblock(ib, buf-offset); goto out; } + /* Check it really is sorted */ + { + int i; + for (i=1; ib.flags) && !test_bit(B_Realloc, &ib->b.flags)) diff --git a/orphan.c b/orphan.c index e0705be..6de97ee 100644 --- a/orphan.c +++ b/orphan.c @@ -507,6 +507,14 @@ long lafs_run_orphans(struct fs *fs) spin_unlock(&fs->lock); clear_bit(OrphansRunning, &fs->fsstate); + if (test_bit(CleanerDisabled, &fs->fsstate)) { + struct datablock *db; + printk("Orphan sleeping:\n"); + list_for_each_entry(db, &fs->pending_orphans, + orphans) { + printk("orph=%s\n", strblk(&db->b)); + } + } if (list_empty_careful(&fs->pending_orphans)) /* unmount might be waiting... */ wake_up(&fs->async_complete); diff --git a/segments.c b/segments.c index c273d53..14827cb 100644 --- a/segments.c +++ b/segments.c @@ -1179,7 +1179,7 @@ static int add_free(struct fs *fs, unsigned int dev, u32 seg, u16 *youthp) struct segstat *ss; u16 *where[SEG_NUM_HEIGHTS]; int ssn; -//printk("add_free %d %d\n", (int)dev, (int)seg); + dprintk("add_free %d %d\n", (int)dev, (int)seg); spin_lock(&fs->lock); if (*youthp) { /* not really free any more */ diff --git a/super.c b/super.c index e674f25..e392e12 100644 --- a/super.c +++ b/super.c @@ -742,6 +742,8 @@ lafs_put_super(struct super_block *sb) break; dprintk("Putting ss %d\n", ss); li = LAFSI(fs->ss[ss].root); + if (test_bit(B_Realloc, &li->dblock->b.flags)) + lafs_dump_tree(); iput(fs->ss[ss].root); fs->ss[ss].root = NULL; } -- 2.39.5