linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 v3 12/13] ext4: remove unnecessary check to avoid repeat update_backups for the same gdb
Date: Sun, 27 Aug 2023 01:47:11 +0800	[thread overview]
Message-ID: <20230826174712.4059355-13-shikemeng@huaweicloud.com> (raw)
In-Reply-To: <20230826174712.4059355-1-shikemeng@huaweicloud.com>

The sbi->s_group_desc contains array of bh's for block group descriptors
and continuous EXT4_DESC_PER_BLOCK(sb) bg descriptors in single block
share the same bh.
Simply call update_backups for each gdb_bh in sbi->s_group_desc will not
update same group descriptors block for multiple times.

Commit 0acdb8876fead ("ext4: don't call update_backups() multiple times for
the same bg") wrongly assumed each block group descriptor in the same block
has a individual bh and unnecessary check was added.

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
 fs/ext4/ext4.h   | 1 +
 fs/ext4/resize.c | 4 ----
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 84618c46f239..37ac39711cd1 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1488,6 +1488,7 @@ struct ext4_sb_info {
 	loff_t s_bitmap_maxbytes;	/* max bytes for bitmap files */
 	struct buffer_head * s_sbh;	/* Buffer containing the super block */
 	struct ext4_super_block *s_es;	/* Pointer to the super block in the buffer */
+	/* Array of bh's for the block group descriptors */
 	struct buffer_head * __rcu *s_group_desc;
 	unsigned int s_mount_opt;
 	unsigned int s_mount_opt2;
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 5e9084ff131c..718b47e131e4 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -1588,7 +1588,6 @@ static int ext4_flex_group_add(struct super_block *sb,
 		int meta_bg = ext4_has_feature_meta_bg(sb);
 		sector_t padding_blocks = meta_bg ? 0 : sbi->s_sbh->b_blocknr -
 					 ext4_group_first_block_no(sb, 0);
-		sector_t old_gdb = 0;
 
 		update_backups(sb, ext4_group_first_block_no(sb, 0),
 			       (char *)es, sizeof(struct ext4_super_block), 0);
@@ -1597,11 +1596,8 @@ static int ext4_flex_group_add(struct super_block *sb,
 
 			gdb_bh = sbi_array_rcu_deref(sbi, s_group_desc,
 						     gdb_num);
-			if (old_gdb == gdb_bh->b_blocknr)
-				continue;
 			update_backups(sb, gdb_bh->b_blocknr - padding_blocks,
 				       gdb_bh->b_data, gdb_bh->b_size, meta_bg);
-			old_gdb = gdb_bh->b_blocknr;
 		}
 	}
 exit:
-- 
2.30.0


  parent reply	other threads:[~2023-08-26  9:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-26 17:46 [PATCH v3 00/13] fixes and cleanups to ext4 resize Kemeng Shi
2023-08-26 17:47 ` [PATCH v3 01/13] ext4: correct offset of gdb backup in non meta_bg group to update_backups Kemeng Shi
2023-08-26 17:47 ` [PATCH v3 02/13] ext4: add missed brelse in update_backups Kemeng Shi
2023-08-26 17:47 ` [PATCH v3 03/13] ext4: correct return value of ext4_convert_meta_bg Kemeng Shi
2023-08-26 17:47 ` [PATCH v3 04/13] ext4: remove gdb backup copy for meta bg in setup_new_flex_group_blocks Kemeng Shi
2023-08-26 17:47 ` [PATCH v3 05/13] ext4: fix typo " Kemeng Shi
2023-08-26 17:47 ` [PATCH v3 06/13] ext4: remove redundant check of count Kemeng Shi
2023-08-26 17:47 ` [PATCH v3 07/13] ext4: remove commented code in reserve_backup_gdb Kemeng Shi
2023-08-26 17:47 ` [PATCH v3 08/13] ext4: calculate free_clusters_count in cluster unit in verify_group_input Kemeng Shi
2023-08-26 17:47 ` [PATCH v3 09/13] ext4: remove EXT4FS_DEBUG defination in resize.c Kemeng Shi
2023-08-26 17:47 ` [PATCH v3 10/13] ext4: use saved local variable sbi instead of EXT4_SB(sb) Kemeng Shi
2023-08-26 17:47 ` [PATCH v3 11/13] ext4: simplify the gdbblock calculation in add_new_gdb_meta_bg Kemeng Shi
2023-08-26 17:47 ` Kemeng Shi [this message]
2023-08-26 17:47 ` [PATCH v3 13/13] ext4: remove unnecessary initialization of count2 in set_flexbg_block_bitmap Kemeng Shi
2023-10-06 18:06 ` [PATCH v3 00/13] fixes and cleanups to ext4 resize Theodore 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=20230826174712.4059355-13-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).