Skip to content

RFC mm/filemap: split out folio wait and VFS code

Tal Zussman io-uring linux-fsdevel linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected] change-id 20260511-filemap-split-871b5c18e98c

Versions newest first

  1. v1 RFC Latest11 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11mm: add folio_wake_writeback() helpermm/filemap.c+9 -10 replies
2/11folio_wait: move folio bit-lock and wait implementation to mm/folio_wait.cmm/Makefile mm/filemap.c mm/folio_wait.c +1 more+668 -6400 replies
3/11folio_wait: move folio bit-lock and wait declarations to include/linux/folio_wait.hinclude/linux/folio_wait.h include/linux/pagemap.h mm/folio_wait.c+183 -1720 replies
4/11folio_wait: move folio_wait_writeback() family to mm/folio_wait.cinclude/linux/folio_wait.h include/linux/pagemap.h mm/folio_wait.c +1 more+71 -690 replies
5/11folio_wait: reformat comments and fix alignmentinclude/linux/folio_wait.h mm/folio_wait.c+113 -1340 replies
6/11folio_wait: rename wait_page_* infrastructure to wait_folio_*include/linux/folio_wait.h include/linux/fs.h io_uring/rw.c +3 more+57 -570 replies
7/11folio_wait: convert VM_BUG_ON_FOLIO() to VM_WARN_ON_ONCE_FOLIO()mm/folio_wait.c+4 -40 replies
8/11MAINTAINERS: add folio_wait files to MEMORY MANAGEMENT - COREMAINTAINERS+2 -00 replies
9/11fs: move dir_pages() from <linux/pagemap.h> to <linux/fs.h>include/linux/fs.h include/linux/pagemap.h+6 -60 replies
10/11fs: move generic_file_read_iter() to fs/read_write.cfs/read_write.c include/linux/fs.h include/linux/pagemap.h +1 more+84 -840 replies
11/11fs: move generic_file_write_iter() family to fs/read_write.cfs/read_write.c include/linux/fs.h include/linux/pagemap.h +1 more+281 -2820 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH RFC 00/11] mm/filemap: split out folio wait and VFS code

mm/filemap.c has accumulated additional infrastructure over the years that is not directly related to the page cache. It is currently nearly 5000 lines long. This series splits out the folio bit-lock and wait queue code into separate files, and moves the VFS-level generic_file_{read,write}_iter() family of files to fs/read_write.c, in order to provide better separation of concerns. This also slims down mm/filemap.c by ~1000 lines.

The folio wait infrastructure is centralized in mm/folio_wait.c and include/linux/folio_wait.h, with functions moved from mm/filemap.c, mm/page-writeback.c, and include/linux/pagemap.h. Afterwards, the code is cleaned up a little, with functions and data types renamed to refer to folios rather than pages.

generic_file_{read,write}_iter() implement the VFS-level read/write path for filesystems, including support for direct I/O. These functions and their helpers are moved to fs/read_write.c, along with other VFS-level read/write functions. dir_pages() is also moved to include/linux/fs.h. i_blocks_per_folio() is not moved from include/linux/pagemap.h, as it requires folio_size(), which is not currently available in include/linux/fs.h.

No functional change is intended.

Note: I have additional cleanups to mm/filemap.c ready to go, foremost among them centralizing on the filemap_*() naming convention and making the exposed page cache API clearer and more consistent, but I've split these patches off from that in order to avoid sending these logically separate patches to ~60 maintainers.

---
Tal Zussman (11):
mm: add folio_wake_writeback() helper
folio_wait: move folio bit-lock and wait implementation to mm/folio_wait.c
folio_wait: move folio bit-lock and wait declarations to include/linux/folio_wait.h
folio_wait: move folio_wait_writeback() family to mm/folio_wait.c
folio_wait: reformat comments and fix alignment
folio_wait: rename wait_page_* infrastructure to wait_folio_*
folio_wait: convert VM_BUG_ON_FOLIO() to VM_WARN_ON_ONCE_FOLIO()
MAINTAINERS: add folio_wait files to MEMORY MANAGEMENT - CORE
fs: move dir_pages() from <linux/pagemap.h> to <linux/fs.h>
fs: move generic_file_read_iter() to fs/read_write.c
fs: move generic_file_write_iter() family to fs/read_write.c

 MAINTAINERS                |   2 +
 fs/read_write.c            | 358 ++++++++++++++++
 include/linux/folio_wait.h | 183 +++++++++
 include/linux/fs.h         |  19 +-
 include/linux/pagemap.h    | 184 +--------
 io_uring/rw.c              |  14 +-
 io_uring/rw.h              |   6 +-
 mm/Makefile                |   2 +-
 mm/filemap.c               | 993 +--------------------------------------------
 mm/folio_wait.c            | 710 ++++++++++++++++++++++++++++++++
 mm/internal.h              |   4 +
 mm/page-writeback.c        |  66 ---
 12 files changed, 1285 insertions(+), 1256 deletions(-)

---
base-commit: e9add7501ad3297dad9b90ce201266830a68ab47
change-id: 20260511-filemap-split-871b5c18e98c

Best regards,

Signature · 1 line
Tal Zussman <[email protected]>