Subject: afs/fs/cachefs vjournal.c,1.6,1.7 super.c,1.38,1.39 replay.c,1.7,1.8 recycling.c,1.31,1.32 journal.c,1.43,1.44 cachefs-int.h,1.42,1.43 block.c,1.10,1.11 aops.c,1.48,1.49

From: [email-masked]
Date: Mon, 15 Sep 2003 14:53:28 +0100

Update of /home/cvs/afs/fs/cachefs
In directory phoenix.infradead.org:/tmp/cvs-serv30833/fs/cachefs

Modified Files:
	vjournal.c super.c replay.c recycling.c journal.c 
	cachefs-int.h block.c aops.c 
Log Message:
validity journal replaying now works

Index: vjournal.c
===================================================================
RCS file: /home/cvs/afs/fs/cachefs/vjournal.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- vjournal.c	12 Sep 2003 11:42:45 -0000	1.6
+++ vjournal.c	15 Sep 2003 13:53:24 -0000	1.7
@@ -13,8 +13,27 @@
 #include <linux/init.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
+#include <linux/blkdev.h>
 #include "cachefs-int.h"
 
+static int cachefs_vj_replay_actor(read_descriptor_t *desc,
+				   struct page *page,
+				   unsigned long offset,
+				   unsigned long size);
+
+static int cachefs_vj_replay_entry(struct cachefs_super *super,
+				   struct cachefs_vj_entry *vjentry);
+
+static int cachefs_vj_walk_indirection_chain(struct cachefs_super *super,
+					     struct cachefs_inode *inode,
+					     struct cachefs_vj_entry *vjentry);
+
+struct cachefs_vjio_block_path {
+	struct page			*page;
+	cachefs_blockix_t		bix;		/* block number for this level */
+	unsigned			offset;		/* offset into parent pointer block */
+};
+
 /*****************************************************************************/
 /*
  * allocate an entry in the block validity tracking journal
@@ -130,7 +149,7 @@
 	spin_unlock(&super->vjnl_lock);
 
 	wake_up(&super->vjnl_alloc_wq);
-	
+
 	cachefs_put_page(vjentry->vpage);
 	cachefs_block_put(vjentry->vblock);
 	kfree(vjentry);
@@ -147,7 +166,7 @@
 	struct cachefs_vj_entry *vjentry = block->vjentry;
 	struct cachefs_super *super;
 
-	_enter("{vs=%u pg={%u}+%u up={%u}+%u",
+	_enter("{vs=%u pg={%x}+%x up={%x}+%x",
 	       vjentry->vslot, vjentry->ino, vjentry->pgnum,
 	       vjentry->upblock, vjentry->upentry);
 
@@ -171,9 +190,9 @@
 {
 	struct cachefs_super *super;
 
-	_enter("{vs=%u pg={%u}+%u up={%u}+%u",
+	_enter("{vs=%u pg={%x}+%x up={%x}+%x vjp=%p",
 	       vjentry->vslot, vjentry->ino, vjentry->pgnum,
-	       vjentry->upblock, vjentry->upentry);
+	       vjentry->upblock, vjentry->upentry, vjentry->vpage);
 
 	super = vjentry->vblock->super;
 
@@ -188,8 +207,8 @@
 
 /*****************************************************************************/
 /*
- * unallocate and recycle a single data storage block that's marked as invalid
- * in the validity journal
+ * clear an entry in the vjournal once the corresponding block has been written
+ * to by the netfs
  */
 void cachefs_vj_note_write_completion(struct cachefs_super *super)
 {
@@ -248,3 +267,311 @@
 	_leave(" [error %d]", ret);
 
 } /* end cachefs_vj_note_write_completion() */
