]> git.ipfire.org Git - thirdparty/linux.git/commit
iomap: optional zero range dirty folio processing
authorBrian Foster <bfoster@redhat.com>
Fri, 3 Oct 2025 13:46:37 +0000 (09:46 -0400)
committerChristian Brauner <brauner@kernel.org>
Wed, 5 Nov 2025 11:57:24 +0000 (12:57 +0100)
commit395ed1ef0012e1bb1e4050e84ba0173b3623112a
tree9eedb8c78a114b6b84727713eea5dec259bf22f9
parent49590716be886cc3cbbac10964eac551cfe570b2
iomap: optional zero range dirty folio processing

The only way zero range can currently process unwritten mappings
with dirty pagecache is to check whether the range is dirty before
mapping lookup and then flush when at least one underlying mapping
is unwritten. This ordering is required to prevent iomap lookup from
racing with folio writeback and reclaim.

Since zero range can skip ranges of unwritten mappings that are
clean in cache, this operation can be improved by allowing the
filesystem to provide a set of dirty folios that require zeroing. In
turn, rather than flush or iterate file offsets, zero range can
iterate on folios in the batch and advance over clean or uncached
ranges in between.

Add a folio_batch in struct iomap and provide a helper for
filesystems to populate the batch at lookup time. Update the folio
lookup path to return the next folio in the batch, if provided, and
advance the iter if the folio starts beyond the current offset.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/iomap/buffered-io.c
fs/iomap/iter.c
include/linux/iomap.h