Many files:
  jfs_e2fsck.h, jfs_user.h: Replaces jfs_compat.h.  The jfs.h file has
  	been moved to the include/linux directory.
  journal.c, revoke.c, recovery.c: Updated files from Stephen to support
  	the V2 superblock and revoke processing.  The journal.c and revoke.c
  	files are copies from the ext3 kernel source.
  Makefile.in: Added revoke.c to the list of source/object files.
Makefile.in:
  Fix up some mistakes in the source file list, and regenerate the
  dependencies.
  Update Makefile dependencies.
ChangeLog, jfs.h:
  jfs.h: Remove excess #include of JFS_DEBUG.  Not needed for e2fsprogs,
  	since we optioanlly define it in the configuration file system.

diff --git a/debugfs/Makefile.in b/debugfs/Makefile.in
index 7ecc55d..dc38044 100644
--- a/debugfs/Makefile.in
+++ b/debugfs/Makefile.in
@@ -78,30 +78,36 @@
  $(top_builddir)/lib/ss/ss_err.h
 debugfs.o: $(srcdir)/debugfs.c $(top_srcdir)/lib/et/com_err.h \
  $(top_srcdir)/lib/ss/ss.h $(top_builddir)/lib/ss/ss_err.h \
- $(srcdir)/debugfs.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
- $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
- $(top_srcdir)/lib/ext2fs/bitops.h $(top_srcdir)/lib/uuid/uuid.h \
- $(top_srcdir)/lib/e2p/e2p.h $(srcdir)/../version.h
+ $(srcdir)/debugfs.h $(top_srcdir)/include/linux/ext2_fs.h \
+ $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h \
+ $(top_srcdir)/lib/uuid/uuid.h $(top_srcdir)/lib/e2p/e2p.h \
+ $(top_srcdir)/version.h
 util.o: $(srcdir)/util.c $(srcdir)/debugfs.h \
- $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
- $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
- $(top_srcdir)/lib/ext2fs/bitops.h
-ls.o: $(srcdir)/ls.c $(srcdir)/debugfs.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
+ $(top_srcdir)/include/linux/ext2_fs.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
+ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h
+ls.o: $(srcdir)/ls.c $(srcdir)/debugfs.h \
+ $(top_srcdir)/include/linux/ext2_fs.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
  $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
  $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h
 ncheck.o: $(srcdir)/ncheck.c $(srcdir)/debugfs.h \
- $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
- $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
- $(top_srcdir)/lib/ext2fs/bitops.h
+ $(top_srcdir)/include/linux/ext2_fs.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
+ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h
 icheck.o: $(srcdir)/icheck.c $(srcdir)/debugfs.h \
- $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
- $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
- $(top_srcdir)/lib/ext2fs/bitops.h
+ $(top_srcdir)/include/linux/ext2_fs.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
+ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h
 lsdel.o: $(srcdir)/lsdel.c $(srcdir)/debugfs.h \
- $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
- $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
- $(top_srcdir)/lib/ext2fs/bitops.h
+ $(top_srcdir)/include/linux/ext2_fs.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
+ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h
 dump.o: $(srcdir)/dump.c $(srcdir)/debugfs.h \
- $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
- $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
- $(top_srcdir)/lib/ext2fs/bitops.h
+ $(top_srcdir)/include/linux/ext2_fs.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
+ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h
+setsuper.o: $(srcdir)/setsuper.c $(srcdir)/debugfs.h \
+ $(top_srcdir)/include/linux/ext2_fs.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
+ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h
diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog
index 5b2b557..55e94a8 100644
--- a/e2fsck/ChangeLog
+++ b/e2fsck/ChangeLog
@@ -1,3 +1,15 @@
+2000-12-09    <tytso@snap.thunk.org>
+
+	* jfs_e2fsck.h, jfs_user.h: Replaces jfs_compat.h.  The jfs.h file
+		has been moved to the include/linux directory.
+
+	* journal.c, revoke.c, recovery.c: Updated files from Stephen to
+		support the V2 superblock and revoke processing.  The
+		journal.c and revoke.c files are copies from the ext3
+		kernel source.
+
+	* Makefile.in: Added revoke.c to the list of source/object files.
+
 2000-11-16  Theodore Ts'o  <tytso@valinux.com>
 
 	* pass1b.c: Change routines to use PR_1B_BLOCK_ITERATE when
diff --git a/e2fsck/Makefile.in b/e2fsck/Makefile.in
index df399f3..8f8b49b 100644
--- a/e2fsck/Makefile.in
+++ b/e2fsck/Makefile.in
@@ -56,14 +56,15 @@
 
 OBJS= unix.o e2fsck.o super.o pass1.o pass1b.o pass2.o pass3.o pass4.o \
 	pass5.o journal.o swapfs.o badblocks.o util.o dirinfo.o ehandler.o \
-	problem.o message.o recovery.o $(MTRACE_OBJ)
+	problem.o message.o recovery.o revoke.o $(MTRACE_OBJ)
 
 PROFILED_OBJS= profiled/unix.o profiled/e2fsck.o profiled/super.o \
 	profiled/pass1.o profiled/pass1b.o \
 	profiled/pass2.o profiled/pass3.o profiled/pass4.o profiled/pass5.o \
 	profiled/journal.o profiled/badblocks.o profiled/util.o \
 	profiled/dirinfo.o profiled/ehandler.o profiled/message.o \
-	profiled/problem.o profiled/swapfs.o profiled/recovery.o
+	profiled/problem.o profiled/swapfs.o profiled/recovery.o \
+	profiled/revoke.o
 
 SRCS= $(srcdir)/e2fsck.c \
 	$(srcdir)/super.c \
@@ -75,6 +76,7 @@
 	$(srcdir)/pass5.c \
 	$(srcdir)/journal.c \
 	$(srcdir)/recovery.c \
+	$(srcdir)/revoke.c \
 	$(srcdir)/badblocks.c \
 	$(srcdir)/util.c \
 	$(srcdir)/unix.c \
@@ -198,17 +200,25 @@
  $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
  $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h \
  $(srcdir)/problem.h
-journal.o: $(srcdir)/journal.c $(srcdir)/jfs.h $(srcdir)/jfs_compat.h \
- $(srcdir)/e2fsck.h $(top_srcdir)/include/linux/ext2_fs.h \
- $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
- $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
- $(top_srcdir)/lib/ext2fs/bitops.h $(srcdir)/problem.h \
- $(top_srcdir)/lib/uuid/uuid.h
-recovery.o: $(srcdir)/recovery.c $(srcdir)/jfs.h $(srcdir)/jfs_compat.h \
- $(srcdir)/e2fsck.h $(top_srcdir)/include/linux/ext2_fs.h \
- $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
- $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
- $(top_srcdir)/lib/ext2fs/bitops.h
+journal.o: $(srcdir)/journal.c $(srcdir)/jfs_user.h $(srcdir)/e2fsck.h \
+ $(top_srcdir)/include/linux/ext2_fs.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
+ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h \
+ $(srcdir)/jfs_e2fsck.h $(top_srcdir)/include/linux/jfs.h \
+ $(top_srcdir)/include/linux/jfs_compat.h $(top_srcdir)/include/linux/list.h \
+ $(srcdir)/problem.h $(top_srcdir)/lib/uuid/uuid.h
+recovery.o: $(srcdir)/recovery.c $(srcdir)/jfs_user.h $(srcdir)/e2fsck.h \
+ $(top_srcdir)/include/linux/ext2_fs.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
+ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h \
+ $(srcdir)/jfs_e2fsck.h $(top_srcdir)/include/linux/jfs.h \
+ $(top_srcdir)/include/linux/jfs_compat.h $(top_srcdir)/include/linux/list.h
+revoke.o: $(srcdir)/revoke.c $(srcdir)/jfs_user.h $(srcdir)/e2fsck.h \
+ $(top_srcdir)/include/linux/ext2_fs.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
+ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h \
+ $(srcdir)/jfs_e2fsck.h $(top_srcdir)/include/linux/jfs.h \
+ $(top_srcdir)/include/linux/jfs_compat.h $(top_srcdir)/include/linux/list.h
 badblocks.o: $(srcdir)/badblocks.c $(top_srcdir)/lib/et/com_err.h \
  $(srcdir)/e2fsck.h $(top_srcdir)/include/linux/ext2_fs.h \
  $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
@@ -220,7 +230,8 @@
 unix.o: $(srcdir)/unix.c $(top_srcdir)/lib/et/com_err.h $(srcdir)/e2fsck.h \
  $(top_srcdir)/include/linux/ext2_fs.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
  $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
- $(top_srcdir)/lib/ext2fs/bitops.h $(srcdir)/problem.h $(srcdir)/../version.h
+ $(top_srcdir)/lib/ext2fs/bitops.h $(srcdir)/problem.h \
+ $(top_srcdir)/version.h
 dirinfo.o: $(srcdir)/dirinfo.c $(srcdir)/e2fsck.h \
  $(top_srcdir)/include/linux/ext2_fs.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
  $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
diff --git a/e2fsck/jfs_e2fsck.h b/e2fsck/jfs_e2fsck.h
new file mode 100644
index 0000000..608135d
--- /dev/null
+++ b/e2fsck/jfs_e2fsck.h
@@ -0,0 +1,56 @@
+#ifndef _JFS_E2FSCK_H
+#define _JFS_E2FSCK_H
+
+struct buffer_head {
+	char	 b_data[8192];
+	e2fsck_t b_ctx;
+	io_channel b_io;
+	int	 b_size;
+	blk_t	 b_blocknr;
+	int	 b_dirty;
+	int	 b_uptodate;
+	int	 b_err;
+};
+
+struct inode {
+	e2fsck_t i_ctx;
+	ino_t	 i_ino;
+	struct ext2_inode i_ext2;
+};
+
+typedef e2fsck_t kdev_t;
+
+int bmap(struct inode *inode, int block);
+struct buffer_head *getblk(e2fsck_t ctx, blk_t blocknr, int blocksize);
+void ll_rw_block(int rw, int dummy, struct buffer_head *bh[]);
+void mark_buffer_dirty(struct buffer_head *bh, int dummy);
+void brelse(struct buffer_head *bh);
+int buffer_uptodate(struct buffer_head *bh);
+void wait_on_buffer(struct buffer_head *bh);
+#define fsync_dev(dev) do {} while(0)
+#define buffer_req(bh) 1
+#define do_readahead(journal, start) do {} while(0)
+	
+extern e2fsck_t e2fsck_global_ctx;  /* Try your very best not to use this! */
+
+typedef struct {
+	int	object_length;
+} kmem_cache_t;
+
+#define kmem_cache_alloc(cache,flags) malloc((cache)->object_length)
+#define kmem_cache_free(cache,obj) free(obj)
+#define kmem_cache_create(name,len,a,b,c,d) do_cache_create(len)
+#define kmalloc(len,flags) malloc(len)
+#define kfree(p) free(p)
+
+static inline kmem_cache_t * do_cache_create(int len)
+{
+	kmem_cache_t *new_cache;
+	new_cache = malloc(sizeof(*new_cache));
+	if (new_cache)
+		new_cache->object_length = len;
+	return new_cache;
+}
+
+#endif /* _JFS_E2FSCK_H */
+
diff --git a/e2fsck/jfs_user.h b/e2fsck/jfs_user.h
new file mode 100644
index 0000000..6fd16de
--- /dev/null
+++ b/e2fsck/jfs_user.h
@@ -0,0 +1,3 @@
+#include "e2fsck.h"
+#include "jfs_e2fsck.h"
+#include <linux/jfs.h>
diff --git a/e2fsck/journal.c b/e2fsck/journal.c
index 9ff204c..fd9ed49 100644
--- a/e2fsck/journal.c
+++ b/e2fsck/journal.c
@@ -20,13 +20,13 @@
 #include <sys/stat.h>
 #endif
 
-#include "jfs.h"
+#include "jfs_user.h"
 #include "problem.h"
 #include "uuid/uuid.h"
 
 #ifdef JFS_DEBUG
 static int bh_count = 0;
-int journal_enable_debug = 2;
+int journal_enable_debug = 0;
 #endif
 
 int bmap(struct inode *inode, int block)
@@ -63,36 +63,47 @@
 	return bh;
 }
 
-void ll_rw_block(int rw, int dummy, struct buffer_head *bh)
+void ll_rw_block(int rw, int nr, struct buffer_head *bhp[])
 {
 	int retval;
+	struct buffer_head *bh;
 
-	if (rw == READ && !bh->b_uptodate) {
-		jfs_debug(3, "reading block %lu/%p\n", bh->b_blocknr, bh);
-		retval = io_channel_read_blk(bh->b_ctx->fs->io, bh->b_blocknr,
-					     1, bh->b_data);
-		if (retval) {
-			com_err(bh->b_ctx->device_name, retval,
-				"while reading block %ld\n", bh->b_blocknr);
-			bh->b_err = retval;
-			return;
-		}
-		bh->b_uptodate = 1;
-	} else if (rw == WRITE && bh->b_dirty) {
-		jfs_debug(3, "writing block %lu/%p\n", bh->b_blocknr, bh);
-		retval = io_channel_write_blk(bh->b_ctx->fs->io, bh->b_blocknr,
-					      1, bh->b_data);
-		if (retval) {
-			com_err(bh->b_ctx->device_name, retval,
-				"while writing block %ld\n", bh->b_blocknr);
-			bh->b_err = retval;
-			return;
-		}
-		bh->b_dirty = 0;
-		bh->b_uptodate = 1;
-	} else
-		jfs_debug(3, "no-op %s for block %lu\n",
-			  rw == READ ? "read" : "write", bh->b_blocknr);
+	for (; nr > 0; --nr) {
+		bh = *bhp++;
+		if (rw == READ && !bh->b_uptodate) {
+			jfs_debug(3, "reading block %lu/%p\n", 
+				  bh->b_blocknr, bh);
+			retval = io_channel_read_blk(bh->b_ctx->fs->io, 
+						     bh->b_blocknr,
+						     1, bh->b_data);
+			if (retval) {
+				com_err(bh->b_ctx->device_name, retval,
+					"while reading block %ld\n", 
+					bh->b_blocknr);
+				bh->b_err = retval;
+				continue;
+			}
+			bh->b_uptodate = 1;
+		} else if (rw == WRITE && bh->b_dirty) {
+			jfs_debug(3, "writing block %lu/%p\n", 
+				  bh->b_blocknr, bh);
+			retval = io_channel_write_blk(bh->b_ctx->fs->io, 
+						      bh->b_blocknr,
+						      1, bh->b_data);
+			if (retval) {
+				com_err(bh->b_ctx->device_name, retval,
+					"while writing block %ld\n", 
+					bh->b_blocknr);
+				bh->b_err = retval;
+				continue;
+			}
+			bh->b_dirty = 0;
+			bh->b_uptodate = 1;
+		} else
+			jfs_debug(3, "no-op %s for block %lu\n",
+				  rw == READ ? "read" : "write", 
+				  bh->b_blocknr);
+	}
 }
 
 void mark_buffer_dirty(struct buffer_head *bh, int dummy)
