fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] common/dmlogwrites: Update _require_log_writes_dax() for new dax option
@ 2020-07-15 16:23 Xiao Yang
  2020-07-15 16:23 ` [PATCH v2 2/2] common/rc: Update _exclude_scratch_mount_option() and _require_dm_target() " Xiao Yang
  2020-07-16  5:32 ` [PATCH v2 1/2] common/dmlogwrites: Update _require_log_writes_dax() " Xiao Yang
  0 siblings, 2 replies; 4+ messages in thread
From: Xiao Yang @ 2020-07-15 16:23 UTC (permalink / raw)
  To: fstests; +Cc: ira.weiny, darrick.wong, Xiao Yang

1) Rename _require_log_writes_dax to _require_log_writes_dax_mountopt.
2) Make _require_log_writes_dax_mountopt check if old or new dax option
   is supported.
3) generic/470 takes use of _require_log_writes_dax_mountopt.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 common/dmlogwrites | 16 +++++++++++-----
 tests/generic/470  |  2 +-
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/common/dmlogwrites b/common/dmlogwrites
index 2a7ff612..66c2c939 100644
--- a/common/dmlogwrites
+++ b/common/dmlogwrites
@@ -23,7 +23,10 @@ _require_log_writes()
 # explicitly. But this is considered as a temporary workaround, we want to move
 # all the DAX check back to _require_log_writes when dm-log-writes gains full
 # DAX support and remove this helper.
-_require_log_writes_dax()
+#
+# Only accept dax/dax=always mount option becasue dax=always, dax=inode
+# and dax=never are always introduced together.
+_require_log_writes_dax_mountopt()
 {
 	[ -z "$LOGWRITES_DEV" -o ! -b "$LOGWRITES_DEV" ] && \
 		_notrun "This test requires a valid \$LOGWRITES_DEV"
@@ -32,16 +35,19 @@ _require_log_writes_dax()
 	_require_test_program "log-writes/replay-log"
 
 	local ret=0
+	local mountopt=$1
+
 	_log_writes_init $SCRATCH_DEV
 	_log_writes_mkfs > /dev/null 2>&1
-	_log_writes_mount -o dax > /dev/null 2>&1
-	# Check options to be sure. XFS ignores dax option
+	_log_writes_mount "-o $mountopt" > /dev/null 2>&1
+	# Check options to be sure.
+	# XFS ignores dax option(or changes it to dax=never)
 	# and goes on if dev underneath does not support dax.
-	_fs_options $LOGWRITES_DMDEV | grep -qw "dax"
+	_fs_options $LOGWRITES_DMDEV | egrep -q "dax(=always|,|$)"
 	ret=$?
 	_log_writes_cleanup
 	if [ $ret -ne 0 ]; then
-		_notrun "$LOGWRITES_DMDEV $FSTYP does not support -o dax"
+		_notrun "$LOGWRITES_DMDEV $FSTYP does not support -o $mountopt"
 	fi
 }
 
diff --git a/tests/generic/470 b/tests/generic/470
index 93691f4a..fd6da563 100755
--- a/tests/generic/470
+++ b/tests/generic/470
@@ -35,7 +35,7 @@ rm -f $seqres.full
 _supported_fs generic
 _supported_os Linux
 _require_scratch
-_require_log_writes_dax
+_require_log_writes_dax_mountopt "dax"
 _require_xfs_io_command "mmap" "-S"
 _require_xfs_io_command "log_writes"
 
-- 
2.21.0




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

* [PATCH v2 2/2] common/rc: Update _exclude_scratch_mount_option() and _require_dm_target() for new dax option
  2020-07-15 16:23 [PATCH v2 1/2] common/dmlogwrites: Update _require_log_writes_dax() for new dax option Xiao Yang
@ 2020-07-15 16:23 ` Xiao Yang
  2020-07-16 14:45   ` Ira Weiny
  2020-07-16  5:32 ` [PATCH v2 1/2] common/dmlogwrites: Update _require_log_writes_dax() " Xiao Yang
  1 sibling, 1 reply; 4+ messages in thread
From: Xiao Yang @ 2020-07-15 16:23 UTC (permalink / raw)
  To: fstests; +Cc: ira.weiny, darrick.wong, Xiao Yang

Some tests(e.g. ext4/035) cannot include dax option(dax=inode/dax=never
is OK) so make _exclude_scratch_mount_option() and _require_dm_target()
check if old or new dax option is not defined in $MOUNT_OPTIONS.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 common/rc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/common/rc b/common/rc
index 8b19b3f7..7d0b8691 100644
--- a/common/rc
+++ b/common/rc
@@ -1896,7 +1896,7 @@ _require_dm_target()
 	_require_sane_bdev_flush $SCRATCH_DEV
 	_require_command "$DMSETUP_PROG" dmsetup
 
-	echo $MOUNT_OPTIONS | grep -q dax
+	_normalize_mount_options | egrep -q "dax(=always| |$)"
 	if [ $? -eq 0 ]; then
 		case $target in
 		stripe|linear|log-writes)
@@ -3452,12 +3452,16 @@ _normalize_mount_options()
 }
 
 # skip test if MOUNT_OPTIONS contains the given strings
+# For dax option, only accept dax/dax=always mount option
 _exclude_scratch_mount_option()
 {
 	local mnt_opts=$(_normalize_mount_options)
+	local pattern=$1
+
+	echo "$pattern" | grep -q 'dax' && pattern="dax(=always| |$)"
 
 	while [ $# -gt 0 ]; do
-		if echo $mnt_opts | grep -qw "$1"; then
+		if echo $mnt_opts | egrep -q "$pattern"; then
 			_notrun "mount option \"$1\" not allowed in this test"
 		fi
 		shift
-- 
2.21.0




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

* Re: [PATCH v2 1/2] common/dmlogwrites: Update _require_log_writes_dax() for new dax option
  2020-07-15 16:23 [PATCH v2 1/2] common/dmlogwrites: Update _require_log_writes_dax() for new dax option Xiao Yang
  2020-07-15 16:23 ` [PATCH v2 2/2] common/rc: Update _exclude_scratch_mount_option() and _require_dm_target() " Xiao Yang
@ 2020-07-16  5:32 ` Xiao Yang
  1 sibling, 0 replies; 4+ messages in thread
From: Xiao Yang @ 2020-07-16  5:32 UTC (permalink / raw)
  To: fstests; +Cc: ira.weiny, darrick.wong

On 2020/7/16 0:23, Xiao Yang wrote:
> 1) Rename _require_log_writes_dax to _require_log_writes_dax_mountopt.
> 2) Make _require_log_writes_dax_mountopt check if old or new dax option
>    is supported.
> 3) generic/470 takes use of _require_log_writes_dax_mountopt.
>
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Add missing Reviewed-by:

Reviewed-by: Ira Weiny <ira.weiny@intel.com>

> ---
>  common/dmlogwrites | 16 +++++++++++-----
>  tests/generic/470  |  2 +-
>  2 files changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/common/dmlogwrites b/common/dmlogwrites
> index 2a7ff612..66c2c939 100644
> --- a/common/dmlogwrites
> +++ b/common/dmlogwrites
> @@ -23,7 +23,10 @@ _require_log_writes()
>  # explicitly. But this is considered as a temporary workaround, we want to move
>  # all the DAX check back to _require_log_writes when dm-log-writes gains full
>  # DAX support and remove this helper.
> -_require_log_writes_dax()
> +#
> +# Only accept dax/dax=always mount option becasue dax=always, dax=inode
> +# and dax=never are always introduced together.
> +_require_log_writes_dax_mountopt()
>  {
>  	[ -z "$LOGWRITES_DEV" -o ! -b "$LOGWRITES_DEV" ] && \
>  		_notrun "This test requires a valid \$LOGWRITES_DEV"
> @@ -32,16 +35,19 @@ _require_log_writes_dax()
>  	_require_test_program "log-writes/replay-log"
>  
>  	local ret=0
> +	local mountopt=$1
> +
>  	_log_writes_init $SCRATCH_DEV
>  	_log_writes_mkfs > /dev/null 2>&1
> -	_log_writes_mount -o dax > /dev/null 2>&1
> -	# Check options to be sure. XFS ignores dax option
> +	_log_writes_mount "-o $mountopt" > /dev/null 2>&1
> +	# Check options to be sure.
> +	# XFS ignores dax option(or changes it to dax=never)
>  	# and goes on if dev underneath does not support dax.
> -	_fs_options $LOGWRITES_DMDEV | grep -qw "dax"
> +	_fs_options $LOGWRITES_DMDEV | egrep -q "dax(=always|,|$)"
>  	ret=$?
>  	_log_writes_cleanup
>  	if [ $ret -ne 0 ]; then
> -		_notrun "$LOGWRITES_DMDEV $FSTYP does not support -o dax"
> +		_notrun "$LOGWRITES_DMDEV $FSTYP does not support -o $mountopt"
>  	fi
>  }
>  
> diff --git a/tests/generic/470 b/tests/generic/470
> index 93691f4a..fd6da563 100755
> --- a/tests/generic/470
> +++ b/tests/generic/470
> @@ -35,7 +35,7 @@ rm -f $seqres.full
>  _supported_fs generic
>  _supported_os Linux
>  _require_scratch
> -_require_log_writes_dax
> +_require_log_writes_dax_mountopt "dax"
>  _require_xfs_io_command "mmap" "-S"
>  _require_xfs_io_command "log_writes"
>  




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

* Re: [PATCH v2 2/2] common/rc: Update _exclude_scratch_mount_option() and _require_dm_target() for new dax option
  2020-07-15 16:23 ` [PATCH v2 2/2] common/rc: Update _exclude_scratch_mount_option() and _require_dm_target() " Xiao Yang
