Re: [PATCH RFC 1/3] vfs: add copy_file_range syscall and vfs helper

2015-04-14 Thread Christoph Hellwig
On Sat, Apr 11, 2015 at 09:04:02AM -0400, Jeff Layton wrote: Yuck! How the heck do you clean up the mess if that happens? I guess you're just stuck redoing the copy with normal READ/WRITE? Maybe we need to have the interface return a hard error in that case and not try to give back any sort

Re: [PATCH RFC 1/3] vfs: add copy_file_range syscall and vfs helper

2015-04-14 Thread Anna Schumaker
On 04/14/2015 12:53 PM, Christoph Hellwig wrote: On Sat, Apr 11, 2015 at 09:04:02AM -0400, Jeff Layton wrote: Yuck! How the heck do you clean up the mess if that happens? I guess you're just stuck redoing the copy with normal READ/WRITE? Maybe we need to have the interface return a hard error

Re: [PATCH RFC 1/3] vfs: add copy_file_range syscall and vfs helper

2015-04-14 Thread Christoph Hellwig
On Tue, Apr 14, 2015 at 09:53:44AM -0700, Christoph Hellwig wrote: On Sat, Apr 11, 2015 at 09:04:02AM -0400, Jeff Layton wrote: Yuck! How the heck do you clean up the mess if that happens? I guess you're just stuck redoing the copy with normal READ/WRITE? Maybe we need to have the

Re: [PATCH RFC 1/3] vfs: add copy_file_range syscall and vfs helper

2015-04-14 Thread J. Bruce Fields
On Tue, Apr 14, 2015 at 11:22:41AM -0700, Zach Brown wrote: On Tue, Apr 14, 2015 at 02:19:11PM -0400, J. Bruce Fields wrote: On Tue, Apr 14, 2015 at 01:16:13PM -0400, Anna Schumaker wrote: On 04/14/2015 12:53 PM, Christoph Hellwig wrote: On Sat, Apr 11, 2015 at 09:04:02AM -0400, Jeff

Re: [PATCH RFC 1/3] vfs: add copy_file_range syscall and vfs helper

2015-04-14 Thread J. Bruce Fields
On Tue, Apr 14, 2015 at 01:16:13PM -0400, Anna Schumaker wrote: On 04/14/2015 12:53 PM, Christoph Hellwig wrote: On Sat, Apr 11, 2015 at 09:04:02AM -0400, Jeff Layton wrote: Yuck! How the heck do you clean up the mess if that happens? I guess you're just stuck redoing the copy with normal

Re: [PATCH RFC 1/3] vfs: add copy_file_range syscall and vfs helper

2015-04-14 Thread Zach Brown
On Tue, Apr 14, 2015 at 02:19:11PM -0400, J. Bruce Fields wrote: On Tue, Apr 14, 2015 at 01:16:13PM -0400, Anna Schumaker wrote: On 04/14/2015 12:53 PM, Christoph Hellwig wrote: On Sat, Apr 11, 2015 at 09:04:02AM -0400, Jeff Layton wrote: Yuck! How the heck do you clean up the mess if

Re: [PATCH RFC 1/3] vfs: add copy_file_range syscall and vfs helper

2015-04-14 Thread Zach Brown
On Tue, Apr 14, 2015 at 02:29:06PM -0400, J. Bruce Fields wrote: On Tue, Apr 14, 2015 at 11:22:41AM -0700, Zach Brown wrote: On Tue, Apr 14, 2015 at 02:19:11PM -0400, J. Bruce Fields wrote: On Tue, Apr 14, 2015 at 01:16:13PM -0400, Anna Schumaker wrote: On 04/14/2015 12:53 PM, Christoph

Re: [PATCH RFC 1/3] vfs: add copy_file_range syscall and vfs helper

2015-04-14 Thread Christoph Hellwig
On Tue, Apr 14, 2015 at 11:54:08AM -0700, Zach Brown wrote: Is this relying on btrfs range cloning being atomic? It certainly doesn't look atomic. It can modify items across an arbitrarily large number of leaf blocks. It can make the changes across multiple transactions which could

Re: [PATCH RFC 1/3] vfs: add copy_file_range syscall and vfs helper

2015-04-14 Thread Zach Brown
On Tue, Apr 14, 2015 at 12:23:25PM -0700, Christoph Hellwig wrote: On Tue, Apr 14, 2015 at 11:54:08AM -0700, Zach Brown wrote: Is this relying on btrfs range cloning being atomic? It certainly doesn't look atomic. It can modify items across an arbitrarily large number of leaf blocks. It

Re: [PATCH RFC 1/3] vfs: add copy_file_range syscall and vfs helper

2015-04-13 Thread Zach Brown
Could we perhaps instead of a length, define a 'pos_in_start' and a 'pos_in_end' offset (with the latter being -1 for a full-file copy) and then return an 'loff_t' value stating where the copy ended? Well, the resulting offset will be set if the caller provided it. So they could

Re: [PATCH RFC 1/3] vfs: add copy_file_range syscall and vfs helper

2015-04-11 Thread Jeff Layton
On Fri, 10 Apr 2015 20:24:06 -0400 Trond Myklebust trond.mykleb...@primarydata.com wrote: On Fri, Apr 10, 2015 at 8:02 PM, Zach Brown z...@redhat.com wrote: On Fri, Apr 10, 2015 at 06:36:41PM -0400, Trond Myklebust wrote: On Fri, Apr 10, 2015 at 6:00 PM, Zach Brown z...@redhat.com wrote:

[PATCH RFC 1/3] vfs: add copy_file_range syscall and vfs helper

2015-04-10 Thread Zach Brown
Add a copy_file_range() system call for offloading copies between regular files. This gives an interface to underlying layers of the storage stack which can copy without reading and writing all the data. There are a few candidates that should support copy offloading in the nearer term: - btrfs

Re: [PATCH RFC 1/3] vfs: add copy_file_range syscall and vfs helper

2015-04-10 Thread Trond Myklebust
Hi Zach, On Fri, Apr 10, 2015 at 6:00 PM, Zach Brown z...@redhat.com wrote: Add a copy_file_range() system call for offloading copies between regular files. This gives an interface to underlying layers of the storage stack which can copy without reading and writing all the data. There are a

Re: [PATCH RFC 1/3] vfs: add copy_file_range syscall and vfs helper

2015-04-10 Thread Andreas Dilger
On Apr 10, 2015, at 4:00 PM, Zach Brown z...@redhat.com wrote: Add a copy_file_range() system call for offloading copies between regular files. This gives an interface to underlying layers of the storage stack which can copy without reading and writing all the data. There are a few

Re: [PATCH RFC 1/3] vfs: add copy_file_range syscall and vfs helper

2015-04-10 Thread Zach Brown
On Fri, Apr 10, 2015 at 06:36:41PM -0400, Trond Myklebust wrote: On Fri, Apr 10, 2015 at 6:00 PM, Zach Brown z...@redhat.com wrote: + +/* + * copy_file_range() differs from regular file read and write in that it + * specifically allows return partial success. When it does so is up to