Skip to content

Commit 0638f28

Browse files
Christoph HellwigJaegeuk Kim
authored andcommitted
f2fs: simplify return value handling in f2fs_fsync_node_pages
Always assign ret where the error happens, and jump to out instead of multiple loop exit conditions to prepare for changes in the __write_node_folio calling convention. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 84c5d16 commit 0638f28

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

fs/f2fs/node.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,31 +1871,30 @@ int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode,
18711871
if (!folio_clear_dirty_for_io(folio))
18721872
goto continue_unlock;
18731873

1874-
ret = __write_node_folio(folio, atomic &&
1874+
if (__write_node_folio(folio, atomic &&
18751875
folio == last_folio,
18761876
&submitted, wbc, true,
1877-
FS_NODE_IO, seq_id);
1878-
if (ret) {
1877+
FS_NODE_IO, seq_id)) {
18791878
folio_unlock(folio);
18801879
f2fs_folio_put(last_folio, false);
1881-
break;
1882-
} else if (submitted) {
1883-
nwritten++;
1880+
folio_batch_release(&fbatch);
1881+
ret = -EIO;
1882+
goto out;
18841883
}
1884+
if (submitted)
1885+
nwritten++;
18851886

18861887
if (folio == last_folio) {
18871888
f2fs_folio_put(folio, false);
1889+
folio_batch_release(&fbatch);
18881890
marked = true;
1889-
break;
1891+
goto out;
18901892
}
18911893
}
18921894
folio_batch_release(&fbatch);
18931895
cond_resched();
1894-
1895-
if (ret || marked)
1896-
break;
18971896
}
1898-
if (!ret && atomic && !marked) {
1897+
if (atomic && !marked) {
18991898
f2fs_debug(sbi, "Retry to write fsync mark: ino=%u, idx=%lx",
19001899
ino, last_folio->index);
19011900
folio_lock(last_folio);
@@ -1907,7 +1906,7 @@ int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode,
19071906
out:
19081907
if (nwritten)
19091908
f2fs_submit_merged_write_cond(sbi, NULL, NULL, ino, NODE);
1910-
return ret ? -EIO : 0;
1909+
return ret;
19111910
}
19121911

19131912
static int f2fs_match_ino(struct inode *inode, unsigned long ino, void *data)

0 commit comments

Comments
 (0)