ext4: preload block group descriptors
authorAndrew Perepechko <andrew.perepechko@seagate.com>
Sun, 30 Apr 2017 04:46:35 +0000 (00:46 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 30 Apr 2017 04:46:35 +0000 (00:46 -0400)
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>
fs/ext4/super.c

index 9ec8963ba6049a20009b77465f1d607b0238e8f2..9a40e0c16dcc770ca2a96493ff49e95914d8e3be 100644 (file)
@@ -3879,6 +3879,12 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 
        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++) {
                block = descriptor_loc(sb, logical_sb_block, i);
                sbi->s_group_desc[i] = sb_bread_unmovable(sb, block);