Re[2]: Use copy_file_range system call for copying on Linux systems

Ilya Starchenko redux1234567 at mail.ru
Wed Feb 16 17:51:00 UTC 2022


I think we can just check if syscall return ENOSYS and if it’s true fail back to more generic code.
 
--
Ilya Starchenko
 
  
>Wednesday, February 16, 2022 10:42 PM +06:00 from Brian Burkhalter <brian.burkhalter at oracle.com>:
> 
> 
>>On Feb 16, 2022, at 5:40 AM, Alan Bateman < Alan.Bateman at oracle.com > wrote:  
>>On 16/02/2022 13:13, Ilya Starchenko wrote: 
>>> I have suggestion. Copy_file_range() has been introduced in the Linux kernel since version 4.5. system call performs an in-kernel copy between two file descriptors without the additional cost of transferring data from the kernel to user space and then back into the kernel, including NFS(It will have huge performance impact). It copies up to len bytes of data from the source file descriptor fd_in to the target file descriptor fd_out, overwriting any data that exists within the requested range of the target file. Currently we use sendfile, but I think we need to use copy_file_range when possible. What do you think?
>>>  
>>There was brief discussion about this on nio-dev in April 2021. As I recall, there was an issue with the function prototype not being available (I can't recall if it was system include files or glibc). It might be best to start a new discussion there as it may be time to look at it again. 
> 
>Please refer to [1]. The system call copy_file_range() is newer than the version of the Linux headers used to build the JDK. It might be that we could use dlsym() to be able to leverage it where it is available but that would require further investigation.
> 
>Brian
> 
>[1]  https://bugs.openjdk.java.net/browse/JDK-8264744
 


More information about the core-libs-dev mailing list