Store the overhead in super block so we don't have to calculate again during next mount. It also gets updated after online resizing. Signed-off-by: Li Dongyang <dongyangli@xxxxxxx> --- fs/ext4/resize.c | 1 + fs/ext4/super.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index c0e9aef376a7..edab58c8ff20 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -1431,6 +1431,7 @@ static void ext4_update_super(struct super_block *sb, * Update the fs overhead information */ ext4_calculate_overhead(sb); + es->s_overhead_clusters = cpu_to_le32(sbi->s_overhead); if (test_opt(sb, DEBUG)) printk(KERN_DEBUG "EXT4-fs: added group %u:" diff --git a/fs/ext4/super.c b/fs/ext4/super.c index dd654e53ba3d..c859c67cd5db 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4467,6 +4467,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) err = ext4_calculate_overhead(sb); if (err) goto failed_mount_wq; + if (!sb_rdonly(sb)) { + es->s_overhead_clusters = cpu_to_le32(sbi->s_overhead); + ext4_commit_super(sb, 1); + } } /* -- 2.24.0