On Fri, Sep 27, 2024 at 06:23:05PM -0400, Michael Stone wrote: > On Fri, Sep 27, 2024 at 09:31:37PM +0100, Matthew Wilcox wrote: > > On Fri, Sep 27, 2024 at 02:41:39PM -0400, Michael Stone wrote: > > > 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. > > > > Maybe for cp --sparse=auto that makes sense, but when I've explicitly > > specified that I want to make a sparse copy, cp is ignoring my > > instructions. Yes, there are other commands that can make a file sparse, > > but if cp's current behaviour is correct, then this at least deserves > > a mention in the manpage because it's confusing as hell. > > It would be just as confusing for cp to ignore reflink, right?
I didn't ask cp to use reflink. It chose to do that all by itself. I asked for a sparse file to be made, and it didn't do that.