[Ocfs2-tools-devel] [PATCH 06/11] libocfs2: Increase the buffer size in ocfs2_open_inode_scan()
Sunil Mushran
sunil.mushran at oracle.com
Thu Sep 22 19:04:34 PDT 2011
ocfs2_open_inode_scan() is used by utilities that are looking to read all
the inodes. This patch increases the buffer from one cluster to 4MB to improve
the performance of pass 1 in fsck.
The test was run on a 2TB volume having 15M files. The cache size was 820MB.
Pass 1: Checking inodes and blocks
Before:
I/O read disk/cache: 64698MB / 66MB, write: 0MB, rate: 17.15MB/s
Times real: 3775.640s, user: 218.995s, sys: 55.703s
After:
I/O read disk/cache: 64698MB / 66MB, write: 0MB, rate: 37.28MB/s
Times real: 1737.086s, user: 193.295s, sys: 25.405s
Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com>
---
libocfs2/inode_scan.c | 18 +++++++-----------
1 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/libocfs2/inode_scan.c b/libocfs2/inode_scan.c
index d215f56..317fc64 100644
--- a/libocfs2/inode_scan.c
+++ b/libocfs2/inode_scan.c
@@ -331,17 +331,13 @@ errcode_t ocfs2_open_inode_scan(ocfs2_filesys *fs,
if (ret)
goto out_scan;
- /* Minimum 8 inodes in the buffer */
- scan->buffer_blocks = fs->fs_clustersize / fs->fs_blocksize;
- if (scan->buffer_blocks < 8) {
- scan->buffer_blocks =
- ((8 * fs->fs_blocksize) +
- (fs->fs_clustersize - 1)) /
- fs->fs_clustersize;
- scan->buffer_blocks =
- ocfs2_clusters_to_blocks(fs,
- scan->buffer_blocks);
- }
+ /*
+ * Ideally the buffer size should be one cpg. But finding that value
+ * is not worth the effort. Instead we default to 4MB, which is a
+ * typical value in most ocfs2 file systems.
+ */
+#define OPEN_SCAN_BUFFER_SIZE (4 * 1024 * 1024)
+ scan->buffer_blocks = OPEN_SCAN_BUFFER_SIZE / fs->fs_blocksize;
ret = ocfs2_malloc_blocks(fs->fs_io, scan->buffer_blocks,
&scan->group_buffer);
--
1.7.4.1
More information about the Ocfs2-tools-devel
mailing list