+
+/*****************************************************************************/
+/*
+ * replay the validity journal
+ * - this involves unallocating every block mentioned
+ */
+int cachefs_vj_replay(struct cachefs_super *super)
+{
+	struct file_ra_state ra;
+	read_descriptor_t desc;
+	loff_t ppos;
+
+	_enter("");
+
+	printk("CacheFS: Replaying the validity journal...\n");
+
+	file_ra_state_init(&ra, super->imisc->i_mapping);
+
+	memset(&desc, 0, sizeof(desc));
+	desc.count = super->layout->bix_wbjournal;
+	desc.count -= super->layout->bix_vjournal;
+	desc.count *= super->layout->bsize;
+	desc.buf   = (char *) super;
+
+	ppos = super->layout->bix_vjournal;
+	ppos *= super->layout->bsize;
+
+	do_generic_mapping_read(super->imisc->i_mapping, &ra, NULL, &ppos,
+				&desc, cachefs_vj_replay_actor);
+	if (desc.error < 0)
+		goto error;
+	return 0;
+
+ error:
+	printk("CacheFS: failed to replay vjournal: %d\n", desc.error);
+	return desc.error;
+
+} /* end cachefs_vj_replay() */
+
+/*****************************************************************************/
+/*
+ * replay a segment of the validity journal
+ */
+static int cachefs_vj_replay_actor(read_descriptor_t *desc,
+				   struct page *page,
+				   unsigned long offset,
+				   unsigned long size)
+{
+	struct cachefs_ondisc_validity_journal *vjmark;
+	struct cachefs_vj_entry *vjentry;
+	struct cachefs_super *super = (struct cachefs_super *) desc->buf;
+	struct cachefs_page *pageio;
+	unsigned long stop;
+	void *data;
+	int ret;
+
+	_enter("{%zx},{%lu},%lu,%lu", desc->count, page->index, offset, size);
+
+	if (size > desc->count)
+		size = desc->count;
+
+	BUG_ON(offset % sizeof(*vjmark));
+	BUG_ON(size % sizeof(*vjmark));
+
+	stop = offset + size;
+
+	pageio = cachefs_page_grab_private(page);
+	cachefs_block_set(super, pageio->mapped_block, page, pageio);
+
+	data = kmap(page);
+
+	for (;
+	     offset < stop;
+	     offset += sizeof(struct cachefs_ondisc_validity_journal)
+	     ) {
+		vjmark = data + offset;
+
+		if (vjmark->ino == 0 && vjmark->pgnum == 0)
+			continue;
+
+		if (vjmark->ino < CACHEFS_INO__FIRST_FILE ||
+		    vjmark->ino >= CACHEFS_INO_MISC) {
+			printk("CacheFS: Impossible ino recorded in vjnl (%x)\n",
+			       vjmark->ino);
+			desc->error = -EINVAL;
+			break;
+		}
+
+		vjentry = kmalloc(sizeof(*vjentry), GFP_KERNEL);
+		if (!vjentry) {
+			desc->error = -ENOMEM;
+			break;
+		}
+
+		memset(vjentry, 0, sizeof(vjentry));
+		INIT_LIST_HEAD(&vjentry->link);
+
+		vjentry->vslot	= page->index - super->layout->bix_vjournal;
+		vjentry->vslot	*= CACHEFS_ONDISC_VJNL_ENTPERPAGE;
+		vjentry->vslot	+= offset / sizeof(vjentry);
+
+		vjentry->ino	= vjmark->ino;
+		vjentry->pgnum	= vjmark->pgnum;
+		vjentry->ventry	= offset;
+		vjentry->vpage	= page;
+		vjentry->vblock	= __cachefs_get_page_block(page);
+
+		cachefs_block_get(vjentry->vblock);
+		get_page(vjentry->vpage);
+
+		ret = cachefs_vj_replay_entry(super, vjentry);
+		if (ret < 0) {
+			desc->error = ret;
+			cachefs_put_page(vjentry->vpage);
+			cachefs_block_put(vjentry->vblock);
+			kfree(vjentry);
+			break;
+		}
+	}
+
+	kunmap(page);
+
+	desc->count	-= size;
+	desc->written	+= size;
+	return size;
+} /* end cachefs_vj_replay_actor() */
+
+/*****************************************************************************/
+/*
+ * replay an entry from the validity journal
+ */
+static int cachefs_vj_replay_entry(struct cachefs_super *super,
+				   struct cachefs_vj_entry *vjentry)
+{
+	struct cachefs_inode *inode;
+	int ret;
+
+	_enter(",{ino=%x pg=%x}", vjentry->ino, vjentry->pgnum);
+
+	ret = cachefs_iget(super, vjentry->ino, &inode);
+	if (ret < 0)
+		goto error;
+
+	ret = -EINVAL;
+	if (inode->flags & CACHEFS_ACTIVE_INODE_ISINDEX) {
+		printk("CacheFS: Index inode %x has block in v-journal\n",
+		       vjentry->ino);
+		goto error2;
+	}
+
+	ret = cachefs_vj_walk_indirection_chain(super, inode, vjentry);
+	if (ret < 0) {
+		printk("CacheFS:"
+		       " Inode %x has non-existent block in v-journal\n",
+		       vjentry->ino);
+		goto error2;
+	}
+
+	cachefs_vj_cancel(vjentry);
+
+ error2:
+	cachefs_iput(inode);
+ error:
+	_leave(" = %d", ret);
+	return ret;
+} /* end cachefs_vj_replay_entry() */
+
+/*****************************************************************************/
+/*
+ * walk the indirection chain to a block, looking for the ptr to it
+ */
+static int cachefs_vj_walk_indirection_chain(struct cachefs_super *super,
+					     struct cachefs_inode *inode,
+					     struct cachefs_vj_entry *vjentry)
+{
+	struct cachefs_vjio_block_path path[4];
+	const size_t ptrperblk = PAGE_SIZE / sizeof(cachefs_blockix_t);
+	sector_t iblock;
+	size_t ptrqty, notboundary = 1;
+	int pix, ret;
+
+	_enter(",%lx,{%x}", inode->vfs_inode.i_ino, vjentry->pgnum);
+
+	if (vjentry->pgnum / ptrperblk >= ptrperblk) {
+		_leave(" = -EIO [range]");
+		return -EIO;
+	}
+
+	memset(path, 0, sizeof(path));
+
+	/* is it inside direct range? */
+	iblock = vjentry->pgnum;
+	ptrqty = super->sb->s_blocksize;
+	ptrqty -= sizeof(struct cachefs_ondisc_metadata);
+	ptrqty /= sizeof(cachefs_blockix_t);
+	if (iblock < ptrqty) {
+		_debug("direct (%llx/%x)", iblock, ptrqty);
+		notboundary = ptrqty - iblock + 1;
+
+		path[0].offset	= iblock * sizeof(cachefs_blockix_t);
+		path[0].offset	+= offsetof(struct cachefs_ondisc_metadata,
+					    direct);
+		path[1].page	= inode->metadata_page;
+		pix = 0;
+		goto process;
+	}
+	iblock -= ptrqty;
+
+	/* is it inside single-indirect range? */
+	ptrqty = ptrperblk;
+	if (iblock < ptrqty) {
+		_debug("indirect (%llx/%x)", iblock, ptrqty);
+		notboundary = (iblock + 1) & (ptrperblk - 1);
+
+		path[0].offset	= iblock * sizeof(cachefs_blockix_t);
+		path[1].offset	= offsetof(struct cachefs_ondisc_metadata,
+					   single_indirect);
+		path[2].page	= inode->metadata_page;
+		pix = 1;
+		goto process;
+	}
+	iblock -= ptrqty;
+
+	/* is it inside double-indirect range? */
+	ptrqty *= ptrqty;
+	if (iblock < ptrqty) {
+		_debug("double indirect (%llx/%x)", iblock, ptrqty);
+		notboundary = (iblock + 1) & (ptrperblk - 1);
+
+		path[0].offset	=
+			sector_div(iblock,
+				   PAGE_SIZE / sizeof(cachefs_blockix_t));
+		path[0].offset	*= sizeof(cachefs_blockix_t);
+		path[1].offset	= iblock * sizeof(cachefs_blockix_t);
+		path[2].offset	= offsetof(struct cachefs_ondisc_metadata,
+					   double_indirect);
+		path[3].page	= inode->metadata_page;
+		pix = 2;
+		goto process;
+	}
+
+	/* it seems to be inside triple-indirect range, which isn't supported
+	 * yet (TODO) */
+	BUG();
+	pix = 3;
+
+	/* walk the path, filling in missing steps if required */
+ process:
+	page_cache_get(path[pix + 1].page);
+
+	path[pix].offset += inode->metadata_offset;
+	path[pix + 1].bix = __cachefs_get_page_block(path[pix + 1].page)->bix;
+
+	ret = 0;
+	for (; pix >= 0; pix--) {
+		struct cachefs_vjio_block_path *step = &path[pix];
+
+		_debug("step level %u { ptr={%lx}+%x / bix=%x }",
+		       pix, step[1].page->index, step->offset, step[1].bix);
+
+		/* get the block number for this level */
+		if (!step->bix) {
+			u8 *data = kmap(step[1].page);
+			step->bix =
+				*(cachefs_blockix_t *)(data + step->offset);
+			kunmap(data);
+		}
+
+		/* allocate this block if necessary */
+		if (!step->bix) {
+			_debug("path incomplete at level %d", pix);
+			ret = -ENODATA;
+			break;
+		}
+
+		/* if we're at the leaf, we don't need to actually access the
+		 * block */
+		if (pix <= 0)
+			break;
+
+		/* initiate or read the this block as appropriate */
+		_debug("reading level %d block %x", pix, step->bix);
+
+		ret = cachefs_block_read(super, NULL, step->bix, 0, NULL,
+					 &step->page);
+		if (ret < 0) {
+			printk("CacheFS: "
+			       "read I/O error on level %d block %x: %d\n",
+			       pix, step->bix, ret);
+			break;
+		}
+
+		wait_on_page_locked(step->page);
+	}
+
+	vjentry->bix     = path[0].bix;
+	vjentry->upblock = __cachefs_get_page_block(path[1].page)->bix;
+	vjentry->upentry = path[0].offset;
+
+	/* release the pages used to walk the path */
+	for (pix = sizeof(path) / sizeof(path[0]) - 1; pix > 0; pix--)
+		cachefs_put_page(path[pix].page);
+
+	_leave(" = %d [bix=%x up={%x}+%x]",
+	       ret, vjentry->bix, vjentry->upblock, vjentry->upentry);
+
+	return ret;
+} /* end cachefs_vj_walk_indirection_chain() */

Index: super.c
===================================================================
RCS file: /home/cvs/afs/fs/cachefs/super.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- super.c	9 Jul 2003 10:39:50 -0000	1.38
+++ super.c	15 Sep 2003 13:53:25 -0000	1.39
@@ -416,6 +416,12 @@
 
 	sb->s_root = root;
 
+	if (jnlreplay) {
+		ret = cachefs_vj_replay(super);
+		if (ret < 0)
+			goto error;
+	}
+
 	cachefs_add_cache((struct cachefs_super *) sb->s_fs_info, srch);
 
 	kleave(" = 0 [super=%p]", super);

Index: replay.c
===================================================================
RCS file: /home/cvs/afs/fs/cachefs/replay.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- replay.c	12 Sep 2003 14:02:09 -0000	1.7
+++ replay.c	15 Sep 2003 13:53:25 -0000	1.8
@@ -229,7 +229,7 @@
 				super->rcm_indirect	= jentry->rcm_indirect;
 				super->rcm_ino		= jentry->rcm_ino;
 
-				kdebug("UJNL[%u] ACK %u"
+				_debug("UJNL[%u] ACK %u"
 				       " { a=%x[%u] r=%x R=%x:%u:%x[%u-%u] }"
 				       " hi=%u",
 				       slot,
@@ -247,7 +247,7 @@
 				desc->ack_hi = jentry->batch;
 			}
 			else {
-				kdebug("UJNL[%u] ACK %u { hi=%u }",
+				_debug("UJNL[%u] ACK %u { hi=%u }",
 				       slot,
 				       jentry->batch,
 				       desc->ack_hi);
@@ -287,7 +287,7 @@
 	unsigned long stop;
 	void *data;
 
-	kenter("{%zx},{%lu},%lu,%lu", desc->count, page->index, offset, size);
+	_enter("{%zx},{%lu},%lu,%lu", desc->count, page->index, offset, size);
 
 	if (size > desc->count)
 		size = desc->count;
@@ -350,7 +350,7 @@
 	unsigned long stop;
 	void *data;
 
-	kenter("{%zx},{%lu},%lu,%lu", desc->count, page->index, offset, size);
+	_enter("{%zx},{%lu},%lu,%lu", desc->count, page->index, offset, size);
 
 	if (size > desc->count)
 		size = desc->count;
@@ -428,7 +428,7 @@
 	read_descriptor_t desc;
 	loff_t ppos;
 
-	kenter("{%hx-%hx},,", super->ujnl_head, super->ujnl_tail);
+	_enter("{%hx-%hx},,", super->ujnl_head, super->ujnl_tail);
 
 	if (super->ujnl_head < super->ujnl_tail) {
 		memset(&desc, 0, sizeof(desc));
@@ -483,7 +483,9 @@
 	loff_t ppos;
 	int loop, ret;
 
-	kenter("");
+	_enter("");
+
+	printk("CacheFS: Replaying the update journal...\n");
 
 	set_bit(CACHEFS_SUPER_REPLAYING_UJNL, &super->flags);
 
@@ -510,7 +512,7 @@
 		return find_batch.desc.error;
 	}
 
-	kdebug("UJNL: last batch=%d { s=%u #=%u f=%u b=%u a=%u }",
+	_debug("UJNL: last batch=%d { s=%u #=%u f=%u b=%u a=%u }",
 	       super->ujnl_batch,
 	       super->ujnl_serial,
 	       find_batch.batch_count,
@@ -572,7 +574,7 @@
 		}
 
 		/* write all blocks that are marked for writeback */
-		kdebug("write back pages touched by replay");
+		_debug("write back pages touched by replay");
 		cachefs_trans_batch_write(super);
 		super->ujnl_head	= super->ujnl_tail;
 
@@ -585,15 +587,15 @@
 
 	clear_bit(CACHEFS_SUPER_REPLAYING_UJNL, &super->flags);
 
-	kdebug("reload_tracking");
+	_debug("reload_tracking");
 	super->ujnl_batch++;
 	super->ujnl_serial	= 0;
 
-	kdebug("UJNL slot window: next head=%hu tail=%hu",
+	_debug("UJNL slot window: next head=%hu tail=%hu",
 	       super->ujnl_head, super->ujnl_tail);
-	kdebug("UJNL Alloc stacks: A=%x[%u] R=%x",
+	_debug("UJNL Alloc stacks: A=%x[%u] R=%x",
 	       super->alloc_cur, super->alloc_leaf, super->recycle_cur);
-	kdebug("UJNL Recycling: %x.%u: %x:%u-%u",
+	_debug("UJNL Recycling: %x.%u: %x:%u-%u",
 	       super->rcm_ino, super->rcm_indirect, super->rcm_block,
 	       super->rcm_ptrnext, super->rcm_ptrstop);
 
@@ -660,7 +662,7 @@
 	}

-	kleave(" = 0");
+	_leave(" = 0");
 	return 0;
 } /* end cachefs_ujnl_replay() */
 
@@ -674,7 +676,7 @@
 {
 	int ix = trans->eff_active;
 
-	kenter("{efa=%d},{b=%x},%s", ix, block->bix, what);
+	_enter("{efa=%d},{b=%x},%s", ix, block->bix, what);
 
 	get_page(block->page);
 
@@ -782,7 +784,7 @@
 	struct page *page;
 	int ret;
 
-	kenter(",{%hd.%hu}", jentry->batch, jentry->serial);
+	_enter(",{%hd.%hu}", jentry->batch, jentry->serial);
 
 	/* we need to copy the pointers cached in the journal entry into the
 	 * recycling block */
@@ -822,7 +824,7 @@
 	cachefs_put_page(page);
 
  error:
-	kleave(" = %d", ret);
+	_leave(" = %d", ret);
 	return ret;
 } /* end cachefs_replay_ujnl_recyc_scavenge() */
 
@@ -918,7 +920,7 @@
 	uint32_t type;
 	int ret;
 
-	kenter(",{%hd.%hu}", jentry->batch, jentry->serial);
+	_enter(",{%hd.%hu}", jentry->batch, jentry->serial);
 
 	jindex = &jentry->ixdata[0];
 
@@ -1033,7 +1035,7 @@
 	cachefs_block_put(metameta);
 	cachefs_put_page(metapage);
  error:
-	kleave(" = %d", ret);
+	_leave(" = %d", ret);
 	return ret;
 } /* end cachefs_replay_ujnl_inode_creating() */
 
@@ -1045,7 +1047,7 @@
 					      struct cachefs_ondisc_update_journal *jentry,
 					      struct cachefs_transaction *trans)
 {
-	kenter(",{%hd.%hu}", jentry->batch, jentry->serial);
+	_enter(",{%hd.%hu}", jentry->batch, jentry->serial);
 
 	/* we don't do this yet */
 	return -EINVAL;
@@ -1067,7 +1069,7 @@
 	struct page *metapage, *inompage, *ixmpage = NULL, *ixdatapage = NULL;
 	int ret;
 
-	kenter(",{%hd.%hu}", jentry->batch, jentry->serial);
+	_enter(",{%hd.%hu}", jentry->batch, jentry->serial);
 
 	jindex = &jentry->ixdata[0];
 
@@ -1173,7 +1175,7 @@
 	cachefs_block_put(metameta);
 	cachefs_put_page(metapage);
  error:
-	kleave(" = %d", ret);
+	_leave(" = %d", ret);
 	return ret;
 } /* end cachefs_replay_ujnl_inode_deleting() */
 
@@ -1192,7 +1194,7 @@
 	struct page *inompage, *ixdatapage;
 	int ret;
 
-	kenter(",{%hd.%hu}", jentry->batch, jentry->serial);
+	_enter(",{%hd.%hu}", jentry->batch, jentry->serial);
 
 	jindex = &jentry->ixdata[0];
 
@@ -1236,7 +1238,7 @@
 	cachefs_block_put(inometa);
 	cachefs_put_page(inompage);
  error:
-	kleave(" = %d", ret);
+	_leave(" = %d", ret);
 	return ret;
 } /* end cachefs_replay_ujnl_inode_mark_reclaim() */
 
@@ -1248,7 +1250,7 @@
 						struct cachefs_ondisc_update_journal *jentry,
 						struct cachefs_transaction *trans)
 {
-	kenter(",{%hd.%hu}", jentry->batch, jentry->serial);
+	_enter(",{%hd.%hu}", jentry->batch, jentry->serial);
 
 	/* nothing needs to be done here - it's all handled implicitly by the
 	 * caller */
@@ -1271,7 +1273,7 @@
 	struct page *metapage, *ptrpage, *datapage;
 	int ret;
 
-	kenter(",{%hd.%hu}", jentry->batch, jentry->serial);
+	_enter(",{%hd.%hu}", jentry->batch, jentry->serial);
 
 	ret = cachefs_block_read(super, NULL, jentry->auxblock, 0,
 				 &indexmeta, &metapage);
@@ -1345,7 +1347,7 @@
 	cachefs_block_put(indexmeta);
 	cachefs_put_page(metapage);
  error:
-	kleave(" = %d", ret);
+	_leave(" = %d", ret);
 	return ret;
 } /* end cachefs_replay_ujnl_index_extending() */
 
@@ -1363,7 +1365,7 @@
 	struct page *ixdatapage;
 	int ret;
 
-	kenter(",{%hd.%hu}", jentry->batch, jentry->serial);
+	_enter(",{%hd.%hu}", jentry->batch, jentry->serial);
 
 	jindex = &jentry->ixdata[0];
 
@@ -1387,7 +1389,7 @@
 	cachefs_block_put(indexdata);
 	cachefs_put_page(ixdatapage);
  error:
-	kleave(" = %d", ret);
+	_leave(" = %d", ret);
 	return ret;
 } /* end cachefs_replay_ujnl_index_modifying() */
 
