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 Wed, 7 Sep 2022 17:00:23 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> src/java.base/macosx/classes/sun/nio/fs/BsdFileSystem.java line 141:
>> 
>>> 139:         // cancellation is not possible, or attributes are not to be copied
>>> 140:         if (!cloneFileNotSupported && addressToPollForCancel == 0 &&
>>> 141:             flags.copyPosixAttributes) {
>> 
>> This will need some thought as this means it will only be used when Files.copy is invoked with the COPY_ATTRIBUTES option.
>
> `clonefile` appears to copy all attributes so if it is acceptable for that to occur if `COPY_ATTRIBUTES` is not set, then the `flags.copyPosixAttributes` check could be removed.

My opinion is that the improved throughput outweighs any detriment from copying attributes when COPY_ATTRIBUTES is not specified and so the flags.copyPosixAttributes check should be removed.

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

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


More information about the nio-dev mailing list