fuse: use iomap for buffered writes
authorJoanne Koong <joannelkoong@gmail.com>
Tue, 15 Jul 2025 20:21:18 +0000 (13:21 -0700)
committerChristian Brauner <brauner@kernel.org>
Thu, 17 Jul 2025 07:55:15 +0000 (09:55 +0200)
commita4c9ab1d4975746c14b34c7bb908869245a9dd4f
tree6487d7d56bf413234a9d5854a989a2957d71f5c2
parent2f368b5f93430e58f5006d6d5be4916753130cb0
fuse: use iomap for buffered writes

Have buffered writes go through iomap. This has two advantages:
* granular large folio synchronous reads
* granular large folio dirty tracking

If for example there is a 1 MB large folio and a write issued at pos 1
to pos 1 MB - 2, only the head and tail pages will need to be read in
and marked uptodate instead of the entire folio needing to be read in.
Non-relevant trailing pages are also skipped (eg if for a 1 MB large
folio a write is issued at pos 1 to 4099, only the first two pages are
read in and the ones after that are skipped).

iomap also has granular dirty tracking. This is useful in that when it
comes to writeback time, only the dirty portions of the large folio will
be written instead of having to write out the entire folio. For example
if there is a 1 MB large folio and only 2 bytes in it are dirty, only
the page for those dirty bytes get written out. Please note that
granular writeback is only done once fuse also uses iomap in writeback
(separate commit).

.release_folio needs to be set to iomap_release_folio so that any
allocated iomap ifs structs get freed.

Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
Link: https://lore.kernel.org/20250715202122.2282532-2-joannelkoong@gmail.com
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/fuse/Kconfig
fs/fuse/file.c