[Ocfs2-tools-devel] [PATCH 3/3] mkfs.ocfs2: Disable io cache during journal format

Sunil Mushran sunil.mushran at oracle.com
Fri Apr 10 17:22:02 PDT 2009


libocfs2's io_cache performs ios in terms of blocksize. This becomes an issue
during journal format as the default journal size is 256M. And we format
multiple journals (8 is the current default).

This patch disables the io caching during journal format, allowing upto
1M writes.

Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com>
---
 mkfs.ocfs2/mkfs.c |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/mkfs.ocfs2/mkfs.c b/mkfs.ocfs2/mkfs.c
index 105b7c3..6456386 100644
--- a/mkfs.ocfs2/mkfs.c
+++ b/mkfs.ocfs2/mkfs.c
@@ -254,22 +254,25 @@ static void finish_normal_format(State *s)
 		exit(1);
 	}
 
-	ret = io_init_cache(fs->fs_io,
-			    ocfs2_extent_recs_per_eb(fs->fs_blocksize));
-	if (ret)
-		com_err(s->progname, ret,
-			"while initializing the I/O cache.  Continuing "
-			"without a cache (safe, but slower)");
-
 	if (!s->no_backup_super) {
+		ret = io_init_cache(fs->fs_io,
+				    ocfs2_extent_recs_per_eb(fs->fs_blocksize));
+		if (ret)
+			com_err(s->progname, ret,
+				"while initializing the I/O cache.  Continuing "
+				"without a cache (safe, but slower)");
+
 		if (!s->quiet)
 			printf("Writing backup superblock: ");
 
 		num = format_backup_super(s, fs);
 		if (!s->quiet)
 			printf("%d block(s)\n", num);
+
+		io_destroy_cache(fs->fs_io);
 	}
 
+	/* io cache is disabled during journal format for performance reasons */
 	if (!s->quiet)
 		printf("Formatting Journals: ");
 
@@ -278,6 +281,13 @@ static void finish_normal_format(State *s)
 	if (!s->quiet)
 		printf("done\n");
 
+	ret = io_init_cache(fs->fs_io,
+			    ocfs2_extent_recs_per_eb(fs->fs_blocksize));
+	if (ret)
+		com_err(s->progname, ret,
+			"while initializing the I/O cache.  Continuing "
+			"without a cache (safe, but slower)");
+
 	if (!s->quiet)
 		printf("Formatting slot map: ");
 
-- 
1.5.6.3




More information about the Ocfs2-tools-devel mailing list