On Wed, 2005-06-29 at 16:35 -0500, Dave Kleikamp wrote:
> > Hooray!  Definitely fixed the problem.
> 
> Not quite.  My patch caused the block size to be set to zero in the
> journal's superblock, which causes the kernel to write to the wrong
> location in the journal.
> 
> Here's a better patch.

Tried to hit the attachment button, and hit send instead.  Here's the
patch.
-- 
David Kleikamp
IBM Linux Technology Center
Index: jfsutils/mkfs/mkfs.c
===================================================================
RCS file: /cvsroot/jfs/jfsutils/mkfs/mkfs.c,v
retrieving revision 1.39
diff -u -p -r1.39 mkfs.c
--- jfsutils/mkfs/mkfs.c	16 Mar 2005 18:09:28 -0000	1.39
+++ jfsutils/mkfs/mkfs.c	29 Jun 2005 21:32:10 -0000
@@ -699,7 +699,7 @@ int main(int argc, char *argv[])
 	int64_t number_of_blocks, logloc = 0, logsize_in_bytes = 0;
 	int64_t requested_blocks = 0;
 	char logdev[255] = { '\0' };	/* Need to use a macro for this size */
-	int aggr_block_size = 0;
+	int aggr_block_size = PSIZE;	/* 4096 */
 	int phys_block_size = PBSIZE, logsize = 0;
 	int dev_handle;
 	unsigned type_commit = JFS_GROUPCOMMIT;
@@ -805,6 +805,7 @@ int main(int argc, char *argv[])
 	 */
 	if (ext_journal_opt == create_journal_only) {
 		strcpy(logdev, argv[optind]);
+		goto format_journal;
 	}
 
 	optind++;
@@ -853,12 +854,7 @@ int main(int argc, char *argv[])
 		return (ERROR_FILE_NOT_FOUND);
 	}
 
-	/*
-	 * Check if aggr_block_size was specified.  If not, we make it 4K.
-	 */
-	if (aggr_block_size == 0) {
-		aggr_block_size = PSIZE;	/* 4096 */
-	} else if (aggr_block_size < phys_block_size) {
+	if (aggr_block_size < phys_block_size) {
 		/*
 		 * Make sure the aggr_block_size is not smaller than the 
 		 * logical volume block size.
@@ -979,6 +975,7 @@ int main(int argc, char *argv[])
 	if (logdev[0] != '\0') {
 		int fd;
 
+format_journal:
 		/* A log device was specified on the command line.  Call 
 		   * jfs_logform() to initialize the log */
 		fd = open(logdev, LogOpenMode, 0);

Reply via email to