diff mbox series

[1/1] man-page: copy_file_range(2) allow for cross-device copies

Message ID 20181024195837.35532-3-olga.kornievskaia@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/1] man-page: copy_file_range(2) allow for cross-device copies | expand

Commit Message

Olga Kornievskaia Oct. 24, 2018, 7:58 p.m. UTC
From: Olga Kornievskaia <kolga@netapp.com>

A proposed VFS change removes the check for the files to reside
under the same file system. Instead, a file system driver implementation
is allowed to perform a cross-device copy_file_range() and if
the file system fails to support it instead fallback to doing
a do_splice copy. Therefore, EXDEV is no longer a possible error.

Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
---
 man2/copy_file_range.2 | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Amir Goldstein Oct. 25, 2018, 4:28 a.m. UTC | #1
On Wed, Oct 24, 2018 at 10:59 PM Olga Kornievskaia
<olga.kornievskaia@gmail.com> wrote:
>
> From: Olga Kornievskaia <kolga@netapp.com>
>
> A proposed VFS change removes the check for the files to reside
> under the same file system. Instead, a file system driver implementation
> is allowed to perform a cross-device copy_file_range() and if
> the file system fails to support it instead fallback to doing
> a do_splice copy. Therefore, EXDEV is no longer a possible error.
>
> Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
> ---
>  man2/copy_file_range.2 | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/man2/copy_file_range.2 b/man2/copy_file_range.2
> index 20374ab..723b2d0 100644
> --- a/man2/copy_file_range.2
> +++ b/man2/copy_file_range.2
> @@ -39,7 +39,8 @@ The
>  .BR copy_file_range ()
>  system call performs an in-kernel copy between two file descriptors
>  without the additional cost of transferring data from the kernel to user space
> -and then back into the kernel.
> +and then back into the kernel. Since kernel version 4.21(???) passed in
> +file descriptors are not required to be under the same mounted file system.
>  It copies up to
>  .I len
>  bytes of data from file descriptor
> @@ -128,10 +129,6 @@ Out of memory.
>  .B ENOSPC
>  There is not enough space on the target filesystem to complete the copy.
>  .TP
> -.B EXDEV
> -The files referred to by
> -.IR file_in " and " file_out
> -are not on the same mounted filesystem.

Man page serves users of old kernels as well. You should not delete this
expected error, but you can add "... and kernel does not support cross
filesystem copy".

Thanks,
Amir.
Olga Kornievskaia Oct. 25, 2018, 3:26 p.m. UTC | #2
On Thu, Oct 25, 2018 at 12:28 AM Amir Goldstein <amir73il@gmail.com> wrote:
>
> On Wed, Oct 24, 2018 at 10:59 PM Olga Kornievskaia
> <olga.kornievskaia@gmail.com> wrote:
> >
> > From: Olga Kornievskaia <kolga@netapp.com>
> >
> > A proposed VFS change removes the check for the files to reside
> > under the same file system. Instead, a file system driver implementation
> > is allowed to perform a cross-device copy_file_range() and if
> > the file system fails to support it instead fallback to doing
> > a do_splice copy. Therefore, EXDEV is no longer a possible error.
> >
> > Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
> > ---
> >  man2/copy_file_range.2 | 7 ++-----
> >  1 file changed, 2 insertions(+), 5 deletions(-)
> >
> > diff --git a/man2/copy_file_range.2 b/man2/copy_file_range.2
> > index 20374ab..723b2d0 100644
> > --- a/man2/copy_file_range.2
> > +++ b/man2/copy_file_range.2
> > @@ -39,7 +39,8 @@ The
> >  .BR copy_file_range ()
> >  system call performs an in-kernel copy between two file descriptors
> >  without the additional cost of transferring data from the kernel to user space
> > -and then back into the kernel.
> > +and then back into the kernel. Since kernel version 4.21(???) passed in
> > +file descriptors are not required to be under the same mounted file system.
> >  It copies up to
> >  .I len
> >  bytes of data from file descriptor
> > @@ -128,10 +129,6 @@ Out of memory.
> >  .B ENOSPC
> >  There is not enough space on the target filesystem to complete the copy.
> >  .TP
> > -.B EXDEV
> > -The files referred to by
> > -.IR file_in " and " file_out
> > -are not on the same mounted filesystem.
>
> Man page serves users of old kernels as well. You should not delete this
> expected error, but you can add "... and kernel does not support cross
> filesystem copy".

