Skip to contentSkip to conversation

xfstests: Provide test whether fs supports direct IO and use it

PATCH In review Jan Kara 2 participants 3 messages Aug 16, 2012 – Aug 20, 2012

lore
Share & tools
lore

Jan Kara

author
#0 lore raw

PATCH 1/1 xfstests: Provide test whether fs supports direct IO and use it

ext3 in data=journal mode does not support direct IO. Tests which use direct IO fail due to that. Provide function checking whether direct IO is supported and skip tests needing direct IO if it's not.

There are a few tests which use direct IO but would be meaningful even without it since they test several different things. Making these tests useful for filesystems without dio support is left for future if somebody is interested...

---
 091       |    1 +
 113       |    1 +
 130       |    1 +
 133       |    1 +
 135       |    1 +
 198       |    1 +
 208       |    1 +
 209       |    1 +
 210       |    1 +
 226       |    1 +
 239       |    1 +
 240       |    1 +
 263       |    1 +
 common.rc |   12 ++++++++++++
 14 files changed, 25 insertions(+), 0 deletions(-)
091 +1 -0
index 8a14602..d197fec 100755
@@ -39,6 +39,7 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
 # real QA test starts here
 _supported_fs generic
 _supported_os Linux
+_require_direct_io
 
 rm -f $seq.full
 
113 +1 -0
index b2ec510..e1c2cfa 100755
@@ -82,6 +82,7 @@ _supported_os Linux
 
 [ -x $here/ltp/aio-stress ] || _notrun "aio-stress not built for this platform"
 
+_require_direct_io
 _setup_testdir
 
 echo "brevity is wit..."
130 +1 -0
index ea5270d..25638f0 100755
@@ -57,6 +57,7 @@ _supported_os Linux IRIX
 
 _require_scratch
 _require_sparse_files
+_require_direct_io
 
 _setup_testdir
 
133 +1 -0
index 9dbcb64..288e510 100755
@@ -44,6 +44,7 @@ _cleanup()
 # real QA test starts here
 _supported_fs generic
 _supported_os Linux IRIX
+_require_direct_io
 
 _setup_testdir
 
135 +1 -0
index 976619d..2dfda17 100755
@@ -48,6 +48,7 @@ _supported_os Linux IRIX
 
 _setup_testdir
 _require_scratch
+_require_direct_io
 _scratch_mkfs >/dev/null 2>&1
 
 _umount_mount()
198 +1 -0
index 2c72677..e4532b4 100755
@@ -44,6 +44,7 @@ _cleanup()
 
 _supported_fs generic
 _supported_os Linux
+_require_direct_io
 _require_aiodio aiodio_sparse2
 
 echo "Silence is golden."
208 +1 -0
index ca01558..10c74ef 100755
@@ -45,6 +45,7 @@ _cleanup()
 
 _supported_fs generic
 _supported_os Linux
+_require_direct_io
 
 _run_aiodio aio-dio-invalidate-failure
 
209 +1 -0
index 650e300..d2832d7 100755
@@ -45,6 +45,7 @@ _cleanup()
 
 _supported_fs generic
 _supported_os Linux
+_require_direct_io
 
 _run_aiodio aio-dio-invalidate-readahead
 
210 +1 -0
index a0873f8..71a298d 100755
@@ -45,6 +45,7 @@ _cleanup()
 
 _supported_fs generic
 _supported_os Linux
+_require_direct_io
 
 _run_aiodio aio-dio-subblock-eof-read
 
226 +1 -0
index 6f28ac9..799c4d9 100755
@@ -38,6 +38,7 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
 _supported_fs generic
 _supported_os Linux IRIX
 _require_scratch
+_require_direct_io
 
 # real QA test starts here
 rm -f $seq.full
239 +1 -0
index 6457c46..0a6754c 100755
@@ -46,6 +46,7 @@ _supported_fs generic
 _supported_os Linux
 
 _require_sparse_files
+_require_direct_io
 _require_aiodio aio-dio-hole-filling-race
 
 echo "Silence is golden"
240 +1 -0
index dafcef3..97d9e7d 100755
@@ -52,6 +52,7 @@ _supported_fs generic
 _supported_os Linux
 
 _require_sparse_files
+_require_direct_io
 _require_aiodio aiodio_sparse2
 
 echo "Silence is golden."
263 +1 -0
index 315a938..6453163 100755
@@ -39,6 +39,7 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
 # real QA test starts here
 _supported_fs generic
 _supported_os Linux
+_require_direct_io
 
 rm -f $seq.full
 
common.rc +12 -0
index 602513a..720d137 100644
@@ -1027,6 +1027,18 @@ _require_sparse_files()
     esac
 }
 
