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

Brian Burkhalter bpb at openjdk.org
Fri Jun 17 16:09:10 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 314:

> 312:                                 Blocker.end(comp);
> 313:                             }
> 314:                         } while (res == IOStatus.INTERRUPTED);

As `RESTARTABLE` is used in `transfer0()` this loop could go away.

src/java.base/unix/native/libnio/fs/UnixCopyFile.c line 141:

> 139:         RESTARTABLE(sendfile64(dst, src, NULL, count), bytes_sent);
> 140:         if (bytes_sent < 0) {
> 141:             if (errno == EINTR) {

As the `RESTARTABLE` macro is used, checking for `errno == EINTR` can go away.

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

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


More information about the nio-dev mailing list