ChangeLog, mke2fs.8.in, mke2fs.c, tune2fs.8.in, tune2fs.c, util.c, util.h:
  ke2fs.8.in, tune2fs.8.in: Change man paegs to document that the
  journal must be bewteen 1024 and 10,240 file system blocks.
  mke2fs.c, tune2fs.c: Change to use figure_journal_size()
  util.c, util.h (figure_journal_size): Change journal_default_size into
  	routine which also converts the requested journal size into filesystem
  	blocks and does bounds checking to make sure the journal is sized
  	reasonably.  Renamed function to journal_default_size.
  	parse_journal_opts): Remove bounds check for the journal size, since
  	this is now done in figure_journal_size, and based on the number of
  	filesystem blocks, as opposed to using the absolute size of the
  	journal.

diff --git a/misc/ChangeLog b/misc/ChangeLog
index d081750..4aeef8c 100644
--- a/misc/ChangeLog
+++ b/misc/ChangeLog
@@ -1,3 +1,21 @@
+2001-03-26  Theodore Tso  <tytso@valinux.com>
+
+	* mke2fs.8.in, tune2fs.8.in: Change man paegs to document that the
+		journal must be bewteen 1024 and 10,240 file system
+		blocks.
+
+	* mke2fs.c, tune2fs.c: Change to use figure_journal_size()
+
+	* util.c, util.h (figure_journal_size): Change
+		journal_default_size into routine which also converts the
+		requested journal size into filesystem blocks and does
+		bounds checking to make sure the journal is sized
+		reasonably.  Renamed function to journal_default_size.
+		(parse_journal_opts): Remove bounds check for the journal
+		size, since this is now done in figure_journal_size, and
+		based on the number of filesystem blocks, as opposed to
+		using the absolute size of the journal.
+
 2001-02-17  Theodore Tso  <tytso@valinux.com>
 
 	* mke2fs.c (main): Flush out the "creating journal" message.
diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in
index 76cb246..03f3283 100644
--- a/misc/mke2fs.8.in
+++ b/misc/mke2fs.8.in
@@ -161,8 +161,10 @@
 .BI "\-J size=" journal-size
 Create a journal stored in the filesystem of size
 .IR journal-size .