Thank you, will do.
>
> Thanks,
> Amir.
Matthew Wilcox Oct. 25, 2018, 5:24 p.m. UTC | #3
On Thu, Oct 25, 2018 at 07:28:10AM +0300, Amir Goldstein wrote:
> On Wed, Oct 24, 2018 at 10:59 PM Olga Kornievskaia
> <olga.kornievskaia@gmail.com> wrote:
> >
> > From: Olga Kornievskaia <kolga@netapp.com>
> >
> > A proposed VFS change removes the check for the files to reside
> > under the same file system. Instead, a file system driver implementation
> > is allowed to perform a cross-device copy_file_range() and if
> > the file system fails to support it instead fallback to doing
> > a do_splice copy. Therefore, EXDEV is no longer a possible error.
> >
> > Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
> > ---
> >  man2/copy_file_range.2 | 7 ++-----
> >  1 file changed, 2 insertions(+), 5 deletions(-)
> >
> > diff --git a/man2/copy_file_range.2 b/man2/copy_file_range.2
> > index 20374ab..723b2d0 100644
> > --- a/man2/copy_file_range.2
> > +++ b/man2/copy_file_range.2
> > @@ -39,7 +39,8 @@ The
> >  .BR copy_file_range ()
> >  system call performs an in-kernel copy between two file descriptors
> >  without the additional cost of transferring data from the kernel to user space
> > -and then back into the kernel.
> > +and then back into the kernel. Since kernel version 4.21(???) passed in
> > +file descriptors are not required to be under the same mounted file system.
> >  It copies up to
> >  .I len
> >  bytes of data from file descriptor
> > @@ -128,10 +129,6 @@ Out of memory.
> >  .B ENOSPC
> >  There is not enough space on the target filesystem to complete the copy.
> >  .TP
> > -.B EXDEV
> > -The files referred to by
> > -.IR file_in " and " file_out
> > -are not on the same mounted filesystem.
> 
> Man page serves users of old kernels as well. You should not delete this
> expected error, but you can add "... and kernel does not support cross
> filesystem copy".

I'd rather see this worded as:

 .B EXDEV
 The files referred to by
 .IR file_in " and " file_out
-are not on the same mounted filesystem.
+cannot be copied due to being on incompatible filesystems
Olga Kornievskaia Oct. 25, 2018, 5:47 p.m. UTC | #4
On Thu, Oct 25, 2018 at 1:24 PM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Thu, Oct 25, 2018 at 07:28:10AM +0300, Amir Goldstein wrote:
> > On Wed, Oct 24, 2018 at 10:59 PM Olga Kornievskaia
> > <olga.kornievskaia@gmail.com> wrote:
> > >
> > > From: Olga Kornievskaia <kolga@netapp.com>
> > >
> > > A proposed VFS change removes the check for the files to reside
> > > under the same file system. Instead, a file system driver implementation
> > > is allowed to perform a cross-device copy_file_range() and if
> > > the file system fails to support it instead fallback to doing
> > > a do_splice copy. Therefore, EXDEV is no longer a possible error.
> > >
> > > Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
> > > ---
> > >  man2/copy_file_range.2 | 7 ++-----
> > >  1 file changed, 2 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/man2/copy_file_range.2 b/man2/copy_file_range.2
> > > index 20374ab..723b2d0 100644
> > > --- a/man2/copy_file_range.2
> > > +++ b/man2/copy_file_range.2
> > > @@ -39,7 +39,8 @@ The
> > >  .BR copy_file_range ()
> > >  system call performs an in-kernel copy between two file descriptors
> > >  without the additional cost of transferring data from the kernel to user space
> > > -and then back into the kernel.
> > > +and then back into the kernel. Since kernel version 4.21(???) passed in
> > > +file descriptors are not required to be under the same mounted file system.
> > >  It copies up to
> > >  .I len
> > >  bytes of data from file descriptor
> > > @@ -128,10 +129,6 @@ Out of memory.
> > >  .B ENOSPC
> > >  There is not enough space on the target filesystem to complete the copy.
> > >  .TP
> > > -.B EXDEV
> > > -The files referred to by
> > > -.IR file_in " and " file_out
> > > -are not on the same mounted filesystem.
> >
> > Man page serves users of old kernels as well. You should not delete this
> > expected error, but you can add "... and kernel does not support cross
> > filesystem copy".
>
> I'd rather see this worded as:
>
>  .B EXDEV
>  The files referred to by
>  .IR file_in " and " file_out
> -are not on the same mounted filesystem.
> +cannot be copied due to being on incompatible filesystems