@@ -1406,7 +1408,7 @@
 	struct page *metapage, *ptrpage, *vjpage;
 	int ret;
 
-	kenter(",{%hd.%hu}", jentry->batch, jentry->serial);
+	_enter(",{%hd.%hu}", jentry->batch, jentry->serial);
 
 	ret = cachefs_block_read(super, NULL, jentry->auxblock, 0,
 				 &metablock, &metapage);
@@ -1473,7 +1475,7 @@
 	cachefs_block_put(metablock);
 	cachefs_put_page(metapage);
  error:
-	kleave(" = %d", ret);
+	_leave(" = %d", ret);
 	return ret;
 } /* end cachefs_replay_ujnl_data_allocing() */
 
@@ -1491,7 +1493,7 @@
 	struct page *vjpage;
 	int ret;
 
-	kenter(",{%hd.%hu}", jentry->batch, jentry->serial);
+	_enter(",{%hd.%hu}", jentry->batch, jentry->serial);
 
 	vjbix = super->layout->bix_vjournal;
 	vjbix += (jentry->auxmark / CACHEFS_ONDISC_VJNL_ENTPERPAGE) *
@@ -1519,7 +1521,7 @@
 	cachefs_block_put(vjblock);
 	cachefs_put_page(vjpage);
  error:
