8265231: (fc) ReadDirect and WriteDirect tests fail after fix for JDK-8264821

Reviewed-by: alanb, dcubed, darcy, chegar
diff --git a/test/jdk/java/nio/channels/FileChannel/directio/DirectIOTest.java b/test/jdk/java/nio/channels/FileChannel/directio/DirectIOTest.java
index a4c689e..34f2bac 100644
--- a/test/jdk/java/nio/channels/FileChannel/directio/DirectIOTest.java
+++ b/test/jdk/java/nio/channels/FileChannel/directio/DirectIOTest.java
@@ -47,9 +47,8 @@
 public class DirectIOTest {
 
     private static final int BASE_SIZE = 4096;
-    private static long blockSize;
 
-    private static int testWrite(Path p) throws Exception {
+    private static int testWrite(Path p, long blockSize) throws Exception {
         try (FileChannel fc = FileChannel.open(p, StandardOpenOption.WRITE,
              ExtendedOpenOption.DIRECT)) {
             int bs = (int)blockSize;
@@ -67,7 +66,7 @@
         }
     }
 
-    private static int testRead(Path p) throws Exception {
+    private static int testRead(Path p, long blockSize) throws Exception {
         try (FileChannel fc = FileChannel.open(p, ExtendedOpenOption.DIRECT)) {
             int bs = (int)blockSize;
             int size = Math.max(BASE_SIZE, bs);
@@ -94,17 +93,17 @@
 
     public static void main(String[] args) throws Exception {
         Path p = createTempFile();
-        blockSize = Files.getFileStore(p).getBlockSize();
+        long blockSize = Files.getFileStore(p).getBlockSize();
 
         System.loadLibrary("DirectIO");
 
         try {
-            int size = testWrite(p);
+            int size = testWrite(p, blockSize);
             if (isFileInCache(size, p)) {
                 throw new RuntimeException("DirectIO is not working properly with "
                     + "write. File still exists in cache!");
             }
-            size = testRead(p);
+            size = testRead(p, blockSize);
             if (isFileInCache(size, p)) {
                 throw new RuntimeException("DirectIO is not working properly with "
                     + "read. File still exists in cache!");
diff --git a/test/jdk/java/nio/channels/FileChannel/directio/PreadDirect.java b/test/jdk/java/nio/channels/FileChannel/directio/PreadDirect.java
index 542a495..7de231f 100644
--- a/test/jdk/java/nio/channels/FileChannel/directio/PreadDirect.java
+++ b/test/jdk/java/nio/channels/FileChannel/directio/PreadDirect.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -70,10 +70,6 @@
 
     private static boolean initTests() throws Exception {
         Path p = DirectIOTest.createTempFile();
-        if (!DirectIOTest.isDirectIOSupportedByFS(p)) {
-            Files.delete(p);
-            return false;
-        }
         try {
             FileStore fs = Files.getFileStore(p);
             alignment = (int)fs.getBlockSize();
diff --git a/test/jdk/java/nio/channels/FileChannel/directio/PwriteDirect.java b/test/jdk/java/nio/channels/FileChannel/directio/PwriteDirect.java
index 77ab6e87..b2f85e0 100644
--- a/test/jdk/java/nio/channels/FileChannel/directio/PwriteDirect.java
+++ b/test/jdk/java/nio/channels/FileChannel/directio/PwriteDirect.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,10 +59,6 @@
 
     private static boolean initTests() throws Exception {
         Path p = DirectIOTest.createTempFile();
-        if (!DirectIOTest.isDirectIOSupportedByFS(p)) {
-            Files.delete(p);
-            return false;
-        }
         try {
             FileStore fs = Files.getFileStore(p);
             alignment = (int)fs.getBlockSize();
diff --git a/test/jdk/java/nio/channels/FileChannel/directio/ReadDirect.java b/test/jdk/java/nio/channels/FileChannel/directio/ReadDirect.java
index 6d57f0a..6b854ce 100644
--- a/test/jdk/java/nio/channels/FileChannel/directio/ReadDirect.java
+++ b/test/jdk/java/nio/channels/FileChannel/directio/ReadDirect.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -58,10 +58,6 @@
 
     private static boolean initTests() throws Exception {
         Path p = DirectIOTest.createTempFile();
-        if (!DirectIOTest.isDirectIOSupportedByFS(p)) {
-            Files.delete(p);
-            return false;
-        }
         try {
             FileStore fs = Files.getFileStore(p);
             alignment = (int)fs.getBlockSize();
diff --git a/test/jdk/java/nio/channels/FileChannel/directio/WriteDirect.java b/test/jdk/java/nio/channels/FileChannel/directio/WriteDirect.java
index 3f5efe3..0315fbe 100644
--- a/test/jdk/java/nio/channels/FileChannel/directio/WriteDirect.java
+++ b/test/jdk/java/nio/channels/FileChannel/directio/WriteDirect.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,10 +48,6 @@
 
     private static boolean initTests() throws Exception {
         Path p = DirectIOTest.createTempFile();
-        if (!DirectIOTest.isDirectIOSupportedByFS(p)) {
-            Files.delete(p);
-            return false;
-        }
         try {
             FileStore fs = Files.getFileStore(p);
             alignment = (int)fs.getBlockSize();