public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Junho Ryu <jayr@google.com>
To: xfs@oss.sgi.com
Cc: tytso@mit.edu, hughd@google.com, branto@redhat.com,
	Junho Ryu <jayr@google.com>
Subject: [PATCH 08/10] xfstests: check O_DIRECT support before testing direct I/O
Date: Tue, 10 Dec 2013 12:11:59 -0800	[thread overview]
Message-ID: <1386706321-15795-9-git-send-email-jayr@google.com> (raw)
In-Reply-To: <1386706321-15795-1-git-send-email-jayr@google.com>

Some filesystems do not support O_DIRECT.  Check whether TEST_DIR supports it
by running xfs_io with and without -d flag.

Signed-off-by: Junho Ryu <jayr@google.com>
---
 common/rc         | 15 +++++++++++++++
 tests/generic/091 |  1 +
 tests/generic/130 |  1 +
 tests/generic/133 |  1 +
 tests/generic/135 |  1 +
 tests/generic/226 |  1 +
 tests/generic/263 |  1 +
 tests/generic/299 |  1 +
 tests/generic/300 |  1 +
 9 files changed, 23 insertions(+)

diff --git a/common/rc b/common/rc
index 4d46008..02c47ea 100644
--- a/common/rc
+++ b/common/rc
@@ -1185,6 +1185,7 @@ _require_aiodio()
         AIO_TEST=src/aio-dio-regress/$1
         [ -x $AIO_TEST ] || _notrun "$AIO_TEST not built"
     fi
+    _require_xfs_io_direct
 }
 
 # run an aio-dio program
@@ -1323,6 +1324,20 @@ _require_xfs_io_fiemap()
 		_notrun "xfs_io fiemap command failed (no fs support?)"
 }
 
+# check that xfs_io, kernel and filesystem support direct I/O
+_require_xfs_io_direct()
+{
+	testfile=$TEST_DIR/$$.direct
+	$XFS_IO_PROG -F -f -c "pwrite 0 20k" $testfile 2>&1
+	if [ $? -eq 0 ]; then
+		$XFS_IO_PROG -F -f -d -c "pwrite 0 20k" $testfile 2>&1
+		if [ $? -ne 0 ]; then
+			_notrun "O_DIRECT is not supported"
+		fi
+	fi
+	rm -f $testfile 2>&1 > /dev/null
+}
+
 # Check that a fs has enough free space (in 1024b blocks)
 #
 _require_fs_space()
diff --git a/tests/generic/091 b/tests/generic/091
index bb176f1..926042d 100755
--- a/tests/generic/091
+++ b/tests/generic/091
@@ -38,6 +38,7 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
 # real QA test starts here
 _supported_fs generic
 _supported_os Linux
+_require_xfs_io_direct
 
 rm -f $seqres.full
 
diff --git a/tests/generic/130 b/tests/generic/130
index 8367dc7..f9c885f 100755
--- a/tests/generic/130
+++ b/tests/generic/130
@@ -50,6 +50,7 @@ _supported_os Linux IRIX
 
 _require_scratch
 _require_sparse_files
+_require_xfs_io_direct
 
 _scratch_mkfs >/dev/null 2>&1
 _scratch_mount
diff --git a/tests/generic/133 b/tests/generic/133
index 7fb1695..d858756 100755
--- a/tests/generic/133
+++ b/tests/generic/133
@@ -38,6 +38,7 @@ trap "exit \$status" 0 1 2 3 15
 # real QA test starts here
 _supported_fs generic
 _supported_os Linux IRIX
+_require_xfs_io_direct
 
 echo "Buffered writer, buffered reader"
 $XFS_IO_PROG -f -d -c 'pwrite -b 64k 0 512m' $TEST_DIR/io_test > /dev/null
diff --git a/tests/generic/135 b/tests/generic/135
index 4a8b690..04ceebf 100755
--- a/tests/generic/135
+++ b/tests/generic/135
@@ -39,6 +39,7 @@ trap "exit \$status" 0 1 2 3 15
 _supported_fs generic
 _supported_os Linux IRIX
 
+_require_xfs_io_direct
 _require_scratch
 _scratch_mkfs >/dev/null 2>&1 || _fail "mkfs failed"
 _scratch_mount > /dev/null 2>&1 || _fail "mount failed"
diff --git a/tests/generic/226 b/tests/generic/226
index 3514965..0fbaea7 100755
--- a/tests/generic/226
+++ b/tests/generic/226
@@ -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_xfs_io_direct
 
 # real QA test starts here
 rm -f $seqres.full
diff --git a/tests/generic/263 b/tests/generic/263
index bc59865..7bfe3ed 100755
--- a/tests/generic/263
+++ b/tests/generic/263
@@ -38,6 +38,7 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
 # real QA test starts here
 _supported_fs generic
 _supported_os Linux
+_require_xfs_io_direct
 
 rm -f $seqres.full
 
diff --git a/tests/generic/299 b/tests/generic/299
index 14cce96..f2a83ee 100755
--- a/tests/generic/299
+++ b/tests/generic/299
@@ -43,6 +43,7 @@ _supported_fs generic
 _supported_os Linux
 _need_to_be_root
 _require_scratch
+_require_xfs_io_direct
 
 NUM_JOBS=$((4*LOAD_FACTOR))
 BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
diff --git a/tests/generic/300 b/tests/generic/300
index 7c60728..006c214 100755
--- a/tests/generic/300
+++ b/tests/generic/300
@@ -43,6 +43,7 @@ _supported_fs generic
 _supported_os Linux
 _need_to_be_root
 _require_scratch
+_require_xfs_io_direct
 
 NUM_JOBS=$((4*LOAD_FACTOR))
 BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
-- 
1.8.5.1

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  parent reply	other threads:[~2013-12-10 20:12 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-10 20:11 [PATCH 00/10] Add tmpfs filesystem support Junho Ryu
2013-12-10 20:11 ` [PATCH 01/10] xfstests: Add tmpfs support Junho Ryu
2013-12-11  7:40   ` Christoph Hellwig
2013-12-17 16:40   ` Rich Johnston
2013-12-10 20:11 ` [PATCH 02/10] xfstests: use mount point instead of device name Junho Ryu
2013-12-11  7:42   ` Christoph Hellwig
2013-12-10 20:11 ` [PATCH 03/10] xfstests: _scratch_mkfs_sized() for tmpfs Junho Ryu
2013-12-11  7:44   ` Christoph Hellwig
2013-12-10 20:11 ` [PATCH 04/10] xfstests: increase tmpfs memory size Junho Ryu
2013-12-11  7:44   ` Christoph Hellwig
2013-12-10 20:11 ` [PATCH 05/10] xfstests: do not unmount tmpfs during remount Junho Ryu
2013-12-11  7:46   ` Christoph Hellwig
2013-12-11 22:40     ` Dave Chinner
2013-12-12  0:16       ` Theodore Ts'o
2013-12-12  0:53         ` Dave Chinner
2013-12-12 18:01       ` Christoph Hellwig
2013-12-12 22:56         ` Dave Chinner
2013-12-13  0:00           ` Junho Ryu
2013-12-13  1:41             ` Dave Chinner
2013-12-13 11:12               ` Christoph Hellwig
2013-12-13  4:56           ` Theodore Ts'o
2013-12-13 11:04           ` Christoph Hellwig
2013-12-10 20:11 ` [PATCH 06/10] xfstests: fix generic/225 to check fiemap support Junho Ryu
2013-12-11  7:46   ` Christoph Hellwig
2013-12-11 22:42     ` Dave Chinner
2013-12-12 18:01       ` Christoph Hellwig
2013-12-12 22:44         ` Junho Ryu
2013-12-12 23:00           ` Dave Chinner
2013-12-10 20:11 ` [PATCH 07/10] xfstests: fix generic/127 to call _cleanup() only once Junho Ryu
2013-12-11  7:47   ` Christoph Hellwig
2013-12-10 20:11 ` Junho Ryu [this message]
2013-12-11  7:47   ` [PATCH 08/10] xfstests: check O_DIRECT support before testing direct I/O Christoph Hellwig
2013-12-10 20:12 ` [PATCH 09/10] xfstests: add executable permission to tests Junho Ryu
2013-12-11  7:48   ` Christoph Hellwig
2013-12-10 20:12 ` [PATCH 10/10] xfstests: skip parts of tests which cannot work on tmpfs Junho Ryu
2013-12-11  7:51   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1386706321-15795-9-git-send-email-jayr@google.com \
    --to=jayr@google.com \
    --cc=branto@redhat.com \
    --cc=hughd@google.com \
    --cc=tytso@mit.edu \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox