From: Li Dongyang <dongyangli@ddn.com>
To: "linux-ext4@vger.kernel.org" <linux-ext4@vger.kernel.org>
Cc: "adilger@dilger.ca" <adilger@dilger.ca>
Subject: [PATCH v3 5/5] ext4: record overhead in super block
Date: Wed, 20 Nov 2019 04:35:29 +0000 [thread overview]
Message-ID: <20191120043448.249988-5-dongyangli@ddn.com> (raw)
In-Reply-To: <20191120043448.249988-1-dongyangli@ddn.com>
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@ddn.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
next prev parent reply other threads:[~2019-11-20 4:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-20 4:35 [PATCH v3 1/5] libext2fs: optimize ext2fs_convert_subcluster_bitmap() Li Dongyang
2019-11-20 4:35 ` [PATCH v3 2/5] mke2fs: fix setting bad blocks in the block bitmap Li Dongyang
2019-12-31 3:47 ` Theodore Y. Ts'o
2019-11-20 4:35 ` [PATCH v3 3/5] ext2fs: rename "s_overhead_blocks" to "s_overhead_clusters" Li Dongyang
2020-01-27 3:05 ` Theodore Y. Ts'o
2019-11-20 4:35 ` [PATCH v3 4/5] mke2fs: set overhead in super block Li Dongyang
2020-01-27 4:15 ` Theodore Y. Ts'o
2019-11-20 4:35 ` Li Dongyang [this message]
2020-01-27 2:56 ` [PATCH v3 1/5] libext2fs: optimize ext2fs_convert_subcluster_bitmap() Theodore Y. Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191120043448.249988-5-dongyangli@ddn.com \
--to=dongyangli@ddn.com \
--cc=adilger@dilger.ca \
--cc=linux-ext4@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).