RFR: 8264744: (fs) Use file cloning in Linux and macOS versions of FileChannel transfer and Files copy methods [v2]

Brian Burkhalter bpb at openjdk.org
Fri Jul 15 14:57:02 UTC 2022


On Fri, 15 Jul 2022 02:30:00 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: Refactor into provider+dispatcher to reduce amount of JNI code

I agree about having OS-specific `CopyFile` classes instead of OS-specific providers. I don’t like the `IOStatus` being in the provider and the call of `provider.clone()` seems odd.

- `LinuxNativeDispatcher.ioctl_ficlone` uses `Blocker` emulating the calls in `UnixNativeDispatcher`.
- `FICLONE` is the descendent of `BTRFS_IOC_CLONE` and has the same numerical value so I think it is fairly safe.

Agreed about the other points.

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

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


More information about the nio-dev mailing list