-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
This is a feature request for an implementation of the BTRFS_IOC_CLONE in zfsonlinux, or something similar, so that it's possible to COW-copy a single file in zero space, zero RAM and zero time, without having to enable super-expensive things like filesystem-wide deduplication (which btw is not zero RAM or zero time).
If it can be done at the directory level, so to clone entire directory trees with one call, even better.
On the mailing list, doubts were raised regarding semantics on:
- Quotas, especially when the "copy" start to be modified.
- Source and destination dataset don't use the same compression.
- Source and destination dataset don't use the same encryption key.
- Source and destination dataset haven't the same "copies" attribute.
- Source and destination dataset haven't the same recordsize.
Firstly, I don't expect this to work across datasets. Secondly, I'd suggest that the same semantics of deduplication are used. It should just be a shortcut of 1) enabling deduplication + 2) copying the file by reading it byte-by-byte and writing it byte-by-byte elsewhere.
If you can implement exactly the BTRFS_IOC_CLONE, the same cp with --reflink that works for btrfs could be used here. If the IOC is different, we will also need patches to the cp program or another another cp program.