Why should this be changed to "incompatible filesystems". Existing
code doesn't support not only incompatibly filesystem but also cross
device of compatible file systems. And this error is only left for the
old kernels. In the new kernel, the error EXDEV will never be
returned.
Matthew Wilcox Oct. 25, 2018, 6:08 p.m. UTC | #5
On Thu, Oct 25, 2018 at 01:47:21PM -0400, Olga Kornievskaia wrote:
> On Thu, Oct 25, 2018 at 1:24 PM Matthew Wilcox <willy@infradead.org> wrote:
> >
> > On Thu, Oct 25, 2018 at 07:28:10AM +0300, Amir Goldstein wrote:
> > > On Wed, Oct 24, 2018 at 10:59 PM Olga Kornievskaia
> > > <olga.kornievskaia@gmail.com> wrote:
> > > >
> > > > From: Olga Kornievskaia <kolga@netapp.com>
> > > >
> > > > A proposed VFS change removes the check for the files to reside
> > > > under the same file system. Instead, a file system driver implementation
> > > > is allowed to perform a cross-device copy_file_range() and if
> > > > the file system fails to support it instead fallback to doing
> > > > a do_splice copy. Therefore, EXDEV is no longer a possible error.
> > > >
> > > > Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
> > > > ---
> > > >  man2/copy_file_range.2 | 7 ++-----
> > > >  1 file changed, 2 insertions(+), 5 deletions(-)
> > > >
> > > > diff --git a/man2/copy_file_range.2 b/man2/copy_file_range.2
> > > > index 20374ab..723b2d0 100644
> > > > --- a/man2/copy_file_range.2
> > > > +++ b/man2/copy_file_range.2
> > > > @@ -39,7 +39,8 @@ The
> > > >  .BR copy_file_range ()
> > > >  system call performs an in-kernel copy between two file descriptors
> > > >  without the additional cost of transferring data from the kernel to user space
> > > > -and then back into the kernel.
> > > > +and then back into the kernel. Since kernel version 4.21(???) passed in
> > > > +file descriptors are not required to be under the same mounted file system.
> > > >  It copies up to
> > > >  .I len
> > > >  bytes of data from file descriptor
> > > > @@ -128,10 +129,6 @@ Out of memory.
> > > >  .B ENOSPC
> > > >  There is not enough space on the target filesystem to complete the copy.
> > > >  .TP
> > > > -.B EXDEV
> > > > -The files referred to by
> > > > -.IR file_in " and " file_out
> > > > -are not on the same mounted filesystem.
> > >
> > > Man page serves users of old kernels as well. You should not delete this
> > > expected error, but you can add "... and kernel does not support cross
> > > filesystem copy".
> >
> > I'd rather see this worded as:
> >
> >  .B EXDEV
> >  The files referred to by
> >  .IR file_in " and " file_out
> > -are not on the same mounted filesystem.
> > +cannot be copied due to being on incompatible filesystems
> 
> Why should this be changed to "incompatible filesystems". Existing
> code doesn't support not only incompatibly filesystem but also cross
> device of compatible file systems. And this error is only left for the
> old kernels. In the new kernel, the error EXDEV will never be
> returned.

