Re: [PATCH v3 03/17] f2fs: support regular file buffered writes on large folios

From: Chao Yu

Date: Sun Oct 11 2026 - 23:01:32 EST


On 10/10/26 00:12, Nanzhe Zhao wrote:
+/*
+ * Drop the folio lock when a node was changed, then balance the
+ * filesystem and reacquire the lock.
+ *
+ * Return: true if the folio became unusable while unlocked (being
+ * truncated), false if the folio is still usable.
+ */
+static bool f2fs_folio_may_unlock_balance_fs(struct folio *folio,

f2fs_balance_fs_folio_locked() ?

@@ -4198,11 +4501,15 @@ static int f2fs_write_begin(const struct kiocb *iocb,
*foliop = folio;
+ /* Clamp the write length to the folio size. */
+ blen = min_t(unsigned int, len,
+ folio_size(folio) - offset_in_folio(folio, pos));
+
if (f2fs_is_atomic_file(inode))
err = prepare_atomic_write_begin(sbi, folio, pos, len,
&blkaddr, &need_balance);
- else
- err = prepare_write_begin(sbi, folio, pos, len,
+ else if (!folio_test_large(folio))
+ err = prepare_write_begin(sbi, folio, pos, blen,
&blkaddr, &need_balance);
if (err)
goto put_folio;
@@ -4222,7 +4529,19 @@ static int f2fs_write_begin(const struct kiocb *iocb,
f2fs_folio_wait_writeback(folio, false, true);
- if (len == folio_size(folio) || folio_test_uptodate(folio))
+ if (folio_test_large(folio)) {
+ err = prepare_large_folio_write_begin(inode,
+ folio, pos, blen);

Is it possible that we can relocate prepare_large_folio_write_begin() after

else if (!folio_test_large(folio))
err = prepare_write_begin(sbi, folio, pos, blen,
&blkaddr, &need_balance);
else
err = prepare_large_folio_write_begin(...);

Thanks,