Re: [PATCH] f2fs: skip further SIT updates for already invalidated blocks

From: Seongjae Jeong

Date: Thu Nov 12 2026 - 06:26:00 EST


> I don't see how commit a66cdd985532 ("f2fs: introduce discard_map for f2fs_trim_fs")
> introduce the bug? from the timeline, at that point there is no error handling in
> update_sit_entries() if sit bitmap is inconsistent, right?
>

Hi Chao,

Commit a66cdd985532 added the following two lines:

if (!f2fs_test_and_clear_bit(offset, se->cur_valid_map))
f2fs_bug_on(sbi, 1);
+ if (f2fs_test_and_clear_bit(offset, se->discard_map))
+ sbi->discard_blks++;

Even if the cur_valid_map bit was already clear, the added code
could still clear the discard bit and increment discard_blks if the
discard bit was set.

Since my patch skips that update for an already invalidated block,
I thought a66cdd985532 was an appropriate Fixes tag for the discard
bitmap part of the change.

Thanks,
Seongjae