* [PATCH] xfstests: Provide test whether fs supports direct IO and use it
@ 2012-08-16 13:56 Jan Kara
2012-08-16 23:04 ` Dave Chinner
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2012-08-16 13:56 UTC (permalink / raw)
To: xfs; +Cc: 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...
Signed-off-by: Jan Kara <jack@suse.cz>
---
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(-)
diff --git a/091 b/091
index 8a14602..d197fec 100755
--- a/091
+++ b/091
@@ -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
diff --git a/113 b/113
index b2ec510..e1c2cfa 100755
--- a/113
+++ b/113
@@ -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..."
diff --git a/130 b/130
index ea5270d..25638f0 100755
--- a/130
+++ b/130
@@ -57,6 +57,7 @@ _supported_os Linux IRIX
_require_scratch
_require_sparse_files
+_require_direct_io
_setup_testdir
diff --git a/133 b/133
index 9dbcb64..288e510 100755
--- a/133
+++ b/133
@@ -44,6 +44,7 @@ _cleanup()
# real QA test starts here
_supported_fs generic
_supported_os Linux IRIX
+_require_direct_io
_setup_testdir
diff --git a/135 b/135
index 976619d..2dfda17 100755
--- a/135
+++ b/135
@@ -48,6 +48,7 @@ _supported_os Linux IRIX
_setup_testdir
_require_scratch
+_require_direct_io
_scratch_mkfs >/dev/null 2>&1
_umount_mount()
diff --git a/198 b/198
index 2c72677..e4532b4 100755
--- a/198
+++ b/198
@@ -44,6 +44,7 @@ _cleanup()
_supported_fs generic
_supported_os Linux
+_require_direct_io
_require_aiodio aiodio_sparse2
echo "Silence is golden."
diff --git a/208 b/208
index ca01558..10c74ef 100755
--- a/208
+++ b/208
@@ -45,6 +45,7 @@ _cleanup()
_supported_fs generic
_supported_os Linux
+_require_direct_io
_run_aiodio aio-dio-invalidate-failure
diff --git a/209 b/209
index 650e300..d2832d7 100755
--- a/209
+++ b/209
@@ -45,6 +45,7 @@ _cleanup()
_supported_fs generic
_supported_os Linux
+_require_direct_io
_run_aiodio aio-dio-invalidate-readahead
diff --git a/210 b/210
index a0873f8..71a298d 100755
--- a/210
+++ b/210
@@ -45,6 +45,7 @@ _cleanup()
_supported_fs generic
_supported_os Linux
+_require_direct_io
_run_aiodio aio-dio-subblock-eof-read
diff --git a/226 b/226
index 6f28ac9..799c4d9 100755
--- a/226
+++ b/226
@@ -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
diff --git a/239 b/239
index 6457c46..0a6754c 100755
--- a/239
+++ b/239
@@ -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"
diff --git a/240 b/240
index dafcef3..97d9e7d 100755
--- a/240
+++ b/240
@@ -52,6 +52,7 @@ _supported_fs generic
_supported_os Linux
_require_sparse_files
+_require_direct_io
_require_aiodio aiodio_sparse2
echo "Silence is golden."
diff --git a/263 b/263
index 315a938..6453163 100755
--- a/263
+++ b/263
@@ -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
diff --git a/common.rc b/common.rc
index 602513a..720d137 100644
--- a/common.rc
+++ b/common.rc
@@ -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
#
--
1.7.1
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xfstests: Provide test whether fs supports direct IO and use it
2012-08-16 13:56 [PATCH] xfstests: Provide test whether fs supports direct IO and use it Jan Kara
@ 2012-08-16 23:04 ` Dave Chinner
2012-08-20 16:40 ` Jan Kara
0 siblings, 1 reply; 3+ messages in thread
From: Dave Chinner @ 2012-08-16 23:04 UTC (permalink / raw)
To: Jan Kara; +Cc: xfs
On Thu, Aug 16, 2012 at 03:56:31PM +0200, Jan Kara wrote:
> 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...
> --- a/198
> +++ b/198
> @@ -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.
>
> +#
> +# 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.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xfstests: Provide test whether fs supports direct IO and use it
2012-08-16 23:04 ` Dave Chinner
@ 2012-08-20 16:40 ` Jan Kara
0 siblings, 0 replies; 3+ messages in thread
From: Jan Kara @ 2012-08-20 16:40 UTC (permalink / raw)
To: Dave Chinner; +Cc: Jan Kara, xfs
On Fri 17-08-12 09:04:00, Dave Chinner wrote:
> On Thu, Aug 16, 2012 at 03:56:31PM +0200, Jan Kara wrote:
> > 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. ;)
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.
> 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.
> > --- a/198
> > +++ b/198
> > @@ -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.
> > +#
> > +# 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....
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
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-08-20 16:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-16 13:56 [PATCH] xfstests: Provide test whether fs supports direct IO and use it Jan Kara
2012-08-16 23:04 ` Dave Chinner
2012-08-20 16:40 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox