[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191120043448.249988-5-dongyangli@ddn.com>
Date: Wed, 20 Nov 2019 04:35:29 +0000
From: Li Dongyang <dongyangli@....com>
To: "linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>
CC: "adilger@...ger.ca" <adilger@...ger.ca>
Subject: [PATCH v3 5/5] ext4: record overhead in super block
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@....com>
---
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
Powered by blists - more mailing lists