Proposal for adding O_DIRECT support into JDK 9

Lu, Yingqi yingqi.lu at intel.com
Fri Sep 8 16:12:10 UTC 2017


Hi Volker,

Sorry for the confusion. Brian's patch is patching on top of your patch. I already included your patch in webrev.08. However, it has issue building on MacOS. Brian's patch fixed it. I will incorporate Brian's patch into webrev.09 which will be online sometime today.

Please let me know if you have any questions.

Thanks,
Lucy

>-----Original Message-----
>From: Volker Simonis [mailto:volker.simonis at gmail.com]
>Sent: Friday, September 08, 2017 2:58 AM
>To: Brian Burkhalter <brian.burkhalter at oracle.com>
>Cc: Lu, Yingqi <yingqi.lu at intel.com>; nio-dev at openjdk.java.net
>Subject: Re: Proposal for adding O_DIRECT support into JDK 9
>
>On Thu, Sep 7, 2017 at 8:38 PM, Brian Burkhalter <brian.burkhalter at oracle.com>
>wrote:
>> Hi Lucy,
>>
>> On Sep 6, 2017, at 11:38 AM, Lu, Yingqi <yingqi.lu at intel.com> wrote:
>>
>> The webrev.08 is available at
>> http://cr.openjdk.java.net/~kkharbas/8164900/webrev.08/
>>
>> It supposes to address the following the issues. Please let me know if
>> there is anything missing.
>>
>>
>> I was off yesterday so I need to catch up here.
>>
>> On Sep 7, 2017, at 12:52 AM, huaming.li at oracle.com wrote:
>>
>> I applied the patch, face following compilation error, I worked on
>> Mac, Darwin Kernel Version 16.7.0.
>>
>>
>/workspace/jdk/jdk10/jdk/src/java.base/unix/classes/sun/nio/fs/UnixChannelFac
>tory.java:247:
>> error: cannot find symbol
>>             oflags |= O_DIRECT;
>>                       ^
>>   symbol:   variable O_DIRECT
>>   location: class UnixChannelFactory
>>
>> The same failure occurs of course on Solaris. In the build phase it is
>> resolved by
>>
>> ---
>> a/src/java.base/unix/classes/sun/nio/fs/UnixConstants.java.template
>> +++ b/src/java.base/unix/classes/sun/nio/fs/UnixConstants.java.templat
>> +++ e
>> @@ -72,6 +72,9 @@
>>
>>
>>
>>  #ifdef O_DIRECT
>>      static final int PREFIX_O_DIRECT = O_DIRECT;
>> +#else
>> +    // not supported (dummy values will not be used at runtime).
>> +    static final int PREFIX_O_DIRECT = 00;
>>  #endif
>>
>>
>>
>>      static final int PREFIX_S_IAMB =
>>
>
>Sorry but this is now getting a little confusing as it seems we have two different
>mail threads for this topic.
>
>To resolve the build issue we not only need the patch proposed by Brian, but also
>the following build patch which I've already sent you four days before on the
>other mail thread [1]:
>
>The problem on Linux is caused by the fact that the build doesn't use "-
>D_GNU_SOURCE" when processing UnixConstants.java.template and therefore
>"O_DIRECT" isn't visible. In contrast, the compilation of "FileDispatcherImpl.c"
>always uses "-D_GNU_SOURCE", so you can freely access "O_DIRECT".
>
>A quick fix is the following:
>
>diff -r 0c49baac8805 make/gensrc/GensrcMisc.gmk
>--- a/make/gensrc/GensrcMisc.gmk        Wed Aug 30 18:54:50 2017 +0200
>+++ b/make/gensrc/GensrcMisc.gmk        Mon Sep 04 19:37:35 2017 +0200
>@@ -63,7 +63,7 @@
> define generate-preproc-src
>        $(call MakeDir, $(@D))
>        ( $(NAWK) '/@@END_COPYRIGHT@@/{exit}1' $< && \
>-         $(CPP) $(CPP_FLAGS) $(SYSROOT_CFLAGS) $< \
>+         $(CPP) $(CPP_FLAGS) $(SYSROOT_CFLAGS) $(CFLAGS_JDKLIB) $< \
>              2> >($(GREP) -v '^$(<F)$$' >&2) \
>              | $(NAWK) '/@@START_HERE@@/,0' \
>              |  $(SED) -e 's/@@START_HERE@@/\/\/ AUTOMATICALLY GENERATED
>FILE - DO NOT EDIT/' \
>
>which worked for me on Linux/Solaris/AIX (haven't tested on Mac).
>
>I think it was always a mistake that we haven't generated the UnixConstants with
>the same C-Flags that we've also used to compile the files which used them. It
>was probably just luck that we've not run into problems until now.
>
>[1] http://mail.openjdk.java.net/pipermail/nio-dev/2017-September/004478.html
>
>> I am currently running a build+regression job on Linux, macOS,
>> Solaris, and Windows.
>>
>> Thanks,
>>
>> Brian


More information about the nio-dev mailing list