iomap: refactor the writeback interface
authorChristoph Hellwig <hch@lst.de>
Thu, 10 Jul 2025 13:33:28 +0000 (15:33 +0200)
committerChristian Brauner <brauner@kernel.org>
Mon, 14 Jul 2025 08:51:31 +0000 (10:51 +0200)
commitfb7399cf2d0b33825b8039f95c45395c7deba25c
tree849825cc5c90ac56c4a163db7eac3752e92d7f12
parent40368a6acb95635824f6a45ec1de6233977309f3
iomap: refactor the writeback interface

Replace ->map_blocks with a new ->writeback_range, which differs in the
following ways:

 - it must also queue up the I/O for writeback, that is called into the
   slightly refactored and extended in scope iomap_add_to_ioend for
   each region
 - can handle only a part of the requested region, that is the retry
   loop for partial mappings moves to the caller
 - handles cleanup on failures as well, and thus also replaces the
   discard_folio method only implemented by XFS.

This will allow to use the iomap writeback code also for file systems
that are not block based like fuse.

Co-developed-by: Joanne Koong <joannelkoong@gmail.com>
Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/20250710133343.399917-5-hch@lst.de
Acked-by: Damien Le Moal <dlemoal@kernel.org> # zonefs
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Documentation/filesystems/iomap/operations.rst
block/fops.c
fs/gfs2/bmap.c
fs/iomap/buffered-io.c
fs/iomap/trace.h
fs/xfs/xfs_aops.c
fs/zonefs/file.c
include/linux/iomap.h