Proposal for adding O_DIRECT support into JDK 9

Lu, Yingqi at
Wed Aug 9 22:46:09 UTC 2017

Dear All,

Here is our most recent version of the DirectIO patch.

The feature has been enabled and tested for Windows, Linux, MacOS and Solaris.

Please review it and let us know your feedback and comments.

Thank you very much for your help!



From: Lu, Yingqi
Sent: Wednesday, November 16, 2016 2:15 PM
To: Lu, Yingqi < at>; Alan Bateman <Alan.Bateman at>
Cc: Kharbas, Kishor <kishor.kharbas at>; David Holmes <david.holmes at>; core-libs-dev at; nio-dev at; Thomas Stüfe <thomas.stuefe at>; Kaczmarek, Eric <eric.kaczmarek at>
Subject: RE: Proposal for adding O_DIRECT support into JDK 9

Hi All,

Our most recent version of our DirectIO patch is available at

In this version, we have modified the following items:

1.       Remove ByteBuffer.allocateDirectAligned() and ByteBuffer.isAligned(). Instead, using existing APIs alignmentOffset() and alignedSlice()

2.       Use Block Size as the alignment value instead of OS page size

3.       Create a function named getBlockSize from FileStore class

4.       Implement DirectIO for Windows

5.       JTreg test passed for Windows, Linux and OS X with regarding to the DirectIO changes we made

Please let us know your comments and feedback. Thank you very much for your consideration!


From: nio-dev [mailto:nio-dev-bounces at] On Behalf Of Lu, Yingqi
Sent: Sunday, November 06, 2016 9:37 AM
To: Alan Bateman <Alan.Bateman at<mailto:Alan.Bateman at>>
Cc: Kharbas, Kishor <kishor.kharbas at<mailto:kishor.kharbas at>>; David Holmes <david.holmes at<mailto:david.holmes at>>; core-libs-dev at<mailto:core-libs-dev at>; nio-dev at<mailto:nio-dev at>; Thomas Stüfe <thomas.stuefe at<mailto:thomas.stuefe at>>; Kaczmarek, Eric <eric.kaczmarek at<mailto:eric.kaczmarek at>>
Subject: Re: Proposal for adding O_DIRECT support into JDK 9

Hi Alan,

Thank you very much for your suggestion. FileStore is a better home for the alignment value. We will use It in our next version of the patch and update here for review soon.

Sent from my iPhone
On Nov 6, 2016, at 9:04 AM, Alan Bateman <Alan.Bateman at<mailto:Alan.Bateman at>> wrote:
On 06/11/2016 15:51, Lu, Yingqi wrote:
Another approach might be use ioctl to get the block size and use that as the alignment value. I think ioctl is available on UNIX based OSes (please chime in if I miss any OS here) and has a similar call for Windows named DeviceIoControl. The request code of ioctl is different from OS to OS, but we could address that in the native code.

A possible approach (I think I mentioned this in one of the early mails) is to have FileStore expose the block size that can be use to align and size the buffer.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nio-dev mailing list