@ 2020-07-16 14:45   ` Ira Weiny
  0 siblings, 0 replies; 4+ messages in thread
From: Ira Weiny @ 2020-07-16 14:45 UTC (permalink / raw)
  To: Xiao Yang; +Cc: fstests, darrick.wong

On Thu, Jul 16, 2020 at 12:23:42AM +0800, Xiao Yang wrote:
> Some tests(e.g. ext4/035) cannot include dax option(dax=inode/dax=never
> is OK) so make _exclude_scratch_mount_option() and _require_dm_target()
> check if old or new dax option is not defined in $MOUNT_OPTIONS.
> 
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>

Reviewed-by: Ira Weiny <ira.weiny@intel.com>

> ---
>  common/rc | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/common/rc b/common/rc
> index 8b19b3f7..7d0b8691 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -1896,7 +1896,7 @@ _require_dm_target()
>  	_require_sane_bdev_flush $SCRATCH_DEV
>  	_require_command "$DMSETUP_PROG" dmsetup
>  
> -	echo $MOUNT_OPTIONS | grep -q dax
> +	_normalize_mount_options | egrep -q "dax(=always| |$)"
>  	if [ $? -eq 0 ]; then
>  		case $target in
>  		stripe|linear|log-writes)
> @@ -3452,12 +3452,16 @@ _normalize_mount_options()
>  }
>  
>  # skip test if MOUNT_OPTIONS contains the given strings
> +# For dax option, only accept dax/dax=always mount option
>  _exclude_scratch_mount_option()
>  {
>  	local mnt_opts=$(_normalize_mount_options)
> +	local pattern=$1
> +
> +	echo "$pattern" | grep -q 'dax' && pattern="dax(=always| |$)"
>  
>  	while [ $# -gt 0 ]; do
> -		if echo $mnt_opts | grep -qw "$1"; then
> +		if echo $mnt_opts | egrep -q "$pattern"; then
>  			_notrun "mount option \"$1\" not allowed in this test"
>  		fi
>  		shift
> -- 
> 2.21.0
> 
> 
> 

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

end of thread, other threads:[~2020-07-16 14:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-15 16:23 [PATCH v2 1/2] common/dmlogwrites: Update _require_log_writes_dax() for new dax option Xiao Yang
2020-07-15 16:23 ` [PATCH v2 2/2] common/rc: Update _exclude_scratch_mount_option() and _require_dm_target() " Xiao Yang
2020-07-16 14:45   ` Ira Weiny
2020-07-16  5:32 ` [PATCH v2 1/2] common/dmlogwrites: Update _require_log_writes_dax() " Xiao Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).