Proposal for adding O_DIRECT support into JDK 9

Lu, Yingqi yingqi.lu at intel.com
Fri Sep 15 23:01:36 UTC 2017


Hmm, let me take a look into this MacOS issue. I am wondering if we will need to do "purge" before the testing.

Thanks,
Lucy

From: Brian Burkhalter [mailto:brian.burkhalter at oracle.com]
Sent: Friday, September 15, 2017 3:53 PM
To: Lu, Yingqi <yingqi.lu at intel.com>
Cc: Alan Bateman <Alan.Bateman at oracle.com>; nio-dev at openjdk.java.net
Subject: Re: Proposal for adding O_DIRECT support into JDK 9

Hi Lucy,

This change works:

--- a/test/java/nio/channels/FileChannel/directio/libDirectIO.c
+++ b/test/java/nio/channels/FileChannel/directio/libDirectIO.c
@@ -71,7 +71,7 @@

     const char* path = (*env)->GetStringUTFChars(env, file_path, JNI_FALSE);

-    int fd = open(path, 'r');
+    int fd = open(path, 'r', 0600);

     (*env)->ReleaseStringUTFChars(env, file_path, path);

All five tests pass in my Ubuntu 16.04 64-bit VM.

On my macOS system I also observed this failure:

java.lang.RuntimeException: DirectIO is not working properly with write. File still exists in cache!
        at DirectIOTest.main(DirectIOTest.java:117)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at com.sun.javatest.regtest.agent.MainActionHelper$SameVMRunnable.run(MainActionHelper.java:230)
        at java.base/java.lang.Thread.run(Thread.java:844)

Neither this nor the other failure on macOS occurs every time, i.e., they appear to be intermittent.

Thanks,

Brian

On Sep 15, 2017, at 3:45 PM, Lu, Yingqi <yingqi.lu at intel.com<mailto:yingqi.lu at intel.com>> wrote:


Could you please replace the line 78 in jdk/test/java/nio/channels/FileChannel/directio/libDirectIO.c with the following line and give it a try on your Ubuntu box? I tested it on my CentOS system, it does not complain.

    int fd = open(path, 'r', 0600);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20170915/c12c4427/attachment.html>


More information about the nio-dev mailing list