]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
Check O_DIRECT support before testing direct I/O
authorJunho Ryu <jayr@google.com>
Tue, 16 Dec 2014 03:01:06 +0000 (14:01 +1100)
committerDave Chinner <david@fromorbit.com>
Tue, 16 Dec 2014 03:01:06 +0000 (14:01 +1100)
Some filesystems do not support O_DIRECT.  Check whether TEST_DIR supports
it by running xfs_io with -d flag.

Signed-off-by: Junho Ryu <jayr@google.com>
Signed-off-by: Dushan Tcholich <dusanc@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
common/rc
tests/generic/091
tests/generic/130
tests/generic/133
tests/generic/135
tests/generic/226
tests/generic/263
tests/generic/299
tests/generic/300

index cddc8487dbd3fb40692fd4e44238e398cae4ee1b..82a91c214f4c656cccc7f6b20a791dcc8631196e 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -1402,6 +1402,7 @@ _require_aiodio()
         AIO_TEST=src/aio-dio-regress/$1
         [ -x $AIO_TEST ] || _notrun "$AIO_TEST not built"
     fi
+    _require_odirect
 }
 
 # run an aio-dio program
@@ -1530,6 +1531,17 @@ _require_xfs_io_command()
                _notrun "xfs_io $command failed (old kernel/wrong fs?)"
 }
 
+# check that kernel and filesystem support direct I/O
+_require_odirect()
+{
+       testfile=$TEST_DIR/$$.direct
+       $XFS_IO_PROG -F -f -d -c "pwrite 0 20k" $testfile > /dev/null 2>&1
+       if [ $? -ne 0 ]; then
+               _notrun "O_DIRECT is not supported"
+       fi
+       rm -f $testfile 2>&1 > /dev/null
+}
+
 # Check that a fs has enough free space (in 1024b blocks)
 #
 _require_fs_space()
index 3775016bbed02b32ead1886c752e8166ce52ff5f..30491bfcfdfe7be9bd79c848cafb98b5bfc7d573 100755 (executable)
@@ -39,6 +39,7 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
 _supported_fs generic
 _supported_os Linux
 _require_test
+_require_odirect
 
 rm -f $seqres.full
 
index 8367dc7d9fde96f878f3cb0afde600a24681631b..1e96630ef5edf4f71c3b42dc1ac1a0c9fdcc39ce 100755 (executable)
@@ -50,6 +50,7 @@ _supported_os Linux IRIX
 
 _require_scratch
 _require_sparse_files
+_require_odirect
 
 _scratch_mkfs >/dev/null 2>&1
 _scratch_mount
index f1d67aa60abce8fab175610d5c2d8d6be418e26c..f1a221e0f50e783a8620d5d44a88df9850980238 100755 (executable)
@@ -39,6 +39,7 @@ trap "exit \$status" 0 1 2 3 15
 _supported_fs generic
 _supported_os Linux IRIX
 _require_test
+_require_odirect
 
 echo "Buffered writer, buffered reader"
 $XFS_IO_PROG -f -d -c 'pwrite -b 64k 0 512m' $TEST_DIR/io_test > /dev/null
index e3b827a89302badc837ce4737ea399f193f036c7..79558f5e695a5fa16fd55d12f9989c4bf619a966 100755 (executable)
@@ -39,6 +39,7 @@ trap "exit \$status" 0 1 2 3 15
 _supported_fs generic
 _supported_os Linux IRIX
 
+_require_odirect
 _require_scratch
 _scratch_mkfs >/dev/null 2>&1
 
index b98e8898da2fed1351874a5aabb07ef413f4c938..4ad56a502e40df7b8f43071393c5262d14b15118 100755 (executable)
@@ -37,6 +37,7 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
 _supported_fs generic
 _supported_os Linux IRIX
 _require_scratch
+_require_odirect
 
 # real QA test starts here
 rm -f $seqres.full
index 6ee21654fb8515527bb38ce17af41c68043f6e97..7584bc7cc9ac89659a0dbca16fd6a283da691200 100755 (executable)
@@ -39,6 +39,7 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
 _supported_fs generic
 _supported_os Linux
 _require_test
+_require_odirect
 
 rm -f $seqres.full
 
index 953f1bd89188a809bc0632106f3843b60ffa4499..0459f42b1e7c513d9babc8bdfde99a8949eabe27 100755 (executable)
@@ -43,6 +43,7 @@ _supported_fs generic
 _supported_os Linux
 _need_to_be_root
 _require_scratch
+_require_odirect
 
 NUM_JOBS=$((4*LOAD_FACTOR))
 BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
index 5234d05a1e39f7461fb91908a690df5b04a5da25..d7523aaeae057906aed326dcdda49437e1844e01 100755 (executable)
@@ -43,6 +43,7 @@ _supported_fs generic
 _supported_os Linux
 _need_to_be_root
 _require_scratch
+_require_odirect
 
 # xfs_io is not required for this test, but it's the best way to verify
 # the test system supports fallocate() for allocation and hole punching