Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* cp --reflink and NOCOW files
@ 2022-05-24 19:02 Goffredo Baroncelli
  2022-05-25  2:19 ` Matthew Warren
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Goffredo Baroncelli @ 2022-05-24 19:02 UTC (permalink / raw)
  To: linux-btrfs

Hi All,

recently I discovered that BTRFS doesn't allow to reflink a file
when the source is marked as NOCOW

$ lsattr
---------------C------ ./file-very-big-nocow
$ cp --reflink file-very-big-nocow file2
cp: failed to clone 'file2' from 'file-very-big-nocow': Invalid argument
$ strace cp --reflink file-very-big-nocow file2 2>&1 | egrep ioctl
ioctl(4, BTRFS_IOC_CLONE or FICLONE, 3) = -1 EINVAL (Invalid argument)

My first thought was that it would be sufficient to remove the "nocow" flag.
But I was unable to do that.

$ chattr -C file-very-big-nocow

$ strace cp --reflink file-very-big-nocow file2 2>&1 | egrep ioctl
ioctl(4, BTRFS_IOC_CLONE or FICLONE, 3) = -1 EINVAL (Invalid argument)

(I tried "chattr +C ..." too)

Ok, now my question is: how we can remove the NOCOW flag from a file ?

My use case is to move files between subvolumes some of which are marked as NOWCOW.
The files are videos, so I want to avoid to copy the data.


BR

-- 
gpg @keyserver.linux.it: Goffredo Baroncelli <kreijackATinwind.it>
Key fingerprint BBF5 1610 0B64 DAC6 5F7D  17B2 0EDA 9B37 8B82 E0B5

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-05-27 14:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-24 19:02 cp --reflink and NOCOW files Goffredo Baroncelli
2022-05-25  2:19 ` Matthew Warren
2022-05-25  4:34   ` Forza
2022-05-25 16:15     ` Goffredo Baroncelli
2022-05-25  5:11 ` Andrei Borzenkov
2022-05-27 14:37 ` Forza

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox