public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Goldwyn Rodrigues <rgoldwyn@suse.de>
To: darrick.wong@oracle.com, eguan@redhat.com
Cc: fstests@vger.kernel.org, Goldwyn Rodrigues <rgoldwyn@suse.com>
Subject: [PATCH 1/3] Check pwrite parameters
Date: Wed, 29 Nov 2017 10:33:56 -0600	[thread overview]
Message-ID: <20171129163358.19759-1-rgoldwyn@suse.de> (raw)

From: Goldwyn Rodrigues <rgoldwyn@suse.com>

There are some parameters added with xfs_io. Check if the pwrite
parameters are available. For some cases, xfs_io now returns "command
-%c not supported", so added "not supported" to count as error.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>

Change since v2:
 - More comments
 - opts to become local variable

---
 common/rc | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/common/rc b/common/rc
index 4c053a53..90408b7e 100644
--- a/common/rc
+++ b/common/rc
@@ -2035,6 +2035,7 @@ _require_xfs_io_command()
 	shift
 	local param="$*"
 	local param_checked=0
+	local opts=""
 
 	testfile=$TEST_DIR/$$.xfs_io
 	case $command in
@@ -2079,6 +2080,15 @@ _require_xfs_io_command()
 		echo $testio | grep -q "invalid option" && \
 			_notrun "xfs_io $command support is missing"
 		;;
+	"pwrite")
+		# -N (RWF_NOWAIT) only works with direct I/O writes
+		if [ "$param" == "-N" ]; then
+			opts+=" -d"
+		fi
+		testio=`$XFS_IO_PROG -f $opts -c "pwrite $param 0 1M" \
+			$testfile 2>&1`
+		param_checked=1
+		;;
 	"scrub"|"repair")
 		testio=`$XFS_IO_PROG -x -c "$command probe 0" $TEST_DIR 2>&1`
 		echo $testio | grep -q "Inappropriate ioctl" && \
@@ -2109,7 +2119,9 @@ _require_xfs_io_command()
 		$XFS_IO_PROG -c "help $command" | grep -q "^ $param --" || \
 			_notrun "xfs_io $command doesn't support $param"
 	else
-		echo $testio | grep -q "invalid option" && \
+		# xfs_io could result in "command %c not supported" if it was
+		# built on kernels not supporting pwritev2() calls
+		echo $testio | grep -q "\(invalid option\|not supported\)" && \
 			_notrun "xfs_io $command doesn't support $param"
 	fi
 }
-- 
2.14.2


             reply	other threads:[~2017-11-29 16:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-29 16:33 Goldwyn Rodrigues [this message]
2017-11-29 16:33 ` [PATCH 2/3] generic/470: Test RWF_NOWAIT Goldwyn Rodrigues
2017-12-06 10:05   ` Eryu Guan
2017-12-06 16:35     ` Goldwyn Rodrigues
2017-12-07  4:17       ` Eryu Guan
2017-12-07 11:57         ` Goldwyn Rodrigues
2017-11-29 16:33 ` [PATCH 3/3] generic/471: Partial direct write test Goldwyn Rodrigues
2017-12-06  9:55 ` [PATCH 1/3] Check pwrite parameters Eryu Guan
  -- strict thread matches above, loose matches on Subject: below --
2017-11-27 18:49 Goldwyn Rodrigues
2017-11-29  9:49 ` Eryu Guan

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=20171129163358.19759-1-rgoldwyn@suse.de \
    --to=rgoldwyn@suse.de \
    --cc=darrick.wong@oracle.com \
    --cc=eguan@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=rgoldwyn@suse.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