f2fs: fix to check return value of f2fs_reserve_new_block()
authorChao Yu <chao@kernel.org>
Thu, 16 Nov 2023 06:25:56 +0000 (14:25 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Feb 2024 20:14:25 +0000 (20:14 +0000)
commit2a7b12d4705bc308cf18eae2b69ec8db34881cc3
tree45ce8f4c2dab9500315bb981934da960d7c27f6e
parent9916fdd8a29aa0366f93635502bb718de4ef8192
f2fs: fix to check return value of f2fs_reserve_new_block()

[ Upstream commit 956fa1ddc132e028f3b7d4cf17e6bfc8cb36c7fd ]

Let's check return value of f2fs_reserve_new_block() in do_recover_data()
rather than letting it fails silently.

Also refactoring check condition on return value of f2fs_reserve_new_block()
as below:
- trigger f2fs_bug_on() only for ENOSPC case;
- use do-while statement to avoid redundant codes;

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/recovery.c