Re: [PATCH v2 06/18] ext4: convert iomap ops to ->iomap_next()

From: Jan Kara

Date: Wed Jul 01 2026 - 06:06:56 EST


On Tue 30-06-26 17:09:21, Joanne Koong wrote:
> Convert ext4 iomap_ops to the new ->iomap_next() callback. This uses 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 <joannelkoong@xxxxxxxxx>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@xxxxxxx>

Honza

> ---
> fs/ext4/extents.c | 8 +++++++-
> fs/ext4/inode.c | 17 +++++++++++++++--
> 2 files changed, 22 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index 91c97af64b31..431298eca7e8 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -5171,8 +5171,14 @@ static int ext4_iomap_xattr_begin(struct inode *inode, loff_t offset,
> return error;
> }
>
> +static int ext4_iomap_xattr_next(const struct iomap_iter *iter,
> + struct iomap *iomap, struct iomap *srcmap)
> +{
> + return iomap_process(iter, iomap, srcmap, ext4_iomap_xattr_begin, NULL);
> +}
> +
> static const struct iomap_ops ext4_iomap_xattr_ops = {
> - .iomap_begin = ext4_iomap_xattr_begin,
> + .iomap_next = ext4_iomap_xattr_next,
> };
>
> static int ext4_fiemap_check_ranges(struct inode *inode, u64 start, u64 *len)
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index ce99807c5f5b..cf7aa8275651 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -3850,8 +3850,14 @@ static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
> return 0;
> }
>
> +static int ext4_iomap_next(const struct iomap_iter *iter, struct iomap *iomap,
> + struct iomap *srcmap)
> +{
> + return iomap_process(iter, iomap, srcmap, ext4_iomap_begin, NULL);
> +}
> +
> const struct iomap_ops ext4_iomap_ops = {
> - .iomap_begin = ext4_iomap_begin,
> + .iomap_next = ext4_iomap_next,
> };
>
> static int ext4_iomap_begin_report(struct inode *inode, loff_t offset,
> @@ -3905,8 +3911,15 @@ static int ext4_iomap_begin_report(struct inode *inode, loff_t offset,
> return 0;
> }
>
> +static int ext4_iomap_next_report(const struct iomap_iter *iter,
> + struct iomap *iomap, struct iomap *srcmap)
> +{
> + return iomap_process(iter, iomap, srcmap, ext4_iomap_begin_report,
> + NULL);
> +}
> +
> const struct iomap_ops ext4_iomap_report_ops = {
> - .iomap_begin = ext4_iomap_begin_report,
> + .iomap_next = ext4_iomap_next_report,
> };
>
> /*
> --
> 2.52.0
>
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR