RFR: 6980847: (fs) Files.copy needs to be tuned
Roger Riggs
rriggs at openjdk.java.net
Wed Jun 15 15:36:59 UTC 2022
On Wed, 15 Jun 2022 00:20:58 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.
src/java.base/unix/classes/sun/nio/fs/UnixCopyFile.java line 232:
> 230:
> 231: while (u != v) {
> 232: if (u < v)
It might be worth a comment about the expected inputs so it is known to converge quickly.
In the general case it might wrap around and go unstable.
src/java.base/unix/classes/sun/nio/fs/UnixCopyFile.java line 664:
> 662: // -- native methods --
> 663:
> 664: static native long transferSize0();
If the `transferSize` is fixed, there seems to be little reason to call native to retrieve it.
(Perhaps hoping for the OS to provide it.)
-------------
PR: https://git.openjdk.org/jdk/pull/9161
More information about the nio-dev
mailing list