[PATCH v2 0/4] erofs: file-backed mount supports direct io

Hongbo Li lihongbo22 at huawei.com
Wed Feb 12 00:53:27 AEDT 2025


erofs has add file-backed mount support. In this scenario, only buffer
io is allowed. So we enhance the io mode by implementing the direct
io. Also, this can make the iov_iter (user buffer) interact with the
backed file's page cache directly.

To be mentioned, the direct io is atomic, if the part of the iov_iter
of direct io failed, the whole direct io also fails.

We conduct the basic test on direct io and normal io, the fio is used in
the test, the results show it can decrease the memory overhead. It slower
than normal io in seq read due to erofs page cache and readahead, uut in
rand read direct io is similar than buffer io. The results are reasonable.

v2:
  - Reuse the original erofs_fileio_scan_folio logic and do some construction.

v1:
  - https://lore.kernel.org/all/47f74598-1b2f-4308-a8b8-18fc40bafe6d@linux.alibaba.com/T/

Comments and questions are, as always, welcome.

Thanks,
Hongbo.

Hongbo Li (4):
  erofs: decouple the iterator on folio
  erofs: decouple callback action for fileio bio
  erofs: add erofs_fileio_direct_io helper to handle direct io
  erofs: file-backed mount supports direct io

 fs/erofs/data.c   |  10 ++-
 fs/erofs/fileio.c | 170 ++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 148 insertions(+), 32 deletions(-)

-- 
2.34.1



More information about the Linux-erofs mailing list