RFR: 6980847: (fs) Files.copy needs to be tuned [v6]

Alan Bateman alanb at openjdk.org
Tue Jun 21 09:27:41 UTC 2022


On Fri, 17 Jun 2022 15:37:53 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Modify `UnixCopyFile.copyFile()` to set the transfer size to the least common multiple of the source and destination file block sizes if the block sizes are not equal. Modify `WindowsFileCopy.copy()` to set `COPY_FILE_NO_BUFFERING` in the flags passed to `CopyFileEx()` if the size of the transfer is greater than a threshold.
>
> Brian Burkhalter has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - 6980847: Convert to fallback to copy0() method
>  - 6980847: work in progress

src/java.base/unix/classes/sun/nio/fs/UnixCopyFile.java line 723:

> 721: 
> 722:     static native void copy0(int dst, int src, long address, int transferSize,
> 723:                              long addressToPollForCancel)

The naming is a bit unfortunate here. transferTo0 is copy with buffers in user-space. copy0 is with kernel support such as sendfile64 or fcopyfile. I think we need clearer names and improve the comments on the declarations here so that it's clear what they do. I think that's the first step before we split up the high-level copyFile method to make it easier to read and maintain.

-------------

PR: https://git.openjdk.org/jdk/pull/9161


More information about the nio-dev mailing list