On Sun, Dec 06, 2020 at 03:21:54PM -0800, Darrick J. Wong wrote: > On Tue, Dec 01, 2020 at 10:02:06AM +0000, Christoph Hellwig wrote: > > On Mon, Nov 30, 2020 at 07:37:16PM -0800, Darrick J. Wong wrote: > > > From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > > > > > > Add a copy_file_range handler to XFS so that we can accelerate file > > > copies with reflink when the source and destination ranges are not > > > block-aligned. We'll use the generic pagecache copy to handle the > > > unaligned edges and attempt to reflink the middle. > > > > Isn't this something we could better handle in the VFS (or a generic > > helper) so that all file systems that support reflink could benefit? > > Maybe. I don't know if it's universally true that all filesystems > should fall back to reflinking the middle range and pagecache copying > the unaligned start/end. > > The other thing is that xfs can easily support reflink on rtextsize > 1, > but that adds the requirement that we set i_blocksize to a larger value > than we do now... or find some other way to convey allocation unit size > to a generic version of the fallback. OTOH that's pretty easy to do > from xfs_copy_file_range. I think you can basically turn xfs_want_reflink_copy_range into a callback supplied by the fs for the generic helper, and to deal with the rtextsize problem just return the relevant block size from the helper.