diff options
| author | Chao Yu <chao@kernel.org> | 2025-05-12 19:54:41 +0800 |
|---|---|---|
| committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2025-05-27 23:52:35 +0000 |
| commit | 9b6fc9888e03dbe69768ace00091173b169aec39 (patch) | |
| tree | 6e65fbe75d5aa84fe35b00d512d29025b751be1f /fs/f2fs/node.c | |
| parent | f2fs: remove unused sbi argument from checksum functions (diff) | |
| download | linux-9b6fc9888e03dbe69768ace00091173b169aec39.tar.gz linux-9b6fc9888e03dbe69768ace00091173b169aec39.zip | |
f2fs: add f2fs_bug_on() to detect potential bug
Add f2fs_bug_on() to check whether memory preallocation will fail or
not after radix_tree_preload(GFP_NOFS | __GFP_NOFAIL).
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/node.c')
| -rw-r--r-- | fs/f2fs/node.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 3f6b8037d25f..88d3032236cb 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -2309,7 +2309,7 @@ static bool add_free_nid(struct f2fs_sb_info *sbi, struct f2fs_nm_info *nm_i = NM_I(sbi); struct free_nid *i, *e; struct nat_entry *ne; - int err = -EINVAL; + int err; bool ret = false; /* 0 nid should not be used */ @@ -2323,7 +2323,10 @@ static bool add_free_nid(struct f2fs_sb_info *sbi, i->nid = nid; i->state = FREE_NID; - radix_tree_preload(GFP_NOFS | __GFP_NOFAIL); + err = radix_tree_preload(GFP_NOFS | __GFP_NOFAIL); + f2fs_bug_on(sbi, err); + + err = -EINVAL; spin_lock(&nm_i->nid_list_lock); |
