Re: RFC: Does ZFS block cloning do this?
- Reply: Rick Macklem : "Re: RFC: Does ZFS block cloning do this?"
- In reply to: Rick Macklem : "RFC: Does ZFS block cloning do this?"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 06 Aug 2025 15:55:26 UTC
Rick Macklem <rick.macklem@gmail.com> writes: > NFSv4.2 has a CLONE operation. It is described as doing: > The CLONE operation is used to clone file content from a source file > specified by the SAVED_FH value into a destination file specified by > CURRENT_FH without actually copying the data, e.g., by using a > copy-on-write mechanism. > [...] > Does ZFS block cloning do this? The question you should be asking is “does FreeBSD currently provide something that could be used to implement this” and the answer is VOP_COPY_FILE_RANGE(9). It will copy the data if the underlying filesystem does not provide a no-copy mechanism or if that mechanism can't be used (e.g. the files are in different pools), but it shouldn't be difficult to add a flag; calling VOP_COPY_FILE_RANGE() with that flag would implement intra-server CLONE, and calling it without the flag would implement intra-server COPY. Note that VOP_COPY_FILE_RANGE() does not always copy the entire file in a single operation; you will have to call it in a loop until len is zero or an error occurs. DES -- Dag-Erling Smørgrav - des@FreeBSD.org