[Ocfs2-tools-devel] [PATCH 07/13] libocfs2: Don't cache I/O from journal format.

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


When we're zeroing a newly formatted journal, we don't want to pollute
the I/O cache with the zeros.  Set the io_channel to nocache for the
operation.

Signed-off-by: Joel Becker <joel.becker at oracle.com>
---
 libocfs2/mkjournal.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/libocfs2/mkjournal.c b/libocfs2/mkjournal.c
index 928119d..8575c40 100644
--- a/libocfs2/mkjournal.c
+++ b/libocfs2/mkjournal.c
@@ -309,15 +309,19 @@ static errcode_t ocfs2_format_journal(ocfs2_filesys *fs,
 		goto out;
 	memset(buf, 0, BUFLEN);
 
+	io_set_nocache(fs->fs_io, true);
 	count = (uint32_t) ci->ci_inode->i_size;
 	while (count) {
 		ret = ocfs2_file_write(ci, buf, ocfs2_min((uint32_t) BUFLEN, count),
 				       offset, &wrote);
 		if (ret)
-			goto out;
+			break;
 		offset += wrote;
 		count -= wrote;
 	}
+	io_set_nocache(fs->fs_io, false);
+	if (ret)
+		goto out;
 
 	jrnl_blocks = ocfs2_clusters_to_blocks(fs, ci->ci_inode->i_clusters);
 	ret = ocfs2_create_journal_superblock(fs, jrnl_blocks, features,
-- 
1.6.3




More information about the Ocfs2-tools-devel mailing list