f2fs: optimize error handling in redirty_blocks

Current error handling is at risk of page leaks. However, we dot't seek
any failure scenarios, just use f2fs_bug_on.

Signed-off-by: Jack Qiu <jack.qiu@huawei.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
Jack Qiu 2022-05-31 09:16:56 +08:00 committed by Jaegeuk Kim
parent 7859e97f62
commit a4a0e16dbf

View File

@ -3903,10 +3903,10 @@ static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len)
for (i = 0; i < page_len; i++, redirty_idx++) {
page = find_lock_page(mapping, redirty_idx);
if (!page) {
ret = -ENOMEM;
break;
}
/* It will never fail, when page has pinned above */
f2fs_bug_on(F2FS_I_SB(inode), !page);
set_page_dirty(page);
f2fs_put_page(page, 1);
f2fs_put_page(page, 0);