coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC][PATCH][cp] btrfs, nocow and cp --reflink


From: Pádraig Brady
Subject: Re: [RFC][PATCH][cp] btrfs, nocow and cp --reflink
Date: Fri, 27 May 2022 15:00:35 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:98.0) Gecko/20100101 Thunderbird/98.0

On 25/05/2022 18:05, Goffredo Baroncelli wrote:
Hi All,

recently I discovered that BTRFS allow to reflink a file only if the flag 
FS_NOCOW_FL is the same on both source and destination.
In the end of this email I added a patch to "cp" to set the FS_NOCOW_FL flag 
according to the source.

Even tough this works, I am wondering if this is the expected/the least 
surprise behavior by/for any user. This is the reason why this email is tagged 
as RFC.

Without reflink, the default behavior is that the new file has the FS_NOCOW_FL 
flag set according to the parent directory; with this patch the flag would be 
the same as the source.

I am not sure that this is the correct behviour without warning the user of 
this change.

Another possibility, is to flip the NOCOW flag only if --reflink=always is 
passed.

Thoughts ?

This flag corresponds to the 'C' chattr attribute,
to allow users to explicitly disable CoW on certain files
or files within certain dirs.

I don't think cp should be overriding that explicit config.  I.e.:
  cp --reflink=auto => try reflink but fall back to normal copy
  cp --reflink=always => try reflink and fail if not possible

We would need another option to bypass system config
(like --reflink=force), however I don't think that's
appropriate functionality for cp.

thanks,
Pádraig



reply via email to

[Prev in Thread] Current Thread [Next in Thread]