[Ocfs2-tools-devel] [PATCH 09/13] mkfs.ocfs2: Keep the I/O cache across the journal format

Joel Becker joel.becker at oracle.com
Tue May 26 16:03:29 PDT 2009


Now that the journal format knows not to pollute the cache, let's just
keep the cache around.  While we're at it, make sure the cache is big
enough to hold a suballocator and then some.

Signed-off-by: Joel Becker <joel.becker at oracle.com>
---
 mkfs.ocfs2/mkfs.c |   37 ++++++++-----------------------------
 1 files changed, 8 insertions(+), 29 deletions(-)

diff --git a/mkfs.ocfs2/mkfs.c b/mkfs.ocfs2/mkfs.c
index 048f70f..ef75a37 100644
--- a/mkfs.ocfs2/mkfs.c
+++ b/mkfs.ocfs2/mkfs.c
@@ -239,11 +239,7 @@ static void finish_normal_format(State *s)
 	int num;
 	ocfs2_filesys *fs;
 
-	/* These routines use libocfs2 to do their work. We
-	 * don't share an ocfs2_filesys context between the
-	 * journal format and the lost+found create so that
-	 * the library can use the journal for the latter in
-	 * future revisions. */
+	/* These routines use libocfs2 to do their work. */
 
 	ret = ocfs2_open(s->device_name, OCFS2_FLAG_RW, 0, 0, &fs);
 	if (ret) {
@@ -254,53 +250,36 @@ static void finish_normal_format(State *s)
 		exit(1);
 	}
 
-	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)");
+	/* 8MB should cover an allocator and some other stuff */
+	ret = io_init_cache_size(fs->fs_io, 8 * 1024 * 1024);
+	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) {
 		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: ");
-
 	format_journals(s, fs);
-
 	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: ");
-
 	format_slotmap(s, fs);
-
 	if (!s->quiet)
 		printf("done\n");
 
 	if (!s->quiet)
 		printf("Writing lost+found: ");
-
 	create_lost_found_dir(s, fs);
-
 	if (!s->quiet)
 		printf("done\n");
 
-- 
1.6.3




More information about the Ocfs2-tools-devel mailing list