From: Kemeng Shi <shikemeng@huaweicloud.com>
To: tytso@mit.edu, adilger.kernel@dilger.ca,
linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 11/13] ext4: simplify the gdbblock calculation in add_new_gdb_meta_bg
Date: Sun, 27 Aug 2023 01:37:33 +0800 [thread overview]
Message-ID: <20230826173735.4023594-12-shikemeng@huaweicloud.com> (raw)
In-Reply-To: <20230826173735.4023594-1-shikemeng@huaweicloud.com>
We always call add_new_gdb_meta_bg with first group in mete_bg. Remove the
unnecessary ext4_meta_bg_first_group conversion to simplify the gdbblock
calculation.
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
fs/ext4/resize.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index e2c81b589de8..4dc68400ba19 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -110,12 +110,6 @@ static ext4_group_t ext4_meta_bg_first_group(struct super_block *sb,
EXT4_DESC_PER_BLOCK_BITS(sb);
}
-static ext4_fsblk_t ext4_meta_bg_first_block_no(struct super_block *sb,
- ext4_group_t group) {
- group = ext4_meta_bg_first_group(sb, group);
- return ext4_group_first_block_no(sb, group);
-}
-
static ext4_grpblk_t ext4_group_overhead_blocks(struct super_block *sb,
ext4_group_t group) {
ext4_grpblk_t overhead;
@@ -944,7 +938,13 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
}
/*
- * add_new_gdb_meta_bg is the sister of add_new_gdb.
+ * If there is no available space in the existing block group descriptors for
+ * the new block group and there are no reserved block group descriptors, then
+ * the meta_bg feature will get enabled, and es->s_first_meta_bg will get set
+ * to the first block group that is managed using meta_bg and s_first_meta_bg
+ * must be a multiple of EXT4_DESC_PER_BLOCK(sb).
+ * This function will be called when first group of meta_bg is added to bring
+ * new group descriptors block of new added meta_bg.
*/
static int add_new_gdb_meta_bg(struct super_block *sb,
handle_t *handle, ext4_group_t group) {
@@ -954,8 +954,8 @@ static int add_new_gdb_meta_bg(struct super_block *sb,
unsigned long gdb_num = group / EXT4_DESC_PER_BLOCK(sb);
int err;
- gdblock = ext4_meta_bg_first_block_no(sb, group) +
- ext4_bg_has_super(sb, group);
+ gdblock = ext4_group_first_block_no(sb, group) +
+ ext4_bg_has_super(sb, group);
gdb_bh = ext4_sb_bread(sb, gdblock, 0);
if (IS_ERR(gdb_bh))
return PTR_ERR(gdb_bh);
--
2.30.0
next prev parent reply other threads:[~2023-08-26 9:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-26 17:37 [PATCH v2 00/13] fixes and cleanups to ext4 resize Kemeng Shi
2023-08-26 9:48 ` Kemeng Shi
2023-08-26 17:37 ` [PATCH v2 01/13] ext4: correct offset of gdb backup in non meta_bg group to update_backups Kemeng Shi
2023-08-26 17:37 ` [PATCH v2 02/13] ext4: add missed brelse in update_backups Kemeng Shi
2023-08-26 17:37 ` [PATCH v2 03/13] ext4: correct return value of ext4_convert_meta_bg Kemeng Shi
2023-08-26 17:37 ` [PATCH v2 04/13] ext4: remove gdb backup copy for meta bg in setup_new_flex_group_blocks Kemeng Shi
2023-08-26 17:37 ` [PATCH v2 05/13] ext4: fix typo " Kemeng Shi
2023-08-26 17:37 ` [PATCH v2 06/13] ext4: remove redundant check of count Kemeng Shi
2023-08-26 17:37 ` [PATCH v2 07/13] ext4: remove commented code in reserve_backup_gdb Kemeng Shi
2023-08-26 17:37 ` [PATCH v2 08/13] ext4: calculate free_clusters_count in cluster unit in verify_group_input Kemeng Shi
2023-08-26 17:37 ` [PATCH v2 09/13] ext4: remove EXT4FS_DEBUG defination in resize.c Kemeng Shi
2023-08-26 17:37 ` [PATCH v2 10/13] ext4: use saved local variable sbi instead of EXT4_SB(sb) Kemeng Shi
2023-08-26 17:37 ` Kemeng Shi [this message]
2023-08-26 17:37 ` [PATCH v2 12/13] ext4: remove unnecessary check to avoid repeat update_backups for the same gdb Kemeng Shi
2023-08-26 17:37 ` [PATCH v2 13/13] ext4: remove unnecessary initialization of count2 in set_flexbg_block_bitmap Kemeng Shi
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=20230826173735.4023594-12-shikemeng@huaweicloud.com \
--to=shikemeng@huaweicloud.com \
--cc=adilger.kernel@dilger.ca \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
/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).