summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2025-05-08 07:14:31 +0200
committerJaegeuk Kim <jaegeuk@kernel.org>2025-05-08 15:23:31 +0000
commit0638f28b30621012ee4dac014b58c5a9588e65b1 (patch)
tree28172b90c93bf5eceb29c0e0ee1e1cf31cc84949
parent84c5d16711a300949cfec83e76299a75b4cdf04a (diff)
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>
-rw-r--r--fs/f2fs/node.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index f6e98c9fac95..cbc7e9997b74 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1871,31 +1871,30 @@ continue_unlock:
if (!folio_clear_dirty_for_io(folio))
goto continue_unlock;
- ret = __write_node_folio(folio, atomic &&
+ if (__write_node_folio(folio, atomic &&
folio == last_folio,
&submitted, wbc, true,
- FS_NODE_IO, seq_id);
- if (ret) {
+ FS_NODE_IO, seq_id)) {
folio_unlock(folio);
f2fs_folio_put(last_folio, false);
- break;
- } else if (submitted) {
- nwritten++;
+ folio_batch_release(&fbatch);
+ ret = -EIO;
+ goto out;
}
+ if (submitted)
+ nwritten++;
if (folio == last_folio) {
f2fs_folio_put(folio, false);
+ folio_batch_release(&fbatch);
marked = true;
- break;
+ goto out;
}
}
folio_batch_release(&fbatch);
cond_resched();
-
- if (ret || marked)
- break;
}
- if (!ret && atomic && !marked) {
+ if (atomic && !marked) {
f2fs_debug(sbi, "Retry to write fsync mark: ino=%u, idx=%lx",
ino, last_folio->index);
folio_lock(last_folio);
@@ -1907,7 +1906,7 @@ continue_unlock:
out:
if (nwritten)
f2fs_submit_merged_write_cond(sbi, NULL, NULL, ino, NODE);
- return ret ? -EIO : 0;
+ return ret;
}
static int f2fs_match_ino(struct inode *inode, unsigned long ino, void *data)