diff mbox series

common/dmlogwrites: Update _require_log_writes_dax()

Message ID 20200714110150.11186-1-yangx.jy@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show
Series common/dmlogwrites: Update _require_log_writes_dax() | expand

Commit Message

Xiao Yang July 14, 2020, 11:01 a.m. UTC
1) Rename _require_log_writes_dax to _require_log_writes_dax_mountopt
2) Make _require_log_writes_dax_mountopt accept old and new dax option
3) generic/470 takes use of _require_log_writes_dax_mountopt

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

Comments

Ira Weiny July 15, 2020, 2:54 a.m. UTC | #1
On Tue, Jul 14, 2020 at 07:01:50PM +0800, Xiao Yang wrote:
> 1) Rename _require_log_writes_dax to _require_log_writes_dax_mountopt
> 2) Make _require_log_writes_dax_mountopt accept old and new dax option
> 3) generic/470 takes use of _require_log_writes_dax_mountopt
> 
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>

Looks reasonable at this time.

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

At some point I think we want to deprecate the '-o dax' option in favor of '-o
dax=always'.  I'm not sure when, how, or even if, that can be done so for now
this looks good.

Finally, I would really like to Thank you for doing these.  I had 1 big test
which I was trying to clean up to submit but I've not had time and my
understanding of xfstests is limited which made it slow going.  So I'd like to
offer a big Thank You!  :-D

Thanks,
Ira

> ---
>  common/dmlogwrites | 15 ++++++++++-----
>  tests/generic/470  |  2 +-
>  2 files changed, 11 insertions(+), 6 deletions(-)
> 
> diff --git a/common/dmlogwrites b/common/dmlogwrites
> index 2a7ff612..2e9b2311 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,18 @@ _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
> 
> 
>
diff mbox series

Patch

diff --git a/common/dmlogwrites b/common/dmlogwrites
index 2a7ff612..2e9b2311 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,18 @@  _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"