On Fri, Sep 27, 2024 at 06:18:20PM +0100, Matthew Wilcox wrote:
Without looking at the source code, it seems likely that cp blindly tries FICLONE without checking to see whether the sparse flag is set. I suggest that setting --sparse=always should disable the FICLONE optimisation.
I tend to disagree; the reflink is going to be more efficient in the default case than making an explicit copy that has holes in it--so why should cp assume you don't want a reflink? If you want to make an existing file sparse, just use fallocate -d. Or, you could turn off reflink if you really want to make a full copy, though this seems strange.