This series adds fuse iomap support for buffered writes and dirty folio writeback. This is needed so that granular uptodate and dirty tracking can be used in fuse when large folios are enabled. This has two big advantages. Now for writes, instead of the entire folio needing to be read into the page cache, only the relevant portions need to be. Now for writeback, only the dirty portions need to be written back instead of the entire folio. This patchset does 3 things, in order of sequence: a) Decouple iomap/buffered-io.c code from the CONFIG_BLOCK dependency, as some environments that run fuse may not have CONFIG_BLOCK set b) Add support to iomap buffered io for generic write and writeback that is not dependent on bios c) Add fuse integration with iomap Patches 3 and 5 are obviated by the refactoring done later on in patches 10 and 11 but I left this patchset in this order in the hopes of making it more logically easier to follow. This series was run through fstests with large folios enabled and through some quick sanity checks on passthrough_hp with a) writing 1 GB in 1 MB chunks and then going back and dirtying a few bytes in each chunk and b) writing 50 MB in 1 MB chunks and going through dirtying the entire chunk for several runs. a) showed about a 40% speedup increase with iomap support added and b) showed roughly the same performance. This patchset does not enable large folios yet. That will be sent out in a separate future patchset. This series is on top of commit 27605c8c0 ("Merge tag 'net-6.16-rc2'...") in the linux tree. Thanks, Joanne Changeset ------- v1 -> v2: * Drop IOMAP_IN_MEM type and just use IOMAP_MAPPED for fuse * Separate out new helper functions added to iomap into separate commits * Update iomap documentation * Clean up iomap_writeback_dirty_folio() locking logic w/ christoph's recommendation * Refactor ->map_blocks() to generic ->writeback_folio() * Refactor ->submit_ioend() to generic ->writeback_complete() * Add patch for changing 'count' to 'async_writeback' * Rebase commits onto linux branch instead of fuse branch v1: https://lore.kernel.org/linux-fsdevel/20250606233803.1421259-1-joannelkoong@xxxxxxxxx/ Joanne Koong (16): iomap: move buffered io CONFIG_BLOCK dependent logic into separate file iomap: iomap_read_folio_sync() -> iomap_bio_read_folio_sync() iomap: iomap_add_to_ioend() -> iomap_bio_add_to_ioend() iomap: add wrapper function iomap_bio_readpage() iomap: add wrapper function iomap_bio_ioend_error() iomap: add wrapper function iomap_submit_bio() iomap: decouple buffered-io.o from CONFIG_BLOCK iomap: add read_folio_sync() handler for buffered writes iomap: change 'count' to 'async_writeback' iomap: replace ->map_blocks() with generic ->writeback_folio() for writeback iomap: replace ->submit_ioend() with generic ->writeback_complete() for writeback iomap: support more customized writeback handling iomap: add iomap_writeback_dirty_folio() fuse: use iomap for buffered writes fuse: use iomap for writeback fuse: use iomap for folio laundering .../filesystems/iomap/operations.rst | 65 ++- block/fops.c | 7 +- fs/fuse/Kconfig | 1 + fs/fuse/file.c | 308 +++++------- fs/gfs2/bmap.c | 7 +- fs/iomap/Makefile | 5 +- fs/iomap/buffered-io-bio.c | 365 ++++++++++++++ fs/iomap/buffered-io.c | 471 +++--------------- fs/iomap/internal.h | 40 ++ fs/xfs/xfs_aops.c | 28 +- fs/zonefs/file.c | 7 +- include/linux/iomap.h | 88 +++- 12 files changed, 775 insertions(+), 617 deletions(-) create mode 100644 fs/iomap/buffered-io-bio.c -- 2.47.1