+#
+# Check if the filesystem supports direct IO
+#
+_require_direct_io()
+{
+	testfile=$TEST_DIR/$$.dio
+	testio=`$XFS_IO_PROG -F -f -d -c "" $testfile 2>&1`
+	rm -f $testfile 2>&1 > /dev/null
+	echo $testio | grep -q "Invalid argument" && \
+		_notrun "direct IO not supported"
+}
+
 # check that a FS on a device is mounted
 # if so, return mount point
 #
Signature · 6 lines
1.7.1

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#1 lore raw
Quoted 8 lines · Jan Kara

ext3 in data=journal mode does not support direct IO. Tests which use direct IO fail due to that. Provide function checking whether direct IO is supported and skip tests needing direct IO if it's not.

There are a few tests which use direct IO but would be meaningful even without it since they test several different things. Making these tests useful for filesystems without dio support is left for future if somebody is interested...

So this is just for the generic tests? There's a lot more XFS specific tests that require direct IO that aren't in this patch. ;)

Also, I suspect that you've missed all the tests that run fsstress, because that uses direct IO as well. There's probably others as well. No doub they didn't produce test failures, but it's entirely possible that they are not testing what they are supposed to be testing as a result of direct IO failing silently...

198 _cleanup() · line 48

Quoted 8 lines
198 +1 -0
@@ -44,6 +44,7 @@ _cleanup()
 
 _supported_fs generic
 _supported_os Linux
+_require_direct_io
 _require_aiodio aiodio_sparse2

For all the tests are already call _require_aiodio, just embed the _require_dio test inside that one.

198 _cleanup()

Quoted 8 lines
198 +7 -0
+#
+# Check if the filesystem supports direct IO
+#
+_require_direct_io()
+{
+	testfile=$TEST_DIR/$$.dio
+	testio=`$XFS_IO_PROG -F -f -d -c "" $testfile 2>&1`

This assumes that both the test device and the scratch device are both using the same mount options, right?

Some tests use the scratch device with different mount options, so may actually allow direct IO to work even though the test device fails. I haven't looked at whether any of the tests in this patch do that, but if they do then you might also need a _require_scratch_dio function for those tests....

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
author
#2 lore raw
Quoted 5 lines · Dave Chinner
Quoted 4 lines · Jan Kara

ext3 in data=journal mode does not support direct IO. Tests which use direct IO fail due to that. Provide function checking whether direct IO is supported and skip tests needing direct IO if it's not.

Quoted 7 lines
Quoted 4 lines

There are a few tests which use direct IO but would be meaningful even without it since they test several different things. Making these tests useful for filesystems without dio support is left for future if somebody is interested...

So this is just for the generic tests? There's a lot more XFS specific tests that require direct IO that aren't in this patch. ;)

Right but I was a lazy bastard and went just through the tests that
failed for me, checked that they failed due to direct IO, and added the requirement. I can go through the XFS specific tests and add the requirement but frankly I find a little use in that.

Quoted 5 lines

Also, I suspect that you've missed all the tests that run fsstress, because that uses direct IO as well. There's probably others as well. No doub they didn't produce test failures, but it's entirely possible that they are not testing what they are supposed to be testing as a result of direct IO failing silently...

It's not failing silently. For ext3 we return EINVAL from open so I'd
expect reasonably written tests to complain.

Quoted 11 lines

198 _cleanup() · line 48

Quoted 8 lines
198 +1 -0
@@ -44,6 +44,7 @@ _cleanup()
 
 _supported_fs generic
 _supported_os Linux
+_require_direct_io
 _require_aiodio aiodio_sparse2

For all the tests are already call _require_aiodio, just embed the _require_dio test inside that one.

OK, will do.

Quoted 11 lines

198 _cleanup()

Quoted 7 lines
198 +7 -0
+#
+# Check if the filesystem supports direct IO
+#
+_require_direct_io()
+{
+	testfile=$TEST_DIR/$$.dio
+	testio=`$XFS_IO_PROG -F -f -d -c "" $testfile 2>&1`

This assumes that both the test device and the scratch device are both using the same mount options, right?

Quoted 5 lines

Some tests use the scratch device with different mount options, so may actually allow direct IO to work even though the test device fails. I haven't looked at whether any of the tests in this patch do that, but if they do then you might also need a _require_scratch_dio function for those tests....

I went through all the changed tests and none of them seem to play tricks
with mount options so _require_direct_io should be fine for all of them.

Thanks for review, I'll send a new version of the patch after a test run
finishes.

Honza

Signature · 7 lines
Jan Kara <[email protected]>
SUSE Labs, CR

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs