ChangeLog, expanddir.c, ext2fs.h:
  ext2fs.h: Add new fields for journalling and define new feature bits
  	used by newer filesystems: IMAGIC_INODES, HAS_JOURNAL, RECOVER.
  expanddir.c (ext2fs_expand_dir, expand_dir_proc): Change where we
  	update the inode block count and size files so that the block count
  	field is updated correctly when we create an indirect block.

diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog
index bc98b17..275c6b0 100644
--- a/lib/ext2fs/ChangeLog
+++ b/lib/ext2fs/ChangeLog
@@ -1,4 +1,15 @@
-1999-07-18  Theodore Ts'o  <tytso@rsts-11.mit.edu>
+1999-09-07    <tytso@valinux.com>
+
+	* ext2fs.h: Add new fields for journalling and define new
+		feature bits used by newer filesystems: IMAGIC_INODES,
+		HAS_JOURNAL, RECOVER.
+
+	* expanddir.c (ext2fs_expand_dir, expand_dir_proc): Change where
+		we update the inode block count and size files so that the
+		block count field is updated correctly when we create an
+		indirect block.
+
+1999-07-18  Theodore Ts'o  <tytso@valinux.com>
 
 	* Release of E2fsprogs 1.15
 
diff --git a/lib/ext2fs/expanddir.c b/lib/ext2fs/expanddir.c
index bdfc257..eb13084 100644
--- a/lib/ext2fs/expanddir.c
+++ b/lib/ext2fs/expanddir.c
@@ -1,7 +1,7 @@
 /*
  * expand.c --- expand an ext2fs directory
  * 
- * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
+ * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999  Theodore Ts'o.
  *
  * %Begin-Header%
  * This file may be redistributed under the terms of the GNU Public
@@ -24,7 +24,8 @@
 #include "ext2fs.h"
 
 struct expand_dir_struct {
-	int	done;
+	int		done;
+	int		newblocks;
 	errcode_t	err;
 };
 
@@ -80,6 +81,8 @@
 	fs->group_desc[group].bg_free_blocks_count--;
 	fs->super->s_free_blocks_count--;
 	ext2fs_mark_super_dirty(fs);
+	es->newblocks++;
+
 	if (es->done)
 		return (BLOCK_CHANGED | BLOCK_ABORT);
 	else
@@ -106,6 +109,7 @@
 	
 	es.done = 0;
 	es.err = 0;
+	es.newblocks = 0;
 	
 	retval = ext2fs_block_iterate2(fs, dir, BLOCK_FLAG_APPEND,
 				       0, expand_dir_proc, &es);
@@ -123,7 +127,7 @@
 		return retval;
 	
 	inode.i_size += fs->blocksize;
-	inode.i_blocks += fs->blocksize / 512;
+	inode.i_blocks += (fs->blocksize / 512) * es.newblocks;
 
 	retval = ext2fs_write_inode(fs, dir, &inode);
 	if (retval)
diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
index 5ade963..ec7d29f 100644
--- a/lib/ext2fs/ext2fs.h
+++ b/lib/ext2fs/ext2fs.h
@@ -425,12 +425,17 @@
 	__u8	s_prealloc_blocks;	/* Nr of blocks to try to preallocate*/
 	__u8	s_prealloc_dir_blocks;	/* Nr to preallocate for dirs */
 	__u16	s_padding1;
-	__u32	s_reserved[204];	/* Padding to the end of the block */
+	/* 
+	 * Journaling support.
+	 */
+	__u8	s_journal_uuid[16];	/* uuid of journal superblock */
+	__u32	s_journal_inum;		/* inode number of journal file */
+	
+	__u32	s_reserved[199];	/* Padding to the end of the block */
 };
 
 /*
  * Feature set definitions (that might not be in ext2_fs.h
- * (was EXT2_COMPAT_SPARSE_SUPER)
  */
 
 #ifndef EXT2_FEATURE_COMPAT_DIR_PREALLOC
@@ -439,6 +444,11 @@
 
 #ifndef EXT2_FEATURE_COMPAT_IMAGIC_INODES /* for AFS, etc. */
 #define EXT2_FEATURE_COMPAT_IMAGIC_INODES		0x0002
+#define EXT2_IMAGIC_FL		0x00002000
+#endif
+
+#ifndef EXT3_FEATURE_COMPAT_HAS_JOURNAL
+#define EXT3_FEATURE_COMPAT_HAS_JOURNAL		0x0004
 #endif
 
 #ifndef EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER
@@ -462,7 +472,13 @@
 #define EXT2_FEATURE_INCOMPAT_FILETYPE	0x0002
 #endif
 
-#define EXT2_LIB_FEATURE_COMPAT_SUPP	EXT2_FEATURE_COMPAT_DIR_PREALLOC
+#ifndef EXT3_FEATURE_INCOMPAT_RECOVER 
+#define EXT3_FEATURE_INCOMPAT_RECOVER	0x0004 /* Needs recovery */
+#endif
+
+#define EXT2_LIB_FEATURE_COMPAT_SUPP	(EXT2_FEATURE_COMPAT_DIR_PREALLOC|\
+					 EXT2_FEATURE_COMPAT_IMAGIC_INODES|\
+					 EXT3_FEATURE_COMPAT_HAS_JOURNAL)
 #define EXT2_LIB_FEATURE_INCOMPAT_SUPP	EXT2_FEATURE_INCOMPAT_FILETYPE
 #define EXT2_LIB_FEATURE_RO_COMPAT_SUPP	(EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER|\
 					 EXT2_FEATURE_RO_COMPAT_LARGE_FILE)