-	kleave(" = %d", ret);
+	_leave(" = %d", ret);
 	return ret;
 } /* end cachefs_replay_ujnl_data_written() */
 
@@ -1540,7 +1542,7 @@
 	struct page *deadpage = NULL, *rcypage = NULL;
 	int ret;
 
-	kenter(",{%hd.%hu}", jentry->batch, jentry->serial);
+	_enter(",{%hd.%hu}", jentry->batch, jentry->serial);
 
 	ret = cachefs_block_read(super, NULL, jentry->upblock, 0,
 				 &ptrblock, &ptrpage);
@@ -1631,7 +1633,7 @@
 	cachefs_block_put(ptrblock);
 	cachefs_put_page(ptrpage);
  error:
-	kleave(" = %d", ret);
+	_leave(" = %d", ret);
 	return ret;
 } /* end cachefs_replay_ujnl_data_unallocing() */
 
@@ -1649,7 +1651,7 @@
 	void *content;
 	int ret;
 
-	kenter(",{%hd.%hu}", jentry->batch, jentry->serial);
+	_enter(",{%hd.%hu}", jentry->batch, jentry->serial);
 
 	ret = cachefs_block_read(super, NULL, jentry->upblock, 0,
 				 &ptrblock, &ptrpage);
@@ -1686,6 +1688,6 @@
 	cachefs_block_put(ptrblock);
 	cachefs_put_page(ptrpage);
  error:
