From b44aec24e65d1bb38908c4cb5becbe6a5f9c74ef Mon Sep 17 00:00:00 2001 From: Alexey Lyashkov Date: Sat, 18 Feb 2017 23:28:27 +0300 Subject: [PATCH] LU-9160 libext2: readahead for meta_bg There are ~37k random IOs with meta_bg option on a 300T target. It takes something like 20min to finish a simple debugfs start. Enabling RA for meta blocks saves time dramatically and it needs just 12s to start debugfs. Seagate-bug-id: MRP-4159 Change-Id: I6ed500d2068b16c1a5ff3fd281ae88bcbb780bf2 Signed-off-by: Alexey Lyashkov Reviewed-on: https://review.whamcloud.com/25648 Reviewed-by: Andreas Dilger Reviewed-by: Niu Yawei Tested-by: Jenkins Tested-by: Maloo --- lib/ext2fs/openfs.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c index ba501e6..95f06a0 100644 --- a/lib/ext2fs/openfs.c +++ b/lib/ext2fs/openfs.c @@ -392,20 +392,26 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, goto cleanup; #ifdef WORDS_BIGENDIAN gdp = (struct ext2_group_desc *) dest; - for (j=0; j < groups_per_block*first_meta_bg; j++) { + for (j = 0; j < groups_per_block * first_meta_bg; j++) { gdp = ext2fs_group_desc(fs, fs->group_desc, j); ext2fs_swap_group_desc2(fs, gdp); } #endif dest += fs->blocksize*first_meta_bg; } - for (i=first_meta_bg ; i < fs->desc_blocks; i++) { + + for (i = first_meta_bg; i < fs->desc_blocks; i++) { + blk = ext2fs_descriptor_block_loc2(fs, group_block, i); + io_channel_cache_readahead(fs->io, blk, 1); + } + + for (i = first_meta_bg; i < fs->desc_blocks; i++) { blk = ext2fs_descriptor_block_loc2(fs, group_block, i); retval = io_channel_read_blk64(fs->io, blk, 1, dest); if (retval) goto cleanup; #ifdef WORDS_BIGENDIAN - for (j=0; j < groups_per_block; j++) { + for (j = 0; j < groups_per_block; j++) { gdp = ext2fs_group_desc(fs, fs->group_desc, i * groups_per_block + j); ext2fs_swap_group_desc2(fs, gdp); -- 1.8.3.1