浏览代码

ext4: preload block group descriptors

With enabled meta_bg option block group descriptors
reading IO is not sequential and requires optimization.

Signed-off-by: Andrew Perepechko <andrew.perepechko@seagate.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andrew Perepechko 8 年之前
父节点
当前提交
85c8f176a6
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      fs/ext4/super.c

+ 6 - 0
fs/ext4/super.c

@@ -3879,6 +3879,12 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 
 
 	bgl_lock_init(sbi->s_blockgroup_lock);
 	bgl_lock_init(sbi->s_blockgroup_lock);
 
 
+	/* Pre-read the descriptors into the buffer cache */
+	for (i = 0; i < db_count; i++) {
+		block = descriptor_loc(sb, logical_sb_block, i);
+		sb_breadahead(sb, block);
+	}
+
 	for (i = 0; i < db_count; i++) {
 	for (i = 0; i < db_count; i++) {
 		block = descriptor_loc(sb, logical_sb_block, i);
 		block = descriptor_loc(sb, logical_sb_block, i);
 		sbi->s_group_desc[i] = sb_bread_unmovable(sb, block);
 		sbi->s_group_desc[i] = sb_bread_unmovable(sb, block);