All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] Check pwrite parameters
@ 2017-11-27 18:49 Goldwyn Rodrigues
  2017-11-27 18:49 ` [PATCH v2 2/3] generic/470: Test RWF_NOWAIT Goldwyn Rodrigues
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Goldwyn Rodrigues @ 2017-11-27 18:49 UTC (permalink / raw)
  To: fstests; +Cc: darrick.wong, Goldwyn Rodrigues

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>
---
 common/rc | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/common/rc b/common/rc
index 4c053a53..b6778f07 100644
--- a/common/rc
+++ b/common/rc
@@ -2079,6 +2079,14 @@ _require_xfs_io_command()
 		echo $testio | grep -q "invalid option" && \
 			_notrun "xfs_io $command support is missing"
 		;;
+	"pwrite")
+		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 +2117,7 @@ _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" && \
+		echo $testio | grep -q "\(invalid option\|not supported\)" && \
 			_notrun "xfs_io $command doesn't support $param"
 	fi
 }
-- 
2.14.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [PATCH 1/3] Check pwrite parameters
@ 2017-11-29 16:33 Goldwyn Rodrigues
  2017-12-06  9:55 ` Eryu Guan
  0 siblings, 1 reply; 8+ messages in thread
From: Goldwyn Rodrigues @ 2017-11-29 16:33 UTC (permalink / raw)
  To: darrick.wong, eguan; +Cc: fstests, Goldwyn Rodrigues

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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-12-06  9:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-27 18:49 [PATCH 1/3] Check pwrite parameters Goldwyn Rodrigues
2017-11-27 18:49 ` [PATCH v2 2/3] generic/470: Test RWF_NOWAIT Goldwyn Rodrigues
2017-11-29 10:25   ` Eryu Guan
2017-11-27 18:49 ` [PATCH v2 3/3] generic/471: Partial direct write test Goldwyn Rodrigues
2017-11-29 10:46   ` Eryu Guan
2017-11-29  9:49 ` [PATCH 1/3] Check pwrite parameters Eryu Guan
2017-11-29 16:33 Goldwyn Rodrigues
2017-12-06  9:55 ` Eryu Guan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.