If I try to copy_file_range() between an NFS filesystem and a CIFS
filesystem with a new kernel, what error do I get?
Olga Kornievskaia Oct. 25, 2018, 6:14 p.m. UTC | #6
On Thu, Oct 25, 2018 at 2:08 PM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Thu, Oct 25, 2018 at 01:47:21PM -0400, Olga Kornievskaia wrote:
> > On Thu, Oct 25, 2018 at 1:24 PM Matthew Wilcox <willy@infradead.org> wrote:
> > >
> > > On Thu, Oct 25, 2018 at 07:28:10AM +0300, Amir Goldstein wrote:
> > > > On Wed, Oct 24, 2018 at 10:59 PM Olga Kornievskaia
> > > > <olga.kornievskaia@gmail.com> wrote:
> > > > >
> > > > > From: Olga Kornievskaia <kolga@netapp.com>
> > > > >
> > > > > A proposed VFS change removes the check for the files to reside
> > > > > under the same file system. Instead, a file system driver implementation
> > > > > is allowed to perform a cross-device copy_file_range() and if
> > > > > the file system fails to support it instead fallback to doing
> > > > > a do_splice copy. Therefore, EXDEV is no longer a possible error.
> > > > >
> > > > > Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
> > > > > ---
> > > > >  man2/copy_file_range.2 | 7 ++-----
> > > > >  1 file changed, 2 insertions(+), 5 deletions(-)
> > > > >
> > > > > diff --git a/man2/copy_file_range.2 b/man2/copy_file_range.2
> > > > > index 20374ab..723b2d0 100644
> > > > > --- a/man2/copy_file_range.2
> > > > > +++ b/man2/copy_file_range.2
> > > > > @@ -39,7 +39,8 @@ The
> > > > >  .BR copy_file_range ()
> > > > >  system call performs an in-kernel copy between two file descriptors
> > > > >  without the additional cost of transferring data from the kernel to user space
> > > > > -and then back into the kernel.
> > > > > +and then back into the kernel. Since kernel version 4.21(???) passed in
> > > > > +file descriptors are not required to be under the same mounted file system.
> > > > >  It copies up to
> > > > >  .I len
> > > > >  bytes of data from file descriptor
> > > > > @@ -128,10 +129,6 @@ Out of memory.
> > > > >  .B ENOSPC
> > > > >  There is not enough space on the target filesystem to complete the copy.
> > > > >  .TP
> > > > > -.B EXDEV
> > > > > -The files referred to by
> > > > > -.IR file_in " and " file_out
> > > > > -are not on the same mounted filesystem.
> > > >
> > > > Man page serves users of old kernels as well. You should not delete this
> > > > expected error, but you can add "... and kernel does not support cross
> > > > filesystem copy".
> > >
> > > I'd rather see this worded as:
> > >
> > >  .B EXDEV
> > >  The files referred to by
> > >  .IR file_in " and " file_out
> > > -are not on the same mounted filesystem.
> > > +cannot be copied due to being on incompatible filesystems
> >
> > Why should this be changed to "incompatible filesystems". Existing
> > code doesn't support not only incompatibly filesystem but also cross
> > device of compatible file systems. And this error is only left for the
> > old kernels. In the new kernel, the error EXDEV will never be
> > returned.
>
> If I try to copy_file_range() between an NFS filesystem and a CIFS
> filesystem with a new kernel, what error do I get?

It is my understanding that you will not get an error instead a
do_splice_direct() will do that copy.
diff mbox series

Patch

diff --git a/man2/copy_file_range.2 b/man2/copy_file_range.2
index 20374ab..723b2d0 100644
--- a/man2/copy_file_range.2
+++ b/man2/copy_file_range.2
@@ -39,7 +39,8 @@  The
 .BR copy_file_range ()
 system call performs an in-kernel copy between two file descriptors
 without the additional cost of transferring data from the kernel to user space
-and then back into the kernel.
+and then back into the kernel. Since kernel version 4.21(???) passed in
+file descriptors are not required to be under the same mounted file system.
 It copies up to
 .I len
 bytes of data from file descriptor
@@ -128,10 +129,6 @@  Out of memory.
 .B ENOSPC
 There is not enough space on the target filesystem to complete the copy.
 .TP
-.B EXDEV
-The files referred to by
-.IR file_in " and " file_out
-are not on the same mounted filesystem.
 .SH VERSIONS
 The
 .BR copy_file_range ()