Christoph Hellwig
2018-Oct-14 17:24 UTC
[Ocfs2-devel] [PATCH 16/25] vfs: make remapping to source file eof more explicit
On Fri, Oct 12, 2018 at 05:07:37PM -0700, Darrick J. Wong wrote:> From: Darrick J. Wong <darrick.wong at oracle.com> > > Create a RFR_TO_SRC_EOF flag to explicitly declare that the caller wants > the remap implementation to remap to the end of the source file, once > the files are locked.The name looks like a cat threw up on your keyboard :)>From reading the code this seems to ask for a whole file remap, right?Why not put that in the name to make it more descriptive?
Darrick J. Wong
2018-Oct-15 15:32 UTC
[Ocfs2-devel] [PATCH 16/25] vfs: make remapping to source file eof more explicit
On Sun, Oct 14, 2018 at 10:24:33AM -0700, Christoph Hellwig wrote:> On Fri, Oct 12, 2018 at 05:07:37PM -0700, Darrick J. Wong wrote: > > From: Darrick J. Wong <darrick.wong at oracle.com> > > > > Create a RFR_TO_SRC_EOF flag to explicitly declare that the caller wants > > the remap implementation to remap to the end of the source file, once > > the files are locked. > > The name looks like a cat threw up on your keyboard :)Yeah... :(> From reading the code this seems to ask for a whole file remap, right?Nope. In the original btrfs clonerange ioctl, length == 0 meant "to EOF". If you made a call like this: struct btrfs_ioctl_clone_range_args x = { .src_offset = 16384, .src_length = 0, .dest_offset = 0, .src_fd = whatever, }; ftruncate(dest_fd, 0); ioctl(dest_fd, BTRFS_IOC_CLONE, &x); Then dest_fd ends up with the contents of [16k...EOF] from src_fd. It's annoying to have the magic length number (and no flags?) but we're stuck with this quirk of the interface.> Why not put that in the name to make it more descriptive?I'm all ears for better suggestions. :) --D