common/dmlogwrites: Update _require_log_writes_dax() for new dax option
authorXiao Yang <yangx.jy@cn.fujitsu.com>
Mon, 10 Aug 2020 16:29:08 +0000 (00:29 +0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 16 Aug 2020 14:31:39 +0000 (22:31 +0800)
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>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/dmlogwrites
tests/generic/470

index 2a7ff6125dbdbf1951b2729aa8b41b134b03d941..573f4b8a56b93ea2c82facf0295d9e24bd95b301 100644 (file)
@@ -23,7 +23,18 @@ _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()
+#
+# Check if dax mount options are supported
+# $1 can be either 'dax=always' or 'dax'
+# dax=always
+#      Check for the new dax options (dax=inode, dax=always or dax=never)
+#      by passing "dax=always".
+# dax
+#      Check for the old dax or new dax=always by passing "dax".
+# This only accepts 'dax=always' because dax=always, dax=inode and
+# dax=never are always supported together.  So if the other options are
+# required checking for 'dax=always' indicates support for the other 2.
+_require_log_writes_dax_mountopt()
 {
        [ -z "$LOGWRITES_DEV" -o ! -b "$LOGWRITES_DEV" ] && \
                _notrun "This test requires a valid \$LOGWRITES_DEV"
@@ -32,16 +43,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
 }
 
index 93691f4ac6643ed07d4d9557735e55e3b059f542..fd6da5639643173d8529a7eb2511d3a2a3e6d1fb 100755 (executable)
@@ -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"