On Mon, Sep 16, 2019 at 07:44:31PM -0600, Chris Murphy wrote: > Reflinks are like a file based snapshot, they're a file with its own > inode and other metadata you expect for a file, but points to the same > extents as another file. Off hand I'm not sure other than age if > there's any difference between the structure of the original file and > a reflink of that file. Find out. Make a reflink, dump tree. Delete > the original file. Dump tree.
Ehhhh...not really. The clone-file ioctl is a wrapper around clone-file-range that fills in 0 as the offset and the size of the file as the length when creating reflinks. clone-file-range copies all the extent reference items from the src range to the dst range, replacing any extent reference items that were present before. It's O(n) in the number of source range extent refs, and it doesn't have snapshot-style atomicity. The offset for src and dst can both be non-zero, and src and dst inode can be the same. Src and dst cannot overlap, but they can be logically adjacent, creating a logical-neighbor loop for physical extents.