On Fri, Dec 13, 2024 at 09:36:07AM -0500, Brian Foster wrote: > Note that the semantics for operations that use incremental advances > is slightly different than traditional operations. Operations that > advance the iter directly are expected to return success or failure > (i.e. 0 or negative error code) in iter.processed rather than the > number of bytes processed. While the uses of the incremental advance later look nice, this bit is pretty ugly. I wonder if we could just move overy everything to the incremental advance model, even if it isn't all that incremental, that is always call iomap_iter_advance from the processing loop and eventually remove the call in iomap_iter() entirely? > @@ -36,7 +36,7 @@ static inline int iomap_iter_advance(struct iomap_iter *iter, s64 count) > return -EIO; > iter->pos += count; > iter->len -= count; > - if (!iter->len || (!count && !stale)) > + if (!iter->len || (!count && !stale && iomap_length(iter))) This probably warrantd a comment even with the existing code, but really needs one now. > + * @iter_spos: The original start pos for the current iomap. Used for > + * incremental iter advance. Maybe spell out the usage as iter_start_pos in the field name as spos reads a little weird?