linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chunguang Xu <brookxu.cn@gmail.com>
To: tytso@mit.edu, adilger.kernel@dilger.ca
Cc: linux-ext4@vger.kernel.org
Subject: [PATCH 2/8] ext4: remove redundant mb_regenerate_buddy()
Date: Wed, 21 Oct 2020 17:15:22 +0800	[thread overview]
Message-ID: <1603271728-7198-2-git-send-email-brookxu@tencent.com> (raw)
In-Reply-To: <1603271728-7198-1-git-send-email-brookxu@tencent.com>

From: Chunguang Xu <brookxu@tencent.com>

After this patch (163a203), if an abnormal bitmap is detected, we
will mark the group as corrupt, and we will not use this group in
the future. Therefore, it should be meaningless to regenerate the
buddy bitmap of this group, It might be better to delete it.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 fs/ext4/mballoc.c | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 85abbfb..22301f3 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -822,24 +822,6 @@ void ext4_mb_generate_buddy(struct super_block *sb,
 	spin_unlock(&sbi->s_bal_lock);
 }
 
-static void mb_regenerate_buddy(struct ext4_buddy *e4b)
-{
-	int count;
-	int order = 1;
-	void *buddy;
-
-	while ((buddy = mb_find_buddy(e4b, order++, &count))) {
-		ext4_set_bits(buddy, 0, count);
-	}
-	e4b->bd_info->bb_fragments = 0;
-	memset(e4b->bd_info->bb_counters, 0,
-		sizeof(*e4b->bd_info->bb_counters) *
-		(e4b->bd_sb->s_blocksize_bits + 2));
-
-	ext4_mb_generate_buddy(e4b->bd_sb, e4b->bd_buddy,
-		e4b->bd_bitmap, e4b->bd_group);
-}
-
 /* The buddy information is attached the buddy cache inode
  * for convenience. The information regarding each group
  * is loaded via ext4_mb_load_buddy. The information involve
@@ -1512,7 +1494,6 @@ static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b,
 				sb, e4b->bd_group,
 				EXT4_GROUP_INFO_BBITMAP_CORRUPT);
 		}
-		mb_regenerate_buddy(e4b);
 		goto done;
 	}
 
-- 
1.8.3.1


  reply	other threads:[~2020-10-21  9:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-21  9:15 [PATCH 1/8] ext4: use ext4_assert() to replace J_ASSERT() Chunguang Xu
2020-10-21  9:15 ` Chunguang Xu [this message]
2020-10-23 22:58   ` [PATCH 2/8] ext4: remove redundant mb_regenerate_buddy() Andreas Dilger
2020-10-21  9:15 ` [PATCH 3/8] ext4: simplify the code of mb_find_order_for_block Chunguang Xu
2020-10-23 23:07   ` Andreas Dilger
2020-10-21  9:15 ` [PATCH 4/8] ext4: add the gdt block of meta_bg to system_zone Chunguang Xu
2020-10-21  9:15 ` [PATCH 5/8] ext4: update ext4_data_block_valid related comments Chunguang Xu
2020-10-23 23:09   ` Andreas Dilger
2020-10-21  9:15 ` [PATCH 6/8] ext4: add a helper function to validate metadata block Chunguang Xu
2020-10-21  9:15 ` [PATCH 7/8] ext4: delete invalid code inside ext4_xattr_block_set() Chunguang Xu
2020-10-23 23:10   ` Andreas Dilger
2020-10-21  9:15 ` [PATCH 8/8] ext4: fix a memory leak of ext4_free_data Chunguang Xu
  -- strict thread matches above, loose matches on Subject: below --
2020-10-16  3:55 [PATCH 1/8] ext4: use ASSERT() to replace J_ASSERT() Chunguang Xu
2020-10-16  3:55 ` [PATCH 2/8] ext4: remove redundant mb_regenerate_buddy() Chunguang Xu

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=1603271728-7198-2-git-send-email-brookxu@tencent.com \
    --to=brookxu.cn@gmail.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@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).