[PATCH v2 0/7] iomap: incremental per-operation iter advance

Brian Foster
2025-01-22T13:32:24Z

Hi all,

Here's v2 of the iomap incremental iter advance series. This is mostly
the same idea as v1 with some of the cleanups noted below. The most
significant change is probably a bit more rework of the logic between
iomap_iter_advance() and iomap_iter() to make the former a bit more
generic. _advance() now returns the remaining length for the current
mapping for easier use in some of the iter handlers.

The other item of note for v1 was some discussion with Christoph over
changing over more of the operations to advance directly and avoid the
need to handle both types of advances in the iomap_iter() code. I don't
plan to address that in this series, but I've read through some of the
related code and think that perhaps this isn't as invasive as I
originally anticipated. Reason being that even some of the more complex
operations (i.e. direct I/O, buffered read) don't necessarily require
plumbing advances all the way down through the sub-helpers and whatnot
to eliminate the dependency from iomap_iter(). IOW, I think toplevel
direct I/O could just change to something like so:

iter.processed = iomap_dio_iter(...);
if (iter.processed > 0) {
iomap_iter_advance(..., processed);
iter.processed = 0; /* success */
}

... to translate the op-specific code into the updated iteration
semantics. Given that, I'll probably make a quick stab at that once this
series is settled and we'll see how that pans out.

Thoughts, reviews, flames appreciated.

Brian

v2:
- More refactoring of iomap_iter[_advance]() logic. Lifted out iter
continuation and stale logic and improved comments.
- Renamed some poorly named helpers and variables.
- Return remaining length for current iter from _iter_advance() and use
appropriately.
v1: https://lore.kernel.org/linux-fsdevel/20241213143610.1002526-1-bfoster@redhat.com/
- Reworked and fixed a bunch of functional issues.
RFC: https://lore.kernel.org/linux-fsdevel/20241125140623.20633-1-bfoster@redhat.com/

Brian Foster (7):
iomap: split out iomap check and reset logic from iter advance
iomap: factor out iomap length helper
iomap: refactor iter and advance continuation logic
iomap: support incremental iomap_iter advances
iomap: advance the iter directly on buffered writes
iomap: advance the iter directly on unshare range
iomap: advance the iter directly on zero range

fs/iomap/buffered-io.c | 50 ++++++++-------------
fs/iomap/iter.c | 99 ++++++++++++++++++++++++++----------------
include/linux/iomap.h | 20 ++++++---
3 files changed, 94 insertions(+), 75 deletions(-)

--
2.47.1