Proposal for adding O_DIRECT support into JDK 9
Lu, Yingqi
yingqi.lu at intel.com
Fri Sep 8 16:45:35 UTC 2017
Hi Volker,
Sorry for the confusion again. The change you refer to is the following one or something else?
--- old/make/gensrc/GensrcMisc.gmk 2017-09-06 01:38:06.005049364 -0400
+++ new/make/gensrc/GensrcMisc.gmk 2017-09-06 01:38:05.885049363 -0400
@@ -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/' \
If it is above, it is already in the http://cr.openjdk.java.net/~kkharbas/8164900/webrev.08/make/gensrc/GensrcMisc.gmk.patch. If it is not, please let me know.
I think Brian's patch still define O_DIRECT correctly on Linux since O_DIRECT is defined on Linux, but I might miss something. Please let me know if I misunderstand anything here.
+#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
Thanks,
Lucy
>-----Original Message-----
>From: Volker Simonis [mailto:volker.simonis at gmail.com]
>Sent: Friday, September 08, 2017 9:37 AM
>To: Lu, Yingqi <yingqi.lu at intel.com>
>Cc: Brian Burkhalter <brian.burkhalter at oracle.com>; nio-dev at openjdk.java.net
>Subject: Re: Proposal for adding O_DIRECT support into JDK 9
>
>On Fri, Sep 8, 2017 at 6:12 PM, Lu, Yingqi <yingqi.lu at intel.com> wrote:
>> 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.
>>
>
>Sorry, but I can't see my patch in webrev.08. My fix was in
>make/gensrc/GensrcMisc.gmk which isn't touched in
>http://cr.openjdk.java.net/~kkharbas/8164900/webrev.08/
>
>Brian's fix is OK for platforms which don't define O_DIRECT at all.
>But for Linux it will simply define O_DIRECT to 00 which is wrong! We have to
>generate UnixConstants.java from UnixConstants.java.template with the same
>CPP defines we use for the compilation of the actual C-sources because
>O_DIRECT is only defined on Linux if we are using "-D_GNU_SOURCE".
>
>Regards,
>Volker
>
>> 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/UnixCha
>>>nnelFac
>>>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.templ
>>>> +++ at
>>>> +++ 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.h
>>>tml
>>>
>>>> I am currently running a build+regression job on Linux, macOS,
>>>> Solaris, and Windows.
>>>>
>>>> Thanks,
>>>>
>>>> Brian
More information about the nio-dev
mailing list