[PATCH 1/2] f2fs: simplify node footer check in f2fs_cache_write_end_io
From: Zhiguo Niu
Date: Wed Sep 23 2026 - 21:54:28 EST
In f2fs_cache_write_end_io(), the return value of
f2fs_sanity_check_node_footer() was ignored and a separate
f2fs_bug_on() only verified the node index. Pass the sanity
check result directly into f2fs_bug_on() so that a corrupted
node footer triggers the assertion, and drop the redundant
index check.
Signed-off-by: Zhiguo Niu <zhiguo.niu@xxxxxxxxxx>
---
fs/f2fs/data.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 6d4ba5e77906..f203f99fc10a 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -424,9 +424,8 @@ static void f2fs_cache_write_end_io(struct bio *bio)
entry->next_entry = NULL;
if (f2fs_is_node_cache(entry)) {
- f2fs_sanity_check_node_footer(sbi, entry,
- entry->index, NODE_TYPE_REGULAR, true);
- f2fs_bug_on(sbi, entry->index != nid_of_node(sbi, entry));
+ f2fs_bug_on(sbi, f2fs_sanity_check_node_footer(sbi,
+ entry, entry->index, NODE_TYPE_REGULAR, true));
}
if (f2fs_in_warm_node_list(sbi, entry))
f2fs_del_fsync_node_entry(sbi, entry);
--
2.43.0