RFR: 8264744: (fs) Use file cloning in Linux and macOS versions of FileChannel transfer and Files copy methods [v8]
Alan Bateman
alanb at openjdk.org
Wed Aug 17 13:52:28 UTC 2022
On Mon, 15 Aug 2022 18:35:13 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Add file cloning to `java.nio.channels.FileChannel::transferTo` and `java.nio.file.Files.copy(Path,Path)`.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 8264744: Add mode to clone() and other requested changes
I took another pass over the current patch. It has improved significantly but I think we will need to restructure UnixCopyFile very significantly to allow for both clone implementations. The main issue is that the macOS clonefile is forcing the patch to clone with file paths and this breaks the architecture where the source and target files are opened once.
One thing we could do is separate the update to FileChannelImpl.c to use copy_file_range to a separate issue. It doesn't need to be in this PR.
Another thing we could do is separate out the use of ioctl(FICLONE) on Linux. That is essentially an alternative transfer implementation so if we move the transfer to UnixFileSystem then the Linux implementation can use ioctl(FICLONE) or sendfile64, the macOS implementation can use fcopyfile, and the "portable" Unix implementation can use the user-space transfer loop. The implementation specific can fallback to the Unix transfer if needed. If we do this then it gives us more time to think about the troublesome macOS clonefile.
-------------
PR: https://git.openjdk.org/jdk/pull/9486
More information about the nio-dev
mailing list