@@ -103,7 +114,7 @@
 void brelse(struct buffer_head *bh)
 {
 	if (bh->b_dirty)
-		ll_rw_block(WRITE, 1, bh);
+		ll_rw_block(WRITE, 1, &bh);
 	jfs_debug(3, "freeing block %lu/%p (total %d)\n",
 		  bh->b_blocknr, bh, --bh_count);
 	ext2fs_free_mem((void **) &bh);
@@ -117,7 +128,7 @@
 void wait_on_buffer(struct buffer_head *bh)
 {
 	if (!bh->b_uptodate)
-		ll_rw_block(READ, 1, bh);
+		ll_rw_block(READ, 1, &bh);
 }
 
 
@@ -306,7 +317,7 @@
 
 	clear_problem_context(&pctx);
 
-	ll_rw_block(READ, 1, jbh);
+	ll_rw_block(READ, 1, &jbh);
 	if (jbh->b_err) {
 		com_err(ctx->device_name, jbh->b_err,
 			_("reading journal superblock\n"));
@@ -318,23 +329,55 @@
 	if (jsb->s_header.h_magic != htonl(JFS_MAGIC_NUMBER))
 		return e2fsck_journal_fix_bad_inode(ctx, &pctx);
 
-	if (jsb->s_header.h_blocktype != htonl(JFS_SUPERBLOCK_V1) ||
-	    jsb->s_blocksize != htonl(journal->j_blocksize)) {
-		com_err(ctx->device_name, EXT2_ET_CORRUPT_SUPERBLOCK,
-			_("%s: no valid journal superblock found\n"));
-		return EXT2_ET_CORRUPT_SUPERBLOCK;
+	switch (ntohl(jsb->s_header.h_blocktype)) {
+	case JFS_SUPERBLOCK_V1:
+		journal->j_format_version = 1;
+		break;
+		
+	case JFS_SUPERBLOCK_V2:
+		journal->j_format_version = 2;
+		break;
+		
+	/* If we don't understand the superblock major type, but there
+	 * is a magic number, then it is likely to be a new format we
+	 * just don't understand, so leave it alone. */
+	default:
+		com_err(ctx->program_name, EXT2_ET_UNSUPP_FEATURE,
+			_("%s: journal has unrecognised format\n"),
+			ctx->device_name);
+		return EXT2_ET_UNSUPP_FEATURE;
 	}
 
-	if (jsb->s_header.h_blocktype != htonl(JFS_SUPERBLOCK_V1)) {
-		pctx.num = ntohl(jsb->s_header.h_blocktype);
-		return e2fsck_journal_fix_unsupported_super(ctx, &pctx);
+	if (JFS_HAS_INCOMPAT_FEATURE(journal, ~JFS_KNOWN_INCOMPAT_FEATURES)) {
+		com_err(ctx->program_name, EXT2_ET_UNSUPP_FEATURE,
+			_("%s: journal has incompatible features\n"),
+			ctx->device_name);
+		return EXT2_ET_UNSUPP_FEATURE;
+	}
+		
+	if (JFS_HAS_RO_COMPAT_FEATURE(journal, ~JFS_KNOWN_ROCOMPAT_FEATURES)) {
+		com_err(ctx->program_name, EXT2_ET_UNSUPP_FEATURE,
+			_("%s: journal has readonly-incompatible features\n"),
+			ctx->device_name);
+		return EXT2_ET_RO_UNSUPP_FEATURE;
+	}
+
+	/* We have now checked whether we know enough about the journal
+	 * format to be able to proceed safely, so any other checks that
+	 * fail we should attempt to recover from. */
+	if (jsb->s_blocksize != htonl(journal->j_blocksize)) {
+		com_err(ctx->program_name, EXT2_ET_CORRUPT_SUPERBLOCK,
+			_("%s: no valid journal superblock found\n"),
+			ctx->device_name);
+		return EXT2_ET_CORRUPT_SUPERBLOCK;
 	}
 
 	if (ntohl(jsb->s_maxlen) < journal->j_maxlen)
 		journal->j_maxlen = ntohl(jsb->s_maxlen);
 	else if (ntohl(jsb->s_maxlen) > journal->j_maxlen) {
-		com_err(ctx->device_name, EXT2_ET_CORRUPT_SUPERBLOCK,
-			_("%s: journal too short\n"));
+		com_err(ctx->program_name, EXT2_ET_CORRUPT_SUPERBLOCK,
+			_("%s: journal too short\n"),
+			ctx->device_name);
 		return EXT2_ET_CORRUPT_SUPERBLOCK;
 	}
 
@@ -348,14 +391,35 @@
 }
 
 void e2fsck_journal_reset_super(e2fsck_t ctx, journal_superblock_t *jsb,
-				     blk_t size)
+				journal_t *journal)
 {
-	jsb->s_header.h_magic = htonl(JFS_MAGIC_NUMBER);
-	jsb->s_header.h_blocktype = htonl(JFS_SUPERBLOCK_V1);
+	char *p;
+	
+	/* Leave a valid existing V1 superblock signature alone.
+	 * Anything unrecognisable we overwrite with a new V2
+	 * signature. */
+	
+	if (jsb->s_header.h_magic != htonl(JFS_MAGIC_NUMBER) ||
+	    jsb->s_header.h_blocktype != htonl(JFS_SUPERBLOCK_V1)) {
+		jsb->s_header.h_magic = htonl(JFS_MAGIC_NUMBER);
+		jsb->s_header.h_blocktype = htonl(JFS_SUPERBLOCK_V2);
+	}
+
+	/* Zero out everything else beyond the superblock header */
+	
+	p = ((char *) jsb) + sizeof(journal_header_t);
+	memset (p, 0, ctx->fs->blocksize-sizeof(journal_header_t));
+
 	jsb->s_blocksize = htonl(ctx->fs->blocksize);
-	jsb->s_maxlen = htonl(size);
-	jsb->s_first = 1;
+	jsb->s_maxlen = htonl(journal->j_maxlen);
+	jsb->s_first = htonl(1);
 	jsb->s_sequence = htonl(1);
+
+	/* In theory we should also re-zero the entire journal here.
+	 * Initialising s_sequence to a random value would be a
+	 * reasonable compromise. */
+
+	ll_rw_block(WRITE, 1, &journal->j_sb_buffer);
 }
 
 static int e2fsck_journal_fix_corrupt_super(e2fsck_t ctx, journal_t *journal,
@@ -370,7 +434,7 @@
 		if (fix_problem(ctx, PR_0_JOURNAL_BAD_SUPER, pctx)) {
 			journal_superblock_t *jsb = journal->j_superblock;
 
-			e2fsck_journal_reset_super(ctx, jsb, journal->j_maxlen);
+			e2fsck_journal_reset_super(ctx, jsb, journal);
 
 			journal->j_transaction_sequence = 1;
 			e2fsck_clear_recover(ctx, recover);
@@ -411,9 +475,7 @@
 	int retval;
 
 	/* If we don't have any journal features, don't do anything more */
-	if (!(s->s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) &&
-	    !recover && s->s_journal_inum == 0 && s->s_journal_dev == 0 &&
-	    uuid_is_null(s->s_journal_uuid))
+	if (!(s->s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL))
 		return 0;
 
 	clear_problem_context(&pctx);
@@ -481,6 +543,10 @@
 	if (retval)
 		return retval;
 
+	retval = journal_init_revoke(journal, 1024);
+	if (retval)
+		return retval;
+	
 	retval = -journal_recover(journal);
 	e2fsck_journal_release(ctx, journal, 1);
 	return retval;
diff --git a/e2fsck/recovery.c b/e2fsck/recovery.c
index 06e1246..12af13d 100644
--- a/e2fsck/recovery.c
+++ b/e2fsck/recovery.c
@@ -3,7 +3,7 @@
  * 
  * Written by Stephen C. Tweedie <sct@redhat.com>, 1999
  *
- * Copyright 1999 Red Hat Software --- All Rights Reserved
+ * Copyright 1999-2000 Red Hat Software --- All Rights Reserved
  *
  * This file is part of the Linux kernel and is made available under
  * the terms of the GNU General Public License, version 2, or at your
@@ -14,7 +14,7 @@
  */
 
 #ifndef __KERNEL__
-#include "jfs.h"
+#include "jfs_user.h"
 #else
 #include <linux/sched.h>
 #include <linux/fs.h>
@@ -23,7 +23,27 @@
 #include <linux/malloc.h>
 #include <linux/locks.h>
 #include <linux/buffer.h>
+#endif
 
+/*
+ * Maintain information about the progress of the recovery job, so that
+ * the different passes can carry information between them. 
+ */
+struct recovery_info 
+{
+	tid_t		start_transaction;	
+	tid_t		end_transaction;
+	
+	int		nr_replays;
+	int		nr_revokes;
+	int		nr_revoke_hits;
+};
+
+enum passtype {PASS_SCAN, PASS_REVOKE, PASS_REPLAY};
+static int do_one_pass(journal_t *, struct recovery_info *, enum passtype);
+static int scan_revoke_records(journal_t *, struct buffer_head *, tid_t, struct recovery_info *);
+
+#ifdef __KERNEL__
 
 /* Release readahead buffers after use */
 static void brelse_array(struct buffer_head *b[], int n)
@@ -77,7 +97,6 @@
 		
 		bh = getblk(journal->j_dev, blocknr, journal->j_blocksize);
 		if (!bh) {
-			printk(KERN_ERR "JFS: readahead getblk failed\n");
 			err = -ENOMEM;
 			goto failed;
 		}
@@ -102,7 +121,9 @@
 		brelse_array(bufs, nbufs);
 	return err;
 }
-#endif
+
+#endif /* __KERNEL__ */
+
 
 /*
  * Read a block from the journal
@@ -116,8 +137,7 @@
 
 	*bhp = NULL;
 
-	if (offset >= journal->j_maxlen)
-		return -EINVAL;
+	J_ASSERT (offset < journal->j_maxlen);
 			
 	blocknr = offset;
 	if (journal->j_inode)
@@ -193,18 +213,70 @@
  *
  * The primary function for recovering the log contents when mounting a
  * journaled device.  
+ * 
+ * Recovery is done in three passes.  In the first pass, we look for the
+ * end of the log.  In the second, we assemble the list of revoke
+ * blocks.  In the third and final pass, we replay any un-revoked blocks
+ * in the log.  
  */
 
 int journal_recover(journal_t *journal)
 {
+	int			err;
+	journal_superblock_t *	sb;
+
+	struct recovery_info	info = {};
+	
+	sb = journal->j_superblock;
+
+	/* 
+	 * The journal superblock's s_start field (the current log head)
+	 * is always zero if, and only if, the journal was cleanly
+	 * unmounted.  
+	 */
+
+	if (!sb->s_start) {
+		jfs_debug(1, "No recovery required, last transaction %d\n",
+			  ntohl(sb->s_sequence));
+		journal->j_transaction_sequence = ntohl(sb->s_sequence) + 1;
+		return 0;
+	}
+	
+
+	err = do_one_pass(journal, &info, PASS_SCAN);
+	if (!err)
+		err = do_one_pass(journal, &info, PASS_REVOKE);
+	if (!err)
+		err = do_one_pass(journal, &info, PASS_REPLAY);
+
+	jfs_debug(0, "JFS: recovery, exit status %d, "
+		  "recovered transactions %u to %u\n",
+		  err, info.start_transaction, info.end_transaction);
+	jfs_debug(0, "JFS: Replayed %d and revoked %d/%d blocks\n", 
+		  info.nr_replays, info.nr_revoke_hits, info.nr_revokes);
+
+	/* Restart the log at the next transaction ID, thus invalidating
+	 * any existing commit records in the log. */
+	journal->j_transaction_sequence = ++info.end_transaction;
+		
+	journal_clear_revoke(journal);
+	fsync_dev(journal->j_dev);
+	return err;
+}
+
+static int do_one_pass(journal_t *journal, struct recovery_info *info,
+		       enum passtype pass)
+{
+	
 	unsigned int		first_commit_ID, next_commit_ID;
 	unsigned long		next_log_block;
-	unsigned long		transaction_start;
 	int			err, success = 0;
-	journal_superblock_t *	jsb;
+	journal_superblock_t *	sb;
 	journal_header_t * 	tmp;
 	struct buffer_head *	bh;
-
+	unsigned int		sequence;
+	int			blocktype;
+	
 	/* Precompute the maximum metadata descriptors in a descriptor block */
 	int			MAX_BLOCKS_PER_DESC;
 	MAX_BLOCKS_PER_DESC = ((journal->j_blocksize-sizeof(journal_header_t))
@@ -216,26 +288,15 @@
 	 * block offsets): query the superblock.  
 	 */
 
-	jsb = journal->j_superblock;
-	next_commit_ID = ntohl(jsb->s_sequence);
-	next_log_block = ntohl(jsb->s_start);
+	sb = journal->j_superblock;
+	next_commit_ID = ntohl(sb->s_sequence);
+	next_log_block = ntohl(sb->s_start);
 
 	first_commit_ID = next_commit_ID;
+	if (pass == PASS_SCAN)
+		info->start_transaction = first_commit_ID;
 	
-	/* 
-	 * The journal superblock's s_start field (the current log head)
-	 * is always zero if, and only if, the journal was cleanly
-	 * unmounted.  
-	 */
-
-	if (!jsb->s_start) {
-		jfs_debug(1, "No recovery required, last transaction %d\n",
-			  ntohl(jsb->s_sequence));
-		journal->j_transaction_sequence = ++next_commit_ID;
-		return 0;
-	}
-	
-	jfs_debug(1, "Starting recovery\n");
+	jfs_debug(1, "Starting recovery pass %d\n", pass);
 	
 	/*
 	 * Now we walk through the log, transaction by transaction,
@@ -244,132 +305,118 @@
 	 * into the main filesystem. 
 	 */
 
-	while (1) { 
-		jfs_debug(2, "Looking for commit ID %u at %lu/%lu\n",
-			  next_commit_ID, next_log_block, journal->j_last);
- 		transaction_start = next_log_block;
-
-		while (next_log_block < journal->j_last) {
-			/* Skip over each chunk of the transaction
-			 * looking either the next descriptor block or
-			 * the final commit record. */
-
-			jfs_debug(3, "JFS: checking block %ld\n", 
-				  next_log_block);
-			err = jread(&bh, journal, next_log_block);
-			if (err)
-				goto failed;
-			
-			/* What kind of buffer is it? 
-			 * 
-			 * If it is a descriptor block, work out the
-			 * expected location of the next and skip to it.
-			 *
-			 * If it is the right commit block, end the
-			 * search and start recovering the transaction.
-			 *
-			 * Any non-control block, or an unexpected
-			 * control block is interpreted as old data from
-			 * a previous wrap of the log: stop recovery at
-			 * this point.  
-			 */
+	while (1) {
+		int			flags;
+		char *			tagp;
+		journal_block_tag_t *	tag;
+		struct buffer_head *	obh;
+		struct buffer_head *	nbh;
 		
-			tmp = (journal_header_t *) bh->b_data;
-			
-			if (tmp->h_magic == htonl(JFS_MAGIC_NUMBER)) {
-				int blocktype = ntohl(tmp->h_blocktype);
-				jfs_debug(3, "Found magic %d\n", blocktype);
-				
-				if (blocktype == JFS_DESCRIPTOR_BLOCK) {
-					/* Work out where the next descriptor
-					 * should be. */
-					next_log_block++;
-					next_log_block += count_tags(bh, journal->j_blocksize);
-					wrap(journal, next_log_block);
-					brelse(bh);
-					continue;
-				} else if (blocktype == JFS_COMMIT_BLOCK) {
-					unsigned int sequence = tmp->h_sequence;
-					brelse(bh);
-					if (sequence == htonl(next_commit_ID))
-						goto commit;
-					jfs_debug(2, "found sequence %d, "
-						  "expected %d.\n",
-						  ntohl(sequence),
-						  next_commit_ID);
-					goto finished;
-				}
-			}
+		/* If we already know where to stop the log traversal,
+		 * check right now that we haven't gone past the end of
+		 * the log. */
+		
+		if (pass != PASS_SCAN)
+			if (tid_geq(next_commit_ID, info->end_transaction))
+				break;
+		
+		jfs_debug(2, "Scanning for sequence ID %u at %lu/%lu\n",
+			  next_commit_ID, next_log_block, journal->j_last);
 
-			/* We didn't recognise it?  OK, we've gone off
-			 * the tail of the log in that case. */
+		/* Skip over each chunk of the transaction looking
+		 * either the next descriptor block or the final commit
+		 * record. */
+		
+		jfs_debug(3, "JFS: checking block %ld\n", next_log_block);
+		err = jread(&bh, journal, next_log_block);
+		if (err)
+			goto failed;
+		
+		next_log_block++;
+		wrap(journal, next_log_block);
+		
+		/* What kind of buffer is it? 
+		 * 
+		 * If it is a descriptor block, check that it has the
+		 * expected sequence number.  Otherwise, we're all done
+		 * here. */
+
+		tmp = (journal_header_t *) bh->b_data;
+		
+		if (tmp->h_magic != htonl(JFS_MAGIC_NUMBER)) {
 			brelse(bh);
 			break;
 		}
-
-		goto finished;
 		
-	commit:
-		jfs_debug(2, "Found transaction %d\n", next_commit_ID);
-
-		/* OK, we have a transaction to commit.  Rewind to the
-		 * start of it, gather up all of the buffers in each
-		 * transaction segment, and replay the segments one by
-		 * one. */
-
-		next_log_block = transaction_start;
+		blocktype = ntohl(tmp->h_blocktype);
+		sequence = ntohl(tmp->h_sequence);
+		jfs_debug(3, "Found magic %d, sequence %d\n", 
+			  blocktype, sequence);
 		
-		while (1) {
-			int			flags;
-			char *			tagp;
-			journal_block_tag_t *	tag;
-			struct buffer_head *	obh;
-			struct buffer_head *	nbh;
-			
-			err = jread(&bh, journal, next_log_block++);
-			wrap(journal, next_log_block);
-			if (err)
-				goto failed;
-
-			tmp = (journal_header_t *) bh->b_data;
-			/* should never happen - we just checked above - AED */
-			J_ASSERT(tmp->h_magic == htonl(JFS_MAGIC_NUMBER));
-
-			/* If it is the commit block, then we are all done! */
-			if (tmp->h_blocktype == htonl(JFS_COMMIT_BLOCK)) {
+		if (sequence != next_commit_ID) {
+			brelse(bh);
+			break;
+		}
+		
+		/* OK, we have a valid descriptor block which matches
+		 * all of the sequence number checks.  What are we going
+		 * to do with it?  That depends on the pass... */
+		
+		switch(blocktype) {
+		case JFS_DESCRIPTOR_BLOCK:
+			/* If it is a valid descriptor block, replay it
+			 * in pass REPLAY; otherwise, just skip over the
+			 * blocks it describes. */
+			if (pass != PASS_REPLAY) {
+				next_log_block += count_tags(bh, journal->j_blocksize);
+				wrap(journal, next_log_block);
 				brelse(bh);
-				break;
+				continue;
 			}
-			
+
 			/* A descriptor block: we can now write all of
 			 * the data blocks.  Yay, useful work is finally
 			 * getting done here! */
 
 			tagp = &bh->b_data[sizeof(journal_header_t)];
-			
 			while ((tagp - bh->b_data +sizeof(journal_block_tag_t))
 			       <= journal->j_blocksize) {
+				unsigned long io_block;
+				
 				tag = (journal_block_tag_t *) tagp;
 				flags = ntohl(tag->t_flags);
 				
-				err = jread(&obh, journal, next_log_block++);
+				io_block = next_log_block++;
 				wrap(journal, next_log_block);
+				err = jread(&obh, journal, io_block);
 				if (err) {
 					/* Recover what we can, but
 					 * report failure at the end. */
 					success = err;
 					printk (KERN_ERR 
-						"JFS: IO error recovering "
+						"JFS: IO error %d recovering "
 						"block %ld in log\n",
-						next_log_block-1);
+						err, io_block);
 				} else {
-					/* can never happen if jread OK - AED */
+					unsigned long blocknr;
+					
 					J_ASSERT(obh != NULL);
+					blocknr = ntohl(tag->t_blocknr);
 
-					/* And find a buffer for the new data
-					 * being restored */
-					nbh = getblk(journal->j_dev, 
-						     ntohl(tag->t_blocknr),
+					/* If the block has been
+					 * revoked, then we're all done
+					 * here. */
+					if (journal_test_revoke
+					    (journal, blocknr, 
+					     next_commit_ID)) {
+						brelse(obh);
+						++info->nr_revoke_hits;
+						goto skip_write;
+					}
+								
+					/* Find a buffer for the new
+					 * data being restored */
+					nbh = getblk(journal->j_dev, blocknr,
 						     journal->j_blocksize);
 					if (nbh == NULL) {
 						printk(KERN_ERR 
@@ -388,41 +435,105 @@
 					}
 					
 					mark_buffer_dirty(nbh, 1);
-					/* ll_rw_block(WRITE, 1, &nbh); */
+					++info->nr_replays;
+					// ll_rw_block(WRITE, 1, &nbh);
 					brelse(obh);
 					brelse(nbh);
 				}
 				
+			skip_write:
 				tagp += sizeof(journal_block_tag_t);
 				if (!(flags & JFS_FLAG_SAME_UUID))
 					tagp += 16;
 
 				if (flags & JFS_FLAG_LAST_TAG)
 					break;
-
-			} /* end of tag loop */
-
+			}
+			
 			brelse(bh);
-			
-		} /* end of descriptor block loop */
-			
-		/* We have now replayed that entire transaction: start
-		 * looking for the next transaction. */
-		next_commit_ID++;
+			continue;
+				
+		case JFS_COMMIT_BLOCK:
+			/* Found an expected commit block: not much to
+			 * do other than move on to the next sequence
+			 * number. */
+			brelse(bh);
+			next_commit_ID++;
+			continue;
+
+		case JFS_REVOKE_BLOCK:
+			/* If we aren't in the REVOKE pass, then we can
+			 * just skip over this block. */
+			if (pass != PASS_REVOKE) {
+				brelse(bh);
+				continue;
+			}
+
+			err = scan_revoke_records(journal, bh, 
+						  next_commit_ID, info);
+			brelse(bh);
+			if (err)
+				goto failed;
+			continue;
+
+		default:
+			jfs_debug(3, "Unrecognised magic %d, end of scan.\n",
+				  blocktype);
+			goto done;
+		}
 	}
-		
- finished:
-	err = success;
-	fsync_dev(journal->j_dev);
+
+ done:
+	/* 
+	 * We broke out of the log scan loop: either we came to the
+	 * known end of the log or we found an unexpected block in the
+	 * log.  If the latter happened, then we know that the "current"
+	 * transaction marks the end of the valid log.
+	 */
+	
+	if (pass == PASS_SCAN)
+		info->end_transaction = next_commit_ID;
+	else {
+		/* It's really bad news if different passes end up at
+		 * different places (but possible due to IO errors). */
+		if (info->end_transaction != next_commit_ID) {
+			printk (KERN_ERR "JFS: recovery pass %d ended at "
+				"transaction %u, expected %u\n",
+				pass, next_commit_ID, info->end_transaction);
+			if (!success)
+				success = -EIO;
+		}
+	}
+
+	return success;
 
  failed:
-	
-	/* Restart the log at the next transaction ID, thus invalidating
-	 * any existing commit records in the log. */
-	jfs_debug(0, "JFS: recovery, exit status %d, "
-		  "recovered transactions %u to %u\n", 
-		  err, first_commit_ID, next_commit_ID);
-	journal->j_transaction_sequence = ++next_commit_ID;
-
 	return err;
 }
+
+
+/* Scan a revoke record, marking all blocks mentioned as revoked. */
+
+static int scan_revoke_records(journal_t *journal, struct buffer_head *bh, 
+			       tid_t sequence, struct recovery_info *info)
+{
+	journal_revoke_header_t *header;
+	int offset, max;
+	
+	header = (journal_revoke_header_t *) bh->b_data;
+	offset = sizeof(journal_revoke_header_t);
+	max = ntohl(header->r_count);
+	
+	while (offset < max) {
+		unsigned long blocknr;
+		int err;
+		
+		blocknr = * ((unsigned int *) bh->b_data+offset);
+		offset += 4;
+		err = journal_set_revoke(journal, blocknr, sequence);
+		if (err)
+			return err;
+		++info->nr_revokes;
+	}
+	return 0;
+}
diff --git a/e2fsck/revoke.c b/e2fsck/revoke.c
new file mode 100644
index 0000000..633f975
--- /dev/null
+++ b/e2fsck/revoke.c
@@ -0,0 +1,537 @@
+/*
+ * linux/fs/revoke.c
+ * 
+ * Written by Stephen C. Tweedie <sct@redhat.com>, 2000
+ *
+ * Copyright 2000 Red Hat corp --- All Rights Reserved
+ *
+ * This file is part of the Linux kernel and is made available under
+ * the terms of the GNU General Public License, version 2, or at your
+ * option, any later version, incorporated herein by reference.
+ *
+ * Journal revoke routines for the generic filesystem journaling code;
+ * part of the ext2fs journaling system.
+ *
+ * Revoke is the mechanism used to prevent old log records for deleted
+ * metadata from being replayed on top of newer data using the same
+ * blocks.  The revoke mechanism is used in two separate places:
+ * 
+ * + Commit: during commit we write the entire list of the current
+ *   transaction's revoked blocks to the journal
+ * 
+ * + Recovery: during recovery we record the transaction ID of all
+ *   revoked blocks.  If there are multiple revoke records in the log
+ *   for a single block, only the last one counts, and if there is a log
+ *   entry for a block beyond the last revoke, then that log entry still
+ *   gets replayed.
+ *
+ * We can get interactions between revokes and new log data within a
+ * single transaction:
+ *
+ * Block is revoked and then journaled:
+ *   The desired end result is the journaling of the new block, so we 
+ *   cancel the revoke before the transaction commits.
+ *
+ * Block is journaled and then revoked:
+ *   The revoke must take precedence over the write of the block, so 
+ *   we need either to cancel the journal entry or to write the revoke
+ *   later in the log than the log block.  In this case, we choose the
+ *   former: the commit code must skip any block that has the Revoke bit
+ *   set.
+ *
+ * Block is revoked and then written as data: 
+ *   The data write is allowed to succeed, but the revoke is _not_
+ *   cancelled.  We still need to prevent old log records from
+ *   overwriting the new data.  We don't even need to clear the revoke
+ *   bit here.
+ *
+ * Revoke information on buffers is a tri-state value:
+ *
+ * RevokeValid clear:	no cached revoke status, need to look it up
+ * RevokeValid set, Revoke clear:
+ *			buffer has not been revoked, and cancel_revoke
+ *			need do nothing.
+ * RevokeValid set, Revoke set:
+ *			buffer has been revoked.
+ */
+
+#ifndef __KERNEL__
+#include "jfs_user.h"
+#else
+#include <linux/sched.h>
+#include <linux/fs.h>
+#include <linux/jfs.h>
+#include <linux/errno.h>
+#include <linux/slab.h>
+#include <linux/locks.h>
+#include <linux/buffer.h>
+#include <linux/list.h>
+#endif
+
+static kmem_cache_t *revoke_record_cache;
+static kmem_cache_t *revoke_table_cache;
+
+/* Each revoke record represents one single revoked block.  During
+   journal replay, this involves recording the transaction ID of the
+   last transaction to revoke this block. */
+
+struct jfs_revoke_record_s 
+{
+	struct list_head  hash;
+	tid_t		  sequence;	/* Used for recovery only */
+	unsigned long	  blocknr;	
+};
+
+
+/* The revoke table is just a simple hash table of revoke records. */
+struct jfs_revoke_table_s
+{
+	/* It is conceivable that we might want a larger hash table
+	 * for recovery.  Must be a power of two. */
+	int		  hash_size; 
+	int		  hash_shift; 
+	struct list_head *hash_table;
+};
+
+
+#ifdef __KERNEL__
+static void write_one_revoke_record(journal_t *, transaction_t *,
+				    struct buffer_head **, int *,
+				    struct jfs_revoke_record_s *);
+static void flush_descriptor(journal_t *, struct buffer_head *, int);
+#endif
+
+/* Utility functions to maintain the revoke table */
+
+/* Borrowed from buffer.c: this is a tried and tested block hash function */
+static inline int hash(journal_t *journal, unsigned long block)
+{
+	struct jfs_revoke_table_s *table = journal->j_revoke;
+	int hash_shift = table->hash_shift;
+	
+	return ((block << (hash_shift - 6)) ^
+		(block >> 13) ^
+		(block << (hash_shift - 12))) & (table->hash_size - 1);
+}
+
+int insert_revoke_hash(journal_t *journal, unsigned long blocknr, tid_t seq)
+{
+	struct list_head *hash_list;
+	struct jfs_revoke_record_s *record;
+	
+	record = kmem_cache_alloc(revoke_record_cache, GFP_KERNEL);
+	if (!record)
+		return -ENOMEM;
+
+	record->sequence = seq;
+	record->blocknr = blocknr;
+	hash_list = &journal->j_revoke->hash_table[hash(journal, blocknr)];
+	list_add(&record->hash, hash_list);
+	return 0;
+}
+
+/* Find a revoke record in the journal's hash table. */
+
+static struct jfs_revoke_record_s *find_revoke_record(journal_t *journal,
+						      unsigned long blocknr)
+{
+	struct list_head *hash_list;
+	struct jfs_revoke_record_s *record;
+	
+	hash_list = &journal->j_revoke->hash_table[hash(journal, blocknr)];
+
+	record = (struct jfs_revoke_record_s *) hash_list->next;
+	while (&(record->hash) != hash_list) {
+		if (record->blocknr == blocknr)
+			return record;
+		record = (struct jfs_revoke_record_s *) record->hash.next;
+	}
+	return NULL;
+}
+
+
+
+/* Initialise the revoke table for a given journal to a given size. */
+
+int journal_init_revoke(journal_t *journal, int hash_size)
+{
+	int shift, tmp;
+	
+	J_ASSERT (journal->j_revoke == NULL);
+	
+	if (!revoke_record_cache)
+		revoke_record_cache = 
+			kmem_cache_create ("revoke_record",
+					   sizeof(struct jfs_revoke_record_s),
+					   0, SLAB_HWCACHE_ALIGN, NULL, NULL);
+	
+	if (!revoke_table_cache)
+		revoke_table_cache = 
+			kmem_cache_create ("revoke_table",
+					   sizeof(struct jfs_revoke_table_s),
+					   0, 0, NULL, NULL);
+
+	if (!revoke_record_cache || !revoke_table_cache)
+		return -ENOMEM;
+	
+	journal->j_revoke = kmem_cache_alloc(revoke_table_cache, GFP_KERNEL);
+	if (!journal->j_revoke)
+		return -ENOMEM;
+	
+	/* Check that the hash_size is a power of two */
+	J_ASSERT ((hash_size & (hash_size-1)) == 0);
+
+	journal->j_revoke->hash_size = hash_size;
+
+	shift = 0;
+	tmp = hash_size;
+	while((tmp >>= 1UL) != 0UL)
+		shift++;
+	journal->j_revoke->hash_shift = shift;
+
+	journal->j_revoke->hash_table =
+		kmalloc(hash_size * sizeof(struct list_head), GFP_KERNEL);
+	if (!journal->j_revoke->hash_table) {
+		kmem_cache_free(revoke_table_cache, journal->j_revoke);
+		journal->j_revoke = NULL;
+		return -ENOMEM;
+	}
+	
+	for (tmp = 0; tmp < hash_size; tmp++)
+		INIT_LIST_HEAD(&journal->j_revoke->hash_table[tmp]);
+	
+	return 0;
+}
+
+/* Destoy a journal's revoke table.  The table must already be empty! */
+
+void journal_destroy_revoke(journal_t *journal)
+{
+	struct jfs_revoke_table_s *table;
+	struct list_head *hash_list;
+	int i;
+	
+	table = journal->j_revoke;
+	if (!table)
+		return;
+	
+	for (i=0; i<table->hash_size; i++) {
+		hash_list = &table->hash_table[i];
+		J_ASSERT (list_empty(hash_list));
+	}
+	
+	kfree(table->hash_table);
+	kmem_cache_free(revoke_table_cache, table);
+	journal->j_revoke = NULL;
+}
+
+
+#ifdef __KERNEL__
+
+/* 
+ * journal_revoke: revoke a given buffer_head from the journal.  This
+ * prevents the block from being replayed during recovery if we take a
+ * crash after this current transaction commits.  Any subsequent
+ * metadata writes of the buffer in this transaction cancel the
+ * revoke.  
+ *
+ * Note that this call may block --- it is up to the caller to make
+ * sure that there are no further calls to journal_write_metadata
+ * before the revoke is complete.  In ext3, this implies calling the
+ * revoke before clearing the block bitmap when we are deleting
+ * metadata. 
+ *
+ * Revoke performs a journal_forget on any buffer_head passed in as a
+ * parameter, but does _not_ forget the buffer_head if the bh was only
+ * found implicitly. 
+ *
+ * Revoke must observe the same synchronisation rules as bforget: it
+ * must not discard the buffer once it has blocked.
+ */
+
+int journal_revoke(handle_t *handle, unsigned long blocknr, 
+		   struct buffer_head *bh_in)
+{
+	struct buffer_head *bh;
+	journal_t *journal;
+	kdev_t dev;
+	int err;
+
+	journal = handle->h_transaction->t_journal;
+	if (!journal_set_features(journal, 0, 0, JFS_FEATURE_INCOMPAT_REVOKE))
+		return -EINVAL;
+	
+	dev = journal->j_dev;
+	bh = bh_in;
+
+	if (!bh)
+		bh = get_hash_table(dev, blocknr, journal->j_blocksize);
+
+	/* We really ought not ever to revoke twice in a row without
+           first having the revoke cancelled: it's illegal to free a
+           block twice without allocating it in between! */
+	if (bh) {
+		J_ASSERT (!test_and_set_bit(BH_Revoked, &bh->b_state));
+		set_bit(BH_RevokeValid, &bh->b_state);
+		if (bh_in)
+			journal_forget(handle, bh_in);
+		else
+			brelse(bh);
+	}
+
+	lock_journal(journal);
+	err = insert_revoke_hash(journal, blocknr, 
+				 handle->h_transaction->t_tid);
+	unlock_journal(journal);
+	
+	return err;
+}
+
+
+/*
+ * Cancel an outstanding revoke.  For use only internally by the
+ * journaling code (called from journal_get_write_access).
+ *
+ * We trust the BH_Revoked bit on the buffer if the buffer is already
+ * being journaled: if there is no revoke pending on the buffer, then we
+ * don't do anything here.
+ *
+ * This would break if it were possible for a buffer to be revoked and
+ * discarded, and then reallocated within the same transaction.  In such
+ * a case we would have lost the revoked bit, but when we arrived here
+ * the second time we would still have a pending revoke to cancel.  So,
+ * do not trust the Revoked bit on buffers unless RevokeValid is also
+ * set.
+ *
+ * The caller must have the journal locked.
+ * */
+
+void journal_cancel_revoke(handle_t *handle, struct buffer_head *bh)
+{
+	struct jfs_revoke_record_s *record;
+	journal_t *journal = handle->h_transaction->t_journal;
+	int need_cancel;
+	
+	J_ASSERT (journal->j_locked);
+	
+	/* Is the existing Revoke bit valid?  If so, we trust it, and
+	 * only perform the full cancel if the revoke bit is set.  If
+	 * not, we can't trust the revoke bit, and we need to do the
+	 * full search for a revoke record. */
+	if (test_and_set_bit(BH_RevokeValid, &bh->b_state))
+		need_cancel = (test_and_clear_bit(BH_Revoked, &bh->b_state));
+	else {
+		need_cancel = 1;
+		clear_bit(BH_Revoked, &bh->b_state);
+	}
+	
+	if (need_cancel) {
+		record = find_revoke_record(journal, bh->b_blocknr);
+		if (record) {
+			list_del(&record->hash);
+			kmem_cache_free(revoke_record_cache, record);
+		}
+	}
+}
+
+
+/*
+ * Write revoke records to the journal for all entries in the current
+ * revoke hash, deleting the entries as we go.
+ *
+ * Called with the journal lock held.
+ */
+
+void journal_write_revoke_records(journal_t *journal, 
+				  transaction_t *transaction)
+{
+	struct buffer_head *descriptor;
+	struct jfs_revoke_record_s *record;
+	struct jfs_revoke_table_s *revoke;
+	struct list_head *hash_list;
+	int i, offset;
+	
+	descriptor = NULL; 
+	offset = 0;
+	revoke = journal->j_revoke;
+	
+	for (i = 0; i < revoke->hash_size; i++) {
+		hash_list = &revoke->hash_table[i];
+
+		while (!list_empty(hash_list)) {
+			record = (struct jfs_revoke_record_s *) 
+				hash_list->next;
+			write_one_revoke_record(journal, transaction,
+						&descriptor, &offset, 
+						record);
+			list_del(&record->hash);
+			kmem_cache_free(revoke_record_cache, record);
+		}
+	}
+	if (descriptor) 
+		flush_descriptor(journal, descriptor, offset);
+}
+
+/* 
+ * Write out one revoke record.  We need to create a new descriptor
+ * block if the old one is full or if we have not already created one.  
+ */
+
+static void write_one_revoke_record(journal_t *journal, 
+				    transaction_t *transaction,
+				    struct buffer_head **descriptorp, 
+				    int *offsetp,
+				    struct jfs_revoke_record_s *record)
+{
+	struct buffer_head *descriptor;
+	int offset;
+	journal_header_t *header;
+	
+	/* If we are already aborting, this all becomes a noop.  We
+           still need to go round the loop in
+           journal_write_revoke_records in order to free all of the
+           revoke records: only the IO to the journal is omitted. */
+	if (is_journal_abort(journal))
+		return;
+
+	descriptor = *descriptorp;
+	offset = *offsetp;
+	
+	/* Make sure we have a descriptor with space left for the record */
+	if (descriptor) {
+		if (offset == journal->j_blocksize) {
+			flush_descriptor(journal, descriptor, offset);
+			descriptor = NULL;
+		}
+	}
+	
+	if (!descriptor) {
+		descriptor = journal_get_descriptor_buffer(journal);
+		header = (journal_header_t *) &descriptor->b_data[0];
+		header->h_magic     = htonl(JFS_MAGIC_NUMBER);
+		header->h_blocktype = htonl(JFS_REVOKE_BLOCK);
+		header->h_sequence  = htonl(transaction->t_tid);
+
+		/* Record it so that we can wait for IO completion later */
+		journal_file_buffer(descriptor, transaction, BJ_LogCtl);
+		
+		offset = sizeof(journal_revoke_header_t);
+		*descriptorp = descriptor;
+	}
+	
+	* ((unsigned int *)(&descriptor->b_data[offset])) = 
+		htonl(record->blocknr);
+	offset += 4;
+	*offsetp = offset;
+}
+
+/* 
+ * Flush a revoke descriptor out to the journal.  If we are aborting,
+ * this is a noop; otherwise we are generating a buffer which needs to
+ * be waited for during commit, so it has to go onto the appropriate
+ * journal buffer list.
+ */
+
+static void flush_descriptor(journal_t *journal, 
+			     struct buffer_head *descriptor, 
+			     int offset)
+{
+	journal_revoke_header_t *header;
+	
+	if (is_journal_abort(journal)) {
+		brelse(descriptor);
+		return;
+	}
+	
+	header = (journal_revoke_header_t *) descriptor->b_data;
+	header->r_count = htonl(offset);
+	set_bit(BH_JWrite, &descriptor->b_state);
+	ll_rw_block (WRITE, 1, &descriptor);
+}
+
+#endif
+
+/* 
+ * Revoke support for recovery.
+ *
+ * Recovery needs to be able to:
+ *
+ *  record all revoke records, including the tid of the latest instance
+ *  of each revoke in the journal
+ *
+ *  check whether a given block in a given transaction should be replayed
+ *  (ie. has not been revoked by a revoke record in that or a subsequent
+ *  transaction)
+ * 
+ *  empty the revoke table after recovery.
+ */
+
+/*
+ * First, setting revoke records.  We create a new revoke record for
+ * every block ever revoked in the log as we scan it for recovery, and
+ * we update the existing records if we find multiple revokes for a
+ * single block. 
+ */
+
+int journal_set_revoke(journal_t *journal, 
+		       unsigned long blocknr, 
+		       tid_t sequence)
+{
+	struct jfs_revoke_record_s *record;
+	
+	record = find_revoke_record(journal, blocknr);
+	if (record) {
+		/* If we have multiple occurences, only record the
+		 * latest sequence number in the hashed record */
+		if (tid_ge(sequence, record->sequence))
+			record->sequence = sequence;
+		return 0;
+	} 
+	return insert_revoke_hash(journal, blocknr, sequence);
+}
+
+/* 
+ * Test revoke records.  For a given block referenced in the log, has
+ * that block been revoked?  A revoke record with a given transaction
+ * sequence number revokes all blocks in that transaction and earlier
+ * ones, but later transactions still need replayed.
+ */
+
+int journal_test_revoke(journal_t *journal, 
+			unsigned long blocknr,
+			tid_t sequence)
+{
+	struct jfs_revoke_record_s *record;
+	
+	record = find_revoke_record(journal, blocknr);
+	if (!record)
+		return 0;
+	if (tid_ge(sequence, record->sequence))
+		return 0;
+	return 1;
+}
+
+/*
+ * Finally, once recovery is over, we need to clear the revoke table so
+ * that it can be reused by the running filesystem.
+ */
+
+void journal_clear_revoke(journal_t *journal)
+{
+	int i;
+	struct list_head *hash_list;
+	struct jfs_revoke_record_s *record;
+	struct jfs_revoke_table_s *revoke;
+	
+	revoke = journal->j_revoke;
+	
+	for (i = 0; i < revoke->hash_size; i++) {
+		hash_list = &revoke->hash_table[i];
+		while (!list_empty(hash_list)) {
+			record = (struct jfs_revoke_record_s*) hash_list->next;
+			list_del(&record->hash);
+			kmem_cache_free(revoke_record_cache, record);
+		}
+	}
+}
+
diff --git a/include/linux/ChangeLog b/include/linux/ChangeLog
index d9c81a1..7e97ce0 100644
--- a/include/linux/ChangeLog
+++ b/include/linux/ChangeLog
@@ -2,6 +2,10 @@
 
 	* jfs.h, jfs_compat.h, list.h: New files added to support ext3.
 
+	* jfs.h: Remove excess #include of JFS_DEBUG.  Not needed for
+		e2fsprogs, since we optioanlly define it in the
+		configuration file system.
+
 2000-10-24    <tytso@valinux.com>
 
 	* ext2_fs.h (EXT2_JOURNAL_INO): Add definition for
diff --git a/include/linux/jfs.h b/include/linux/jfs.h
index fffd8df..3053449 100644
--- a/include/linux/jfs.h
+++ b/include/linux/jfs.h
@@ -26,8 +26,6 @@
  */
 #ifdef __KERNEL__
 #define JFS_DEBUG
-#else
-#define JFS_DEBUG
 #endif
 
 extern int journal_enable_debug;
diff --git a/lib/e2p/Makefile.in b/lib/e2p/Makefile.in
index 54a9820..b851437 100644
--- a/lib/e2p/Makefile.in
+++ b/lib/e2p/Makefile.in
@@ -99,18 +99,28 @@
 # Makefile dependencies follow.  This must be the last section in
 # the Makefile.in file
 #
-feature.o: $(srcdir)/feature.c $(srcdir)/e2p.h
-fgetflags.o: $(srcdir)/fgetflags.c $(srcdir)/e2p.h
-fsetflags.o: $(srcdir)/fsetflags.c $(srcdir)/e2p.h
-fgetversion.o: $(srcdir)/fgetversion.c $(srcdir)/e2p.h
-fsetversion.o: $(srcdir)/fsetversion.c $(srcdir)/e2p.h
-getflags.o: $(srcdir)/getflags.c $(srcdir)/e2p.h
-getversion.o: $(srcdir)/getversion.c $(srcdir)/e2p.h
-iod.o: $(srcdir)/iod.c $(srcdir)/e2p.h
-ls.o: $(srcdir)/ls.c $(srcdir)/e2p.h
-pe.o: $(srcdir)/pe.c $(srcdir)/e2p.h
-pf.o: $(srcdir)/pf.c $(srcdir)/e2p.h
-ps.o: $(srcdir)/ps.c $(srcdir)/e2p.h
-setflags.o: $(srcdir)/setflags.c $(srcdir)/e2p.h
-setversion.o: $(srcdir)/setversion.c $(srcdir)/e2p.h
-uuid.o: $(srcdir)/uuid.c $(srcdir)/e2p.h
+feature.o: $(srcdir)/feature.c $(srcdir)/e2p.h \
+ $(top_srcdir)/include/linux/ext2_fs.h
+fgetflags.o: $(srcdir)/fgetflags.c $(srcdir)/e2p.h \
+ $(top_srcdir)/include/linux/ext2_fs.h
+fsetflags.o: $(srcdir)/fsetflags.c $(srcdir)/e2p.h \
+ $(top_srcdir)/include/linux/ext2_fs.h
+fgetversion.o: $(srcdir)/fgetversion.c $(srcdir)/e2p.h \
+ $(top_srcdir)/include/linux/ext2_fs.h
+fsetversion.o: $(srcdir)/fsetversion.c $(srcdir)/e2p.h \
+ $(top_srcdir)/include/linux/ext2_fs.h
+getflags.o: $(srcdir)/getflags.c $(srcdir)/e2p.h \
+ $(top_srcdir)/include/linux/ext2_fs.h
+getversion.o: $(srcdir)/getversion.c $(srcdir)/e2p.h \
+ $(top_srcdir)/include/linux/ext2_fs.h
+iod.o: $(srcdir)/iod.c $(srcdir)/e2p.h $(top_srcdir)/include/linux/ext2_fs.h
+ls.o: $(srcdir)/ls.c $(srcdir)/e2p.h $(top_srcdir)/include/linux/ext2_fs.h
+pe.o: $(srcdir)/pe.c $(srcdir)/e2p.h $(top_srcdir)/include/linux/ext2_fs.h
+pf.o: $(srcdir)/pf.c $(srcdir)/e2p.h $(top_srcdir)/include/linux/ext2_fs.h
+ps.o: $(srcdir)/ps.c $(srcdir)/e2p.h $(top_srcdir)/include/linux/ext2_fs.h
+setflags.o: $(srcdir)/setflags.c $(srcdir)/e2p.h \
+ $(top_srcdir)/include/linux/ext2_fs.h
+setversion.o: $(srcdir)/setversion.c $(srcdir)/e2p.h \
+ $(top_srcdir)/include/linux/ext2_fs.h
+uuid.o: $(srcdir)/uuid.c $(srcdir)/e2p.h \
+ $(top_srcdir)/include/linux/ext2_fs.h
diff --git a/lib/ext2fs/Makefile.in b/lib/ext2fs/Makefile.in
index 008e48a..6e1ebba 100644
--- a/lib/ext2fs/Makefile.in
+++ b/lib/ext2fs/Makefile.in
@@ -78,12 +78,12 @@
 	$(srcdir)/dupfs.c \
 	$(srcdir)/expanddir.c \
 	$(srcdir)/fileio.c \
-	$(srcidr)/finddev.c \
+	$(srcdir)/finddev.c \
 	$(srcdir)/freefs.c \
 	$(srcdir)/get_pathname.c \
 	$(srcdir)/getsize.c \
 	$(srcdir)/icount.c \
-	$(srcdir)/imager.o \
+	$(srcdir)/imager.c \
 	$(srcdir)/initialize.c \
 	$(srcdir)/inline.c \
 	$(srcdir)/inode.c \
@@ -220,132 +220,154 @@
 # the Makefile.in file
 #
 ext2_err.o: ext2_err.c
-alloc.o: $(srcdir)/alloc.c $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
+alloc.o: $(srcdir)/alloc.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+alloc_tables.o: $(srcdir)/alloc_tables.c \
+ $(top_srcdir)/include/linux/ext2_fs.h $(srcdir)/ext2fs.h \
+ $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+badblocks.o: $(srcdir)/badblocks.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fsP.h $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
  $(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-alloc_tables.o: $(srcdir)/alloc_tables.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-badblocks.o: $(srcdir)/badblocks.c $(srcdir)/ext2fsP.h $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-bb_compat.o: $(srcdir)/bb_compat.c $(srcdir)/ext2fsP.h $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-bb_inode.o: $(srcdir)/bb_inode.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-bitmaps.o: $(srcdir)/bitmaps.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-bitops.o: $(srcdir)/bitops.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-block.o: $(srcdir)/block.c $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
+bb_compat.o: $(srcdir)/bb_compat.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fsP.h $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
  $(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-bmap.o: $(srcdir)/bmap.c $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
+bb_inode.o: $(srcdir)/bb_inode.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+bitmaps.o: $(srcdir)/bitmaps.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+bitops.o: $(srcdir)/bitops.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+block.o: $(srcdir)/block.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+bmap.o: $(srcdir)/bmap.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+check_desc.o: $(srcdir)/check_desc.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+closefs.o: $(srcdir)/closefs.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fsP.h $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
  $(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-check_desc.o: $(srcdir)/check_desc.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+cmp_bitmaps.o: $(srcdir)/cmp_bitmaps.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
  $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-closefs.o: $(srcdir)/closefs.c $(srcdir)/ext2fsP.h $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-cmp_bitmaps.o: $(srcdir)/cmp_bitmaps.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-dblist.o: $(srcdir)/dblist.c $(srcdir)/ext2fsP.h $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-dblist_dir.o: $(srcdir)/dblist_dir.c $(srcdir)/ext2fsP.h $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-dirblock.o: $(srcdir)/dirblock.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-dir_iterate.o: $(srcdir)/dir_iterate.c $(srcdir)/ext2fsP.h $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-dupfs.o: $(srcdir)/dupfs.c $(srcdir)/ext2fsP.h $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-expanddir.o: $(srcdir)/expanddir.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-fileio.o: $(srcdir)/fileio.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-freefs.o: $(srcdir)/freefs.c $(srcdir)/ext2fsP.h $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-get_pathname.o: $(srcdir)/get_pathname.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-getsize.o: $(srcdir)/getsize.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-icount.o: $(srcdir)/icount.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-initialize.o: $(srcdir)/initialize.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-inline.o: $(srcdir)/inline.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-inode.o: $(srcdir)/inode.c $(srcdir)/ext2fsP.h $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-ismounted.o: $(srcdir)/ismounted.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-link.o: $(srcdir)/link.c $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
+dblist.o: $(srcdir)/dblist.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fsP.h $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
  $(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+dblist_dir.o: $(srcdir)/dblist_dir.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fsP.h $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
+ $(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+dirblock.o: $(srcdir)/dirblock.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+dir_iterate.o: $(srcdir)/dir_iterate.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fsP.h $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
+ $(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+dupfs.o: $(srcdir)/dupfs.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fsP.h $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
+ $(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+expanddir.o: $(srcdir)/expanddir.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+fileio.o: $(srcdir)/fileio.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+finddev.o: $(srcdir)/finddev.c
+freefs.o: $(srcdir)/freefs.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fsP.h $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
+ $(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+get_pathname.o: $(srcdir)/get_pathname.c \
+ $(top_srcdir)/include/linux/ext2_fs.h $(srcdir)/ext2fs.h \
+ $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+getsize.o: $(srcdir)/getsize.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+icount.o: $(srcdir)/icount.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+imager.o: $(srcdir)/imager.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+initialize.o: $(srcdir)/initialize.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+inline.o: $(srcdir)/inline.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+inode.o: $(srcdir)/inode.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fsP.h $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
+ $(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+ismounted.o: $(srcdir)/ismounted.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+link.o: $(srcdir)/link.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
 llseek.o: $(srcdir)/llseek.c $(top_srcdir)/lib/et/com_err.h \
  $(srcdir)/ext2_io.h
-lookup.o: $(srcdir)/lookup.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+lookup.o: $(srcdir)/lookup.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
  $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-mkdir.o: $(srcdir)/mkdir.c $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
- $(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-namei.o: $(srcdir)/namei.c $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
- $(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-native.o: $(srcdir)/native.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+mkdir.o: $(srcdir)/mkdir.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
  $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-newdir.o: $(srcdir)/newdir.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-openfs.o: $(srcdir)/openfs.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-read_bb.o: $(srcdir)/read_bb.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-read_bb_file.o: $(srcdir)/read_bb_file.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-rs_bitmap.o: $(srcdir)/rs_bitmap.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-rw_bitmaps.o: $(srcdir)/rw_bitmaps.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-swapfs.o: $(srcdir)/swapfs.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-test_io.o: $(srcdir)/test_io.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-unix_io.o: $(srcdir)/unix_io.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-unlink.o: $(srcdir)/unlink.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-valid_blk.o: $(srcdir)/valid_blk.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
-version.o: $(srcdir)/version.c $(srcdir)/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+mkjournal.o: $(srcdir)/mkjournal.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
  $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h \
- $(srcdir)/../../version.h
+ $(srcdir)/jfs_user.h $(top_srcdir)/include/linux/jfs.h \
+ $(top_srcdir)/include/linux/jfs_compat.h $(top_srcdir)/include/linux/list.h
+namei.o: $(srcdir)/namei.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+native.o: $(srcdir)/native.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+newdir.o: $(srcdir)/newdir.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+openfs.o: $(srcdir)/openfs.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+read_bb.o: $(srcdir)/read_bb.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+read_bb_file.o: $(srcdir)/read_bb_file.c \
+ $(top_srcdir)/include/linux/ext2_fs.h $(srcdir)/ext2fs.h \
+ $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+rs_bitmap.o: $(srcdir)/rs_bitmap.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+rw_bitmaps.o: $(srcdir)/rw_bitmaps.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+swapfs.o: $(srcdir)/swapfs.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+test_io.o: $(srcdir)/test_io.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+unix_io.o: $(srcdir)/unix_io.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+unlink.o: $(srcdir)/unlink.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+valid_blk.o: $(srcdir)/valid_blk.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+version.o: $(srcdir)/version.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h \
+ $(top_srcdir)/version.h
+write_bb_file.o: $(srcdir)/write_bb_file.c \
+ $(top_srcdir)/include/linux/ext2_fs.h $(srcdir)/ext2fs.h \
+ $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
diff --git a/lib/ss/Makefile.in b/lib/ss/Makefile.in
index 76f2672..38c2750 100644
--- a/lib/ss/Makefile.in
+++ b/lib/ss/Makefile.in
@@ -180,8 +180,8 @@
  $(top_builddir)/lib/ss/ss_err.h
 parse.o: $(srcdir)/parse.c $(srcdir)/ss_internal.h $(srcdir)/ss.h \
  $(top_builddir)/lib/ss/ss_err.h
-error.o: $(srcdir)/error.c $(srcdir)/../et/com_err.h $(srcdir)/ss_internal.h \
- $(srcdir)/ss.h $(top_builddir)/lib/ss/ss_err.h
+error.o: $(srcdir)/error.c $(top_srcdir)/lib/et/com_err.h \
+ $(srcdir)/ss_internal.h $(srcdir)/ss.h $(top_builddir)/lib/ss/ss_err.h
 prompt.o: $(srcdir)/prompt.c $(srcdir)/ss_internal.h $(srcdir)/ss.h \
  $(top_builddir)/lib/ss/ss_err.h
 request_tbl.o: $(srcdir)/request_tbl.c $(srcdir)/ss_internal.h $(srcdir)/ss.h \
diff --git a/lib/uuid/Makefile.in b/lib/uuid/Makefile.in
index cbf733d..b584859 100644
--- a/lib/uuid/Makefile.in
+++ b/lib/uuid/Makefile.in
@@ -172,4 +172,5 @@
 parse.o: $(srcdir)/parse.c $(srcdir)/uuidP.h $(srcdir)/uuid.h
 unpack.o: $(srcdir)/unpack.c $(srcdir)/uuidP.h $(srcdir)/uuid.h
 unparse.o: $(srcdir)/unparse.c $(srcdir)/uuidP.h $(srcdir)/uuid.h
-uuid_time.o: $(srcdir)/uuid_time.c $(srcdir)/uuidP.h $(srcdir)/uuid.h
+uuid_time.o: $(srcdir)/uuid_time.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(srcdir)/uuidP.h $(srcdir)/uuid.h
diff --git a/misc/Makefile.in b/misc/Makefile.in
index e9897a3..b75d81c 100644
--- a/misc/Makefile.in
+++ b/misc/Makefile.in
@@ -188,27 +188,36 @@
 # Makefile dependencies follow.  This must be the last section in
 # the Makefile.in file
 #
-tune2fs.o: $(srcdir)/tune2fs.c $(top_srcdir)/lib/ext2fs/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h \
- $(top_srcdir)/lib/uuid/uuid.h $(top_srcdir)/lib/e2p/e2p.h \
- $(srcdir)/../version.h
-mklost+found.o: $(srcdir)/mklost+found.c $(srcdir)/../version.h
-mke2fs.o: $(srcdir)/mke2fs.c $(top_srcdir)/lib/et/com_err.h \
- $(top_srcdir)/lib/uuid/uuid.h $(top_srcdir)/lib/e2p/e2p.h \
- $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h \
- $(srcdir)/../version.h
-chattr.o: $(srcdir)/chattr.c $(top_srcdir)/lib/et/com_err.h \
- $(top_srcdir)/lib/e2p/e2p.h $(srcdir)/../version.h
-lsattr.o: $(srcdir)/lsattr.c $(top_srcdir)/lib/et/com_err.h \
- $(top_srcdir)/lib/e2p/e2p.h $(srcdir)/../version.h
-dumpe2fs.o: $(srcdir)/dumpe2fs.c $(top_srcdir)/lib/ext2fs/ext2fs.h \
- $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h \
- $(top_srcdir)/lib/e2p/e2p.h $(srcdir)/../version.h
+tune2fs.o: $(srcdir)/tune2fs.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
+ $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+ $(top_srcdir)/lib/ext2fs/bitops.h $(top_srcdir)/lib/uuid/uuid.h \
+ $(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/version.h $(srcdir)/nls-enable.h
+mklost+found.o: $(srcdir)/mklost+found.c \
+ $(top_srcdir)/include/linux/ext2_fs.h $(top_srcdir)/version.h \
+ $(srcdir)/nls-enable.h
+mke2fs.o: $(srcdir)/mke2fs.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/uuid/uuid.h \
+ $(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
+ $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+ $(top_srcdir)/lib/ext2fs/bitops.h $(top_srcdir)/version.h \
+ $(srcdir)/nls-enable.h
+chattr.o: $(srcdir)/chattr.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/e2p/e2p.h \
+ $(top_srcdir)/version.h $(srcdir)/nls-enable.h
+lsattr.o: $(srcdir)/lsattr.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/e2p/e2p.h \
+ $(top_srcdir)/version.h $(srcdir)/nls-enable.h
+dumpe2fs.o: $(srcdir)/dumpe2fs.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
+ $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+ $(top_srcdir)/lib/ext2fs/bitops.h $(top_srcdir)/lib/e2p/e2p.h \
+ $(top_srcdir)/version.h $(srcdir)/nls-enable.h
 badblocks.o: $(srcdir)/badblocks.c $(top_srcdir)/lib/et/com_err.h \
- $(top_srcdir)/lib/ext2fs/ext2_io.h
-fsck.o: $(srcdir)/fsck.c $(srcdir)/../version.h $(srcdir)/fsck.h \
- $(srcdir)/get_device_by_label.h
-uuidgen.o: $(srcdir)/uuidgen.c $(top_srcdir)/lib/uuid/uuid.h
+ $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_srcdir)/include/linux/ext2_fs.h \
+ $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+ $(top_srcdir)/lib/ext2fs/bitops.h $(srcdir)/nls-enable.h
+fsck.o: $(srcdir)/fsck.c $(top_srcdir)/version.h $(srcdir)/nls-enable.h \
+ $(srcdir)/fsck.h $(srcdir)/get_device_by_label.h
+uuidgen.o: $(srcdir)/uuidgen.c $(top_srcdir)/lib/uuid/uuid.h \
+ $(srcdir)/nls-enable.h
diff --git a/resize/Makefile.in b/resize/Makefile.in
index 319abfb..fb6db06 100644
--- a/resize/Makefile.in
+++ b/resize/Makefile.in
@@ -137,7 +137,7 @@
  $(top_srcdir)/include/linux/ext2_fs.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
  $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
  $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h \
- $(srcdir)/../version.h
+ $(top_srcdir)/version.h
 sim_progress.o: $(srcdir)/sim_progress.c $(srcdir)/resize2fs.h \
  $(top_srcdir)/include/linux/ext2_fs.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
  $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
diff --git a/tests/progs/Makefile.in b/tests/progs/Makefile.in
index 53c5997..b2c281c 100644
--- a/tests/progs/Makefile.in
+++ b/tests/progs/Makefile.in
@@ -58,9 +58,9 @@
 # Makefile dependencies follow.  This must be the last section in
 # the Makefile.in file
 #
-test_rel.o: $(srcdir)/test_rel.c $(top_srcdir)/lib/et/com_err.h \
- $(top_srcdir)/lib/ss/ss.h $(top_builddir)/lib/ss/ss_err.h \
- $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h \
- $(top_srcdir)/lib/ext2fs/irel.h $(top_srcdir)/lib/ext2fs/brel.h \
- $(srcdir)/test_rel.h
+test_rel.o: $(srcdir)/test_rel.c $(top_srcdir)/include/linux/ext2_fs.h \
+ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ss/ss.h \
+ $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
+ $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+ $(top_srcdir)/lib/ext2fs/bitops.h $(top_srcdir)/lib/ext2fs/irel.h \
+ $(top_srcdir)/lib/ext2fs/brel.h $(srcdir)/test_rel.h