RFR: 8293122: (fs) Use file cloning in macOS version of Files::copy method [v3]

Brian Burkhalter bpb at openjdk.org
Fri Sep 9 19:46:44 UTC 2022


On Fri, 9 Sep 2022 07:23:39 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> src/java.base/macosx/classes/sun/nio/fs/BsdFileSystem.java line 110:
>> 
>>> 108:             switch (x.errno()) {
>>> 109:                 case ENOTSUP: // cloning not supported by filesystem
>>> 110:                     return IOStatus.UNSUPPORTED;
>> 
>> It might be that `ENOTSUP` should instead result in `UNSUPPORTED_CASE` and that the static variable `cloneFileNotSupported` is unnecessary.
>
> Yes, ENOTSUP depends on the parameters to I think it maps to UNSUPPORTED_CASE. Given that it has to handle ENOTSUP then it may be that the check for the VOL_CAP_INT_CLONE feature isn't needed. You may have to compare the performance of getattrlist to see if it helps when the file systems don't support clone.

ENOTSUP is mapped to UNSUPPORTED_CASE in f51cd186fe624d03ce7c6a4f49140998e2d48322, which also removes getattrlist(). Benchmark testing in Java was inconclusive, but testing C code showed an improvement of only 1 microsecond for checking VOL_CAP_INT_CLONE on a volume which does not supporting cloning as opposed to just letting clonefile() set ENOTSUP. The extra code for getattrlist() does not seem to be worth it.

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

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


More information about the nio-dev mailing list