From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Chao Yu <chao@kernel.org>, wallentx <william.allentx@gmail.com>,
Jaegeuk Kim <jaegeuk@kernel.org>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.18.y 1/4] Revert: "f2fs: check in-memory block bitmap"
Date: Sat, 12 Sep 2026 07:16:50 -0400 [thread overview]
Message-ID: <20260912111653.2276190-1-sashal@kernel.org> (raw)
In-Reply-To: <2026090944-reprint-spruce-0599@gregkh>
From: Chao Yu <chao@kernel.org>
[ Upstream commit a2b251259bf2bdf550893bac078e9ce0a10e76c9 ]
Commit 355e78913c0d ("f2fs: check in-memory block bitmap") added
a mirror for valid block bitmap, it expects to detect in-memory
corruption, however we never got any reports from the check points
for almost decade, let's remove the code, it can help to save
memories.
Cc: wallentx <william.allentx@gmail.com>
Suggested-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Stable-dep-of: 2b8704b6a8b2 ("f2fs: fix to reset all pinned status during fggc")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/f2fs/segment.c | 38 --------------------------------------
fs/f2fs/segment.h | 6 ------
2 files changed, 44 deletions(-)
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 5e2789cd96b5e..b39dcf8973a10 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2459,9 +2459,6 @@ static int update_sit_entry_for_release(struct f2fs_sb_info *sbi, struct seg_ent
unsigned int segno, block_t blkaddr, unsigned int offset, int del)
{
bool exist;
-#ifdef CONFIG_F2FS_CHECK_FS
- bool mir_exist;
-#endif
int i;
int del_count = -del;
@@ -2469,15 +2466,6 @@ static int update_sit_entry_for_release(struct f2fs_sb_info *sbi, struct seg_ent
for (i = 0; i < del_count; i++) {
exist = f2fs_test_and_clear_bit(offset + i, se->cur_valid_map);
-#ifdef CONFIG_F2FS_CHECK_FS
- mir_exist = f2fs_test_and_clear_bit(offset + i,
- se->cur_valid_map_mir);
- if (unlikely(exist != mir_exist)) {
- f2fs_err(sbi, "Inconsistent error when clearing bitmap, blk:%u, old bit:%d",
- blkaddr + i, exist);
- f2fs_bug_on(sbi, 1);
- }
-#endif
if (unlikely(!exist)) {
f2fs_err(sbi, "Bitmap was wrongly cleared, blk:%u", blkaddr + i);
f2fs_bug_on(sbi, 1);
@@ -2518,20 +2506,8 @@ static int update_sit_entry_for_alloc(struct f2fs_sb_info *sbi, struct seg_entry
unsigned int segno, block_t blkaddr, unsigned int offset, int del)
{
bool exist;
-#ifdef CONFIG_F2FS_CHECK_FS
- bool mir_exist;
-#endif
exist = f2fs_test_and_set_bit(offset, se->cur_valid_map);
-#ifdef CONFIG_F2FS_CHECK_FS
- mir_exist = f2fs_test_and_set_bit(offset,
- se->cur_valid_map_mir);
- if (unlikely(exist != mir_exist)) {
- f2fs_err(sbi, "Inconsistent error when setting bitmap, blk:%u, old bit:%d",
- blkaddr, exist);
- f2fs_bug_on(sbi, 1);
- }
-#endif
if (unlikely(exist)) {
f2fs_err(sbi, "Bitmap was wrongly set, blk:%u", blkaddr);
f2fs_bug_on(sbi, 1);
@@ -4759,11 +4735,6 @@ void f2fs_flush_sit_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc)
int offset, sit_offset;
se = get_seg_entry(sbi, segno);
-#ifdef CONFIG_F2FS_CHECK_FS
- if (memcmp(se->cur_valid_map, se->cur_valid_map_mir,
- SIT_VBLOCK_MAP_SIZE))
- f2fs_bug_on(sbi, 1);
-#endif
/* add discard candidates */
if (!(cpc->reason & CP_DISCARD)) {
@@ -4854,11 +4825,7 @@ static int build_sit_info(struct f2fs_sb_info *sbi)
if (!sit_i->dirty_sentries_bitmap)
return -ENOMEM;
-#ifdef CONFIG_F2FS_CHECK_FS
- bitmap_size = MAIN_SEGS(sbi) * SIT_VBLOCK_MAP_SIZE * (3 + discard_map);
-#else
bitmap_size = MAIN_SEGS(sbi) * SIT_VBLOCK_MAP_SIZE * (2 + discard_map);
-#endif
sit_i->bitmap = f2fs_kvzalloc(sbi, bitmap_size, GFP_KERNEL);
if (!sit_i->bitmap)
return -ENOMEM;
@@ -4872,11 +4839,6 @@ static int build_sit_info(struct f2fs_sb_info *sbi)
sit_i->sentries[start].ckpt_valid_map = bitmap;
bitmap += SIT_VBLOCK_MAP_SIZE;
-#ifdef CONFIG_F2FS_CHECK_FS
- sit_i->sentries[start].cur_valid_map_mir = bitmap;
- bitmap += SIT_VBLOCK_MAP_SIZE;
-#endif
-
if (discard_map) {
sit_i->sentries[start].discard_map = bitmap;
bitmap += SIT_VBLOCK_MAP_SIZE;
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index d05d133c89aff..21ada383f19a4 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -172,9 +172,6 @@ struct seg_entry {
unsigned int ckpt_valid_blocks:10; /* # of valid blocks last cp */
unsigned int padding:6; /* padding */
unsigned char *cur_valid_map; /* validity bitmap of blocks */
-#ifdef CONFIG_F2FS_CHECK_FS
- unsigned char *cur_valid_map_mir; /* mirror of current valid bitmap */
-#endif
/*
* # of valid blocks and the validity bitmap stored in the last
* checkpoint pack. This information is used by the SSR mode.
@@ -403,9 +400,6 @@ static inline void seg_info_from_raw_sit(struct seg_entry *se,
se->ckpt_valid_blocks = GET_SIT_VBLOCKS(rs);
memcpy(se->cur_valid_map, rs->valid_map, SIT_VBLOCK_MAP_SIZE);
memcpy(se->ckpt_valid_map, rs->valid_map, SIT_VBLOCK_MAP_SIZE);
-#ifdef CONFIG_F2FS_CHECK_FS
- memcpy(se->cur_valid_map_mir, rs->valid_map, SIT_VBLOCK_MAP_SIZE);
-#endif
se->type = GET_SIT_TYPE(rs);
se->mtime = le64_to_cpu(rs->mtime);
}
--
2.53.0
next prev parent reply other threads:[~2026-09-12 11:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 11:28 FAILED: patch "[PATCH] f2fs: fix to reset all pinned status during fggc" failed to apply to 6.18-stable tree gregkh
2026-09-12 11:16 ` Sasha Levin [this message]
2026-09-12 11:16 ` [PATCH 6.18.y 2/4] f2fs: reject setattr size changes on large folio files Sasha Levin
2026-09-12 11:16 ` [PATCH 6.18.y 3/4] f2fs: fix to reclaim space in f2fs_allocate_pinning_section() Sasha Levin
2026-09-12 11:16 ` [PATCH 6.18.y 4/4] f2fs: fix to reset all pinned status during fggc Sasha Levin
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=20260912111653.2276190-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=stable@vger.kernel.org \
--cc=william.allentx@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.