Re: [PATCH 09/11] vfs: push copy_file_ranges -EXDEV checks down

Amir Goldstein
2018-12-03T12:36:14Z

On Mon, Dec 3, 2018 at 10:34 AM Dave Chinner <david@fromorbit.com> wrote:
>
> From: Dave Chinner <dchinner@redhat.com>
>
> We want to enable cross-filesystem copy_file_range functionality
> where possible, so push the "same superblock only" checks down to
> the individual filesystem callouts so they can make their own
> decisions about cross-superblock copy offload.
>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>

Looks good.
You may add
Reviewed-by: Amir Goldstein <amir73il@gmail.com>

Similar comment about overlayfs as patch 3.

diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c
> index 68736e5d6a56..34fb0398d016 100644
> --- a/fs/overlayfs/file.c
> +++ b/fs/overlayfs/file.c
> @@ -443,6 +443,14 @@ static loff_t ovl_copyfile(struct file *file_in, loff_t pos_in,
> const struct cred *old_cred;
> loff_t ret;
>
> + /*
> + * Temporary. Cross device copy checks should be left to the copy file
> + * call on the real inodes, but existing behaviour checks the upper
> + * files only.
> + */
> + if (file_inode(file_in)->i_sb != file_inode(file_out)->i_sb)
> + return -EXDEV;
> +
> ret = ovl_real_fdget(file_out, &real_out);
> if (ret)
> return ret;
> @@ -491,7 +499,7 @@ static ssize_t ovl_copy_file_range(struct file *file_in, loff_t pos_in,
> ret = ovl_copyfile(file_in, pos_in, file_out, pos_out, len, flags,
> OVL_COPY);
>
> - if (ret == -EOPNOTSUPP)
> + if (ret == -EOPNOTSUPP || ret == -EXDEV)
> ret = generic_copy_file_range(file_in, pos_in, file_out,
> pos_out, len, flags);

This fallback is already provided by vfs_copy_file_range().

Thanks,
Amir.