Re: [PATCH v2 07/10] iomap: Introduce iomap_apply2() for operations on two files
From: ruansy.fnst@xxxxxxxxxxx
Date: Fri Feb 26 2021 - 03:21:50 EST
>
On Fri, Feb 26, 2021 at 08:20:27AM +0800, Shiyang Ruan wrote:
>
> Some operations, such as comparing a range of data in two files under
>
> fsdax mode, requires nested iomap_open()/iomap_end() on two file. Thus,
>
> we introduce iomap_apply2() to accept arguments from two files and
>
> iomap_actor2_t for actions on two files.
>
>
>
> Signed-off-by: Shiyang Ruan <ruansy.fnst@xxxxxxxxxxx>
>
> ---
>
> fs/iomap/apply.c | 51 +++++++++++++++++++++++++++++++++++++++++++
>
> include/linux/iomap.h | 7 +++++-
>
> 2 files changed, 57 insertions(+), 1 deletion(-)
>
>
...
>
> + ret = ops->iomap_begin(ino2, pos2, length, 0, &dmap, NULL);
>
> + if (ret)
>
> + goto out_dest;
>
> + if (WARN_ON(dmap.offset > pos2)) {
>
> + written = -EIO;
>
> + goto out_dest;
>
> + }
>
> + if (WARN_ON(dmap.length == 0)) {
>
> + written = -EIO;
>
> + goto out_dest;
>
> + }
>
> +
>
> + /* make sure extent length of two file is equal */
>
> + if (WARN_ON(smap.length != dmap.length)) {
>
>
Why not set smap.length and dmap.length to min(smap.length, dmap.length) ?
>
You are right. I found that I understood it wrong. My bad.
I'll fix this patch and the next one which call this function.
--
Thanks,
Ruan Shiyang.
>
--D
>