From patchwork Fri Nov 17 20:28:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Zwisler X-Patchwork-Id: 10063713 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 61353601D3 for ; Fri, 17 Nov 2017 20:28:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52CCE2A188 for ; Fri, 17 Nov 2017 20:28:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 477CE2A190; Fri, 17 Nov 2017 20:28:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EC25E2A188 for ; Fri, 17 Nov 2017 20:28:38 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 1C9FD21B00DEB; Fri, 17 Nov 2017 12:24:27 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: None (no SPF record) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=ross.zwisler@linux.intel.com; receiver=linux-nvdimm@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 183EC21B00DE6 for ; Fri, 17 Nov 2017 12:24:26 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Nov 2017 12:28:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,411,1505804400"; d="scan'208";a="6247056" Received: from theros.lm.intel.com ([10.232.112.77]) by orsmga001.jf.intel.com with ESMTP; 17 Nov 2017 12:28:36 -0800 From: Ross Zwisler To: fstests 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 Message-Id: <20171117202828.25472-4-ross.zwisler@linux.intel.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171117202828.25472-1-ross.zwisler@linux.intel.com> References: <20171117202828.25472-1-ross.zwisler@linux.intel.com> X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jan Kara , linux-nvdimm , Amir Goldstein , Dave Chinner , linux-xfs MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP 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 Suggested-by: Amir Goldstein --- 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 +_require_dm_target [ ] 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