[RFC PATCH 0/2] Implement concurrent buffered write with folio lock

From: Chi Zhiling
Date: Fri Apr 25 2025 - 06:58:46 EST


From: Chi Zhiling <chizhiling@xxxxxxxxxx>

This is a patch attempting to implement concurrent buffered writes.
The main idea is to use the folio lock to ensure the atomicity of the
write when writing to a single folio, instead of using the i_rwsem.

I tried the "folio batch" solution, which is a great idea, but during
testing, I encountered an OOM issue because the locked folios couldn't
be reclaimed.

So for now, I can only allow concurrent writes within a single block.
The good news is that since we already support BS > PS, we can use a
larger block size to enable higher granularity concurrency.

These ideas come from previous discussions:
https://lore.kernel.org/all/953b0499-5832-49dc-8580-436cf625db8c@xxxxxxx/


Chi Zhiling (2):
xfs: Add i_direct_mode to indicate the IO mode of inode
xfs: Enable concurrency when writing within single block

fs/xfs/xfs_file.c | 71 ++++++++++++++++++++++++++++++++++++++++++----
fs/xfs/xfs_inode.h | 6 ++++
2 files changed, 72 insertions(+), 5 deletions(-)

--
2.43.0