Convert two xfs iomap_ops to the new ->iomap_next() callback as examples (xfs_read_iomap_ops (no ->iomap_end()) and xfs_buffered_write_iomap_ops (with ->iomap_end()). Both use the iomap_process() helper, which finishes the previous mapping if needed and produces the next one. No functional changes are intended. Signed-off-by: Joanne Koong --- fs/xfs/xfs_iomap.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index f20a02f49ed9..3b212bfe04d7 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c @@ -2168,9 +2168,19 @@ xfs_buffered_write_iomap_end( return 0; } +static int +xfs_buffered_write_iomap_next( + const struct iomap_iter *iter, + struct iomap *iomap, + struct iomap *srcmap) +{ + return iomap_process(iter, iomap, srcmap, + xfs_buffered_write_iomap_begin, + xfs_buffered_write_iomap_end); +} + const struct iomap_ops xfs_buffered_write_iomap_ops = { - .iomap_begin = xfs_buffered_write_iomap_begin, - .iomap_end = xfs_buffered_write_iomap_end, + .iomap_next = xfs_buffered_write_iomap_next, }; static int @@ -2214,8 +2224,17 @@ xfs_read_iomap_begin( shared ? IOMAP_F_SHARED : 0, seq); } +static int +xfs_read_iomap_next( + const struct iomap_iter *iter, + struct iomap *iomap, + struct iomap *srcmap) +{ + return iomap_process(iter, iomap, srcmap, xfs_read_iomap_begin, NULL); +} + const struct iomap_ops xfs_read_iomap_ops = { - .iomap_begin = xfs_read_iomap_begin, + .iomap_next = xfs_read_iomap_next, }; static int -- 2.52.0