RFR: 8286763: [REDO] (fc) Tune FileChannel.transferFrom()

Brian Burkhalter bpb at openjdk.java.net
Wed May 18 15:09:06 UTC 2022


On Tue, 17 May 2022 15:43:07 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>>> Isn't it that returning `IOS_UNSUPPORTED` would disable it for everyone? I thought that `IOS_UNSUPPORTED_CASE` allows it to be tried again. Of course one could check for append or overlap in the Java layer instead. I actually had it that way initially for the overlap case but removed it.
>> 
>> Oh I see, it's only IOS_UNSUPPORTED that disables it. With IOS_UNSUPPORTED_CASE then you may retry it again.
>
> Correct. It is IOS_UNSUPPORTED for example if the copy_file_range function pointer is NULL (not available via dlsym()). Then of course one can do nothing.

I don’t think there is much else to do here unless we want to add append and range overlap checks for `transferFromDirectly()` in the Java layer. As empirically it appears that `copy_file_range()` sometimes succeeds in these cases, it seems better just to allow the system call to fail and fall back to the memory-mapped copy. Adding the checks in the Java layer might preclude some cases where the system call would actually succeed.

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

PR: https://git.openjdk.java.net/jdk/pull/8733


More information about the nio-dev mailing list