public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: fstests <fstests@vger.kernel.org>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>,
	linux-xfs <linux-xfs@vger.kernel.org>,
	linux-nvdimm <linux-nvdimm@lists.01.org>, Jan Kara <jack@suse.cz>,
	Dave Chinner <david@fromorbit.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Amir Goldstein <amir73il@gmail.com>
Subject: [fstests PATCH v4 3/4] dm-log-writes: allow DAX to be used when possible
Date: Fri, 17 Nov 2017 13:28:27 -0700	[thread overview]
Message-ID: <20171117202828.25472-4-ross.zwisler@linux.intel.com> (raw)
In-Reply-To: <20171117202828.25472-1-ross.zwisler@linux.intel.com>

Enhance _require_dm_target so that a user can request a minimum version of a
given dm target.

DAX support was added to v1.1.0 of the dm-log-writes kernel module, so
allow the DAX mount option starting with that version.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Suggested-by: Amir Goldstein <amir73il@gmail.com>
---
 common/dmlogwrites           |  5 +++--
 common/rc                    | 23 +++++++++++++++++++++--
 doc/requirement-checking.txt |  5 +++--
 3 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/common/dmlogwrites b/common/dmlogwrites
index 80ed4fc..2cb804c 100644
--- a/common/dmlogwrites
+++ b/common/dmlogwrites
@@ -23,8 +23,9 @@ _require_log_writes()
 	[ -z "$LOGWRITES_DEV" -o ! -b "$LOGWRITES_DEV" ] && \
 		_notrun "This test requires a valid \$LOGWRITES_DEV"
 
-	_exclude_scratch_mount_option dax
-	_require_dm_target log-writes
+	local z=0
+	_scratch_has_mount_option dax && z=1
+	_require_dm_target log-writes 1 $z 0
 	_require_test_program "log-writes/replay-log"
 }
 
diff --git a/common/rc b/common/rc
index 701b1ff..c1f24ed 100644
--- a/common/rc
+++ b/common/rc
@@ -1782,6 +1782,18 @@ _require_sane_bdev_flush()
 	fi
 }
 
+_compare_dm_target_versions()
+{
+	for i in $(seq 0 2); do
+		if [[ ${_actual_ver[$i]} > ${_required_ver[$i]} ]]; then
+			return
+		fi
+		if [[ ${_actual_ver[$i]} < ${_required_ver[$i]} ]]; then
+			_notrun "dm $_target version ${_required_ver[@]} required"
+		fi
+	done
+}
+
 # this test requires a specific device mapper target
 _require_dm_target()
 {
@@ -1795,8 +1807,15 @@ _require_dm_target()
 
 	modprobe dm-$_target >/dev/null 2>&1
 
-	$DMSETUP_PROG targets 2>&1 | grep -q ^$_target
-	if [ $? -ne 0 ]; then
+	local _version=$($DMSETUP_PROG targets 2>&1 | grep ^$_target)
+	if [[ $_version =~ .*v([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then
+		# check for a required minimum version?
+		if [[ $# == 4 ]]; then
+			local _actual_ver=(${BASH_REMATCH[@]:1})
+			local _required_ver=($2 $3 $4)
+			_compare_dm_target_versions
+		fi
+	else
 		_notrun "This test requires dm $_target support"
 	fi
 }
diff --git a/doc/requirement-checking.txt b/doc/requirement-checking.txt
index 4e01b1f..bbfc34f 100644
--- a/doc/requirement-checking.txt
+++ b/doc/requirement-checking.txt
@@ -112,10 +112,11 @@ _require_statx
 DEVICE MAPPER REQUIREMENTS
 ==========================
 
-_require_dm_target <name>
+_require_dm_target <name> [<version 1> <version 2> <version 3>]
 
      The test requires the use of the device mapper target and will be skipped
-     if it isn't available in the kernel.
+     if it isn't available in the kernel.  Optionally specify the minimum
+     three part version number of the dm target that is required.
 
 _require_log_writes
 
-- 
2.9.5


  parent reply	other threads:[~2017-11-17 20:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-17 20:28 [fstests PATCH v4 0/4] add test for DAX MAP_SYNC support Ross Zwisler
2017-11-17 20:28 ` [fstests PATCH v4 1/4] common/rc: add _scratch_has_mount_option() Ross Zwisler
2017-11-17 20:28 ` [fstests PATCH v4 2/4] dm-log-writes: only replay log to marks that exist Ross Zwisler
2017-11-18  3:51   ` Eryu Guan
2017-11-17 20:28 ` Ross Zwisler [this message]
2017-11-18  6:17   ` [fstests PATCH v4 3/4] dm-log-writes: allow DAX to be used when possible Eryu Guan
2017-12-05 23:21     ` Ross Zwisler
2017-11-17 20:28 ` [fstests PATCH v4 4/4] generic: add test for DAX MAP_SYNC support Ross Zwisler

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=20171117202828.25472-4-ross.zwisler@linux.intel.com \
    --to=ross.zwisler@linux.intel.com \
    --cc=amir73il@gmail.com \
    --cc=dan.j.williams@intel.com \
    --cc=david@fromorbit.com \
    --cc=fstests@vger.kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-nvdimm@lists.01.org \
    --cc=linux-xfs@vger.kernel.org \
    /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