-The size of the journal must be between 1MB and 100MB and it must fit within 
-the newly created filesystem.
+The size of the journal must be at least 1024 filesystem blocks 
+(i.e., 1MB if using 1k blocks, 4MB if using 4k blocks, etc.) 
+and may be no more than 10,240 filesystem blocks.  
+The journal must fit within the newly created filesystem.  
 .TP
 .BI "\-J device=" external-journal
 Add an external journal found on a block device
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index c75b299..9f9f332 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -1216,11 +1216,7 @@
 			printf(_("done\n"));
 		ext2fs_close(jfs);
 	} else if (journal_size) {
-		if (journal_size < 0)
-			journal_blocks = journal_default_size(fs->super->s_blocks_count);
-		else
-			journal_blocks = journal_size * 1024 /
-				(fs->blocksize	/ 1024);
+		journal_blocks = figure_journal_size(journal_size, fs);
 
 		if (!journal_blocks) {
 			fs->super->s_feature_compat &=
@@ -1252,8 +1248,9 @@
 		printf(_("\nWarning, had trouble writing out superblocks."));
 	}
 	if (!quiet) {
-		printf(_("done\n"));
-		printf(_("e2fsck will be run every %d mounts or %4g days"),
+		printf(_("done\n\n"));
+		printf(_("Filesystem will be checked run "
+			 "every %d mounts or %g days.\n"),
 		       fs->super->s_max_mnt_count,
 		       (double)fs->super->s_checkinterval / (3600 * 24));
 	}
diff --git a/misc/tune2fs.8.in b/misc/tune2fs.8.in
index 07b6cfc..fe728e9 100644
--- a/misc/tune2fs.8.in
+++ b/misc/tune2fs.8.in
@@ -129,8 +129,8 @@
 .BI "\-J size=" journal-size
 Create a journal stored in the filesystem of size
 .IR journal-size .
-The size of the journal must be between 1MB and 100MB and there 
-must be sufficient free space in the filesystem to create a journal of
+The size of the journal must be between 1024 and 10,240 filesystem blocks and
+there must be sufficient free space in the filesystem to create a journal of
 that size.
 .TP
 .BI "\-J device=" external-journal
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index 8827605..401e27c 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -303,10 +303,8 @@
 	} else if (journal_size) {
 		printf(_("Creating journal inode: "));
 		fflush(stdout);
-		if (journal_size < 0)
-			journal_blocks = journal_default_size(fs->super->s_blocks_count);
-		else
-			journal_blocks = journal_size * 1024 / (fs->blocksize / 1024);
+		journal_blocks = figure_journal_size(journal_size, fs);
+
 		retval = ext2fs_add_journal_inode(fs, journal_blocks,
 						  journal_flags);
 		if (retval) {
diff --git a/misc/util.c b/misc/util.c
index eaf6fea..6ab5b7a 100644
--- a/misc/util.c
+++ b/misc/util.c
@@ -163,14 +163,8 @@
 				continue;
 			}
 			journal_size = strtoul(arg, &p, 0);
-		journal_size_check:
-			if (*p || (journal_size < 1 || journal_size > 100)) {
-				fprintf(stderr,
-				_("Invalid journal size parameter - %s.\n"),
-					arg);
+			if (*p)
 				journal_usage++;
-				continue;
-			}
 		} else if (strcmp(token, "v1_superblock") == 0) {
 			journal_flags |= EXT2_MKJOURNAL_V1_SUPER;
 			continue;
@@ -178,8 +172,6 @@
 			journal_size = strtoul(token, &p, 0);
 			if (*p)
 				journal_usage++;
-			else
-				goto journal_size_check;
 		}
 	}
 	if (journal_usage) {
@@ -190,30 +182,56 @@
 			"Valid raid options are:\n"
 			"\tsize=<journal size in megabytes>\n"
 			"\tdevice=<journal device>\n\n"
-			"Journal size must be between "
-			"1 and 100 megabytes.\n\n" ));
+			"The journal size must be between "
+			"1024 and 102400 filesystem blocks.\n\n" ));
 		exit(1);
 	}
 }	
 
 /*
+ * Determine the number of journal blocks to use, either via
+ * user-specified # of megabytes, or via some intelligently selected
+ * defaults.
+ * 
  * Find a reasonable journal file size (in blocks) given the number of blocks
  * in the filesystem.  For very small filesystems, it is not reasonable to
  * have a journal that fills more than half of the filesystem.
  */
-int journal_default_size(blk_t blocks_count)
+int figure_journal_size(int journal_size, ext2_filsys fs)
 {
 	blk_t j_blocks;
 
-	if (blocks_count < 2048) {
-		fprintf(stderr, "Filesystem too small for a journal\n");
-		j_blocks = 0;
-	} else if (blocks_count < 32768)
+	if (fs->super->s_blocks_count < 2048) {
+		fprintf(stderr, _("\nFilesystem too small for a journal\n"));
+		return 0;
+	}
+	
+	if (journal_size >= 0) {
+		j_blocks = journal_size * 1024 /
+			(fs->blocksize	/ 1024);
+		if (j_blocks < 1024 || j_blocks > 102400) {
+			fprintf(stderr, _("\nThe requested journal "
+				"size is %d blocks; it must be\n"
+				"between 1024 and 102400 blocks.  "
+				"Aborting.\n"),
+				j_blocks);
+			exit(1);
+		}
+		if (j_blocks > fs->super->s_free_blocks_count) {
+			fprintf(stderr, _("\nJournal size too big "
+					  "for filesystem.\n"));
+			exit(1);
+		}
+		return j_blocks;
+	}
+
+	if (fs->super->s_blocks_count < 32768)
 		j_blocks = 1024;
-	else if (blocks_count < 262144)
+	else if (fs->super->s_blocks_count < 262144)
 		j_blocks = 4096;
 	else
 		j_blocks = 8192;
 
 	return j_blocks;
 }
+
diff --git a/misc/util.h b/misc/util.h
index 61a7800..92ea750 100644
--- a/misc/util.h
+++ b/misc/util.h
@@ -21,4 +21,5 @@
 extern void check_plausibility(const char *device);
 extern void parse_journal_opts(const char *opts);
 extern void check_mount(const char *device, int force, const char *type);
-extern int journal_default_size(const blk_t blocks_count);
+extern int figure_journal_size(int journal_size, ext2_filsys fs);
+