-	kleave(" = %d", ret);
+	_leave(" = %d", ret);
 	return ret;
 } /* end cachefs_replay_ujnl_indirect_allocing() */

Index: recycling.c
===================================================================
RCS file: /home/cvs/afs/fs/cachefs/recycling.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- recycling.c	19 Aug 2003 13:37:07 -0000	1.31
+++ recycling.c	15 Sep 2003 13:53:25 -0000	1.32
@@ -906,7 +906,7 @@
 	struct page *rcypage = NULL, *uppage = NULL;
 	int ret;
 
-	kenter("");
+	_enter("");
 
 	BUG_ON(list_empty(&super->vjnl_unallocq));
 
@@ -1022,7 +1022,7 @@
 	cachefs_put_page(rcypage);
 	cachefs_block_put(upblock);
 	cachefs_block_put(rcyblock);
-	kleave("");
+	_leave("");
 	return;
 
  error_free:
@@ -1032,6 +1032,6 @@
 	cachefs_block_put(rcyblock);
 	cachefs_trans_put(trans);
  error:
-	kleave(" [error %d]", ret);
+	_leave(" [error %d]", ret);
 
 } /* end cachefs_recycle_unallocate_data_block() */

Index: journal.c
===================================================================
RCS file: /home/cvs/afs/fs/cachefs/journal.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- journal.c	12 Sep 2003 09:52:38 -0000	1.43
+++ journal.c	15 Sep 2003 13:53:25 -0000	1.44
@@ -295,9 +295,11 @@
 		if (!effect->block)
 			continue;
 
