Re: [PATCH 02/14] xfs: introduce new file range exchange ioctls

Darrick J. Wong
2024-02-28T23:00:58Z

On Wed, Feb 28, 2024 at 11:37:26AM -0800, Christoph Hellwig wrote:
> On Wed, Feb 28, 2024 at 11:35:47AM -0800, Darrick J. Wong wrote:
> > > How about only doing this checks once further up? As the same sb also
> > > applies the same mount.
> >
> > I'll remove this check entirely, since we've already checked that the
> > vfsmnt are the same. Assuming that's what you meant-- I was slightly
> > confused by "same sb also applies the same mount" and decided to
> > interpret that as "same sb implies the same mount".
>
> You interpreted the correctly. Sorry for my jetlagged early morning
> incoherence.

So it occurs to me that I've mismatched the signedness in struct
xfs_exchange_range:

struct xfs_exchange_range {
...
__s64 file1_offset; /* file1 offset, bytes */
__s64 file2_offset; /* file2 offset, bytes */
__u64 length; /* bytes to exchange */

Compare this to FICLONERANGE:

struct file_clone_range {
...
__u64 src_offset;
__u64 src_length;
__u64 dest_offset;
};

The offsets and lengths for FICLONERANGE are unsigned, so I think
xfs_exchange_range ought to follow that.

--D