-		_debug("transaction affects block %u { pg=%p }",
+		_debug("transaction affects block %x { pg=%p }",
 		       effect->block->bix,
 		       effect->block->page);
+
+		BUG_ON(!effect->block->page);
 
 #ifndef CACHEFS_BLOCK_USE_COW
 		/* wait for the page to be written back */

Index: cachefs-int.h
===================================================================
RCS file: /home/cvs/afs/fs/cachefs/cachefs-int.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- cachefs-int.h	19 Aug 2003 13:37:07 -0000	1.42
+++ cachefs-int.h	15 Sep 2003 13:53:25 -0000	1.43
@@ -479,6 +479,7 @@
 extern void cachefs_vj_cancel(struct cachefs_vj_entry *vjentry);
 extern void cachefs_vj_write_complete(struct cachefs_block *block);
 extern void cachefs_vj_note_write_completion(struct cachefs_super *super);
+extern int cachefs_vj_replay(struct cachefs_super *super);

 /*****************************************************************************/

Index: block.c
===================================================================
RCS file: /home/cvs/afs/fs/cachefs/block.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- block.c	12 Sep 2003 09:52:38 -0000	1.10
+++ block.c	15 Sep 2003 13:53:25 -0000	1.11
@@ -415,6 +415,8 @@
 		cachefs_put_page(xchg(_page, page));
 	}
 
+	BUG_ON(!*_page);
+
 	_leave("");
 } /* end cachefs_block_modify() */

Index: aops.c
===================================================================
RCS file: /home/cvs/afs/fs/cachefs/aops.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- aops.c	12 Sep 2003 14:45:11 -0000	1.48
+++ aops.c	15 Sep 2003 13:53:25 -0000	1.49
@@ -1241,7 +1241,7 @@
 	int pix, ret;
 
 	_enter("%lu,{%p}%lu,,%d",
-	       inode->vfs_inode. i_ino, page, page->index, create);
+	       inode->vfs_inode.i_ino, page, page->index, create);
 
 	BUG_ON(pageio->mapped_block);