From patchwork Fri Apr 7 07:56:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murphy Zhou X-Patchwork-Id: 9668963 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 007B5602A0 for ; Fri, 7 Apr 2017 07:56:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E37DE285AD for ; Fri, 7 Apr 2017 07:56:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D8203285DC; Fri, 7 Apr 2017 07:56:21 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80B01285AD for ; Fri, 7 Apr 2017 07:56:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753481AbdDGH4U (ORCPT ); Fri, 7 Apr 2017 03:56:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52372 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751812AbdDGH4U (ORCPT ); Fri, 7 Apr 2017 03:56:20 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DC83880484; Fri, 7 Apr 2017 07:56:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DC83880484 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=xzhou@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com DC83880484 Received: from localhost (dhcp-12-130.nay.redhat.com [10.66.12.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E6EB5C8AC; Fri, 7 Apr 2017 07:56:19 +0000 (UTC) From: Xiong Zhou To: fstests@vger.kernel.org Cc: ross.zwisler@linux.intel.com, dan.j.williams@intel.com, jmoyer@redhat.com, Xiong Zhou Subject: [PATCH 2/3] DAX-DIO: skip DAX to non-DAX if unsupported Date: Fri, 7 Apr 2017 15:56:03 +0800 Message-Id: <1491551764-18779-2-git-send-email-xzhou@redhat.com> In-Reply-To: <1491551764-18779-1-git-send-email-xzhou@redhat.com> References: <1491551764-18779-1-git-send-email-xzhou@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 07 Apr 2017 07:56:20 +0000 (UTC) Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP By tweaking SCRATCH_DEV by ndctl, only run DAX mapped area DIO to non-DAX area tests when pmem device is in "memory mode". Signed-off-by: Xiong Zhou --- tests/generic/413 | 25 ++++++++++++++++++++++++- tests/xfs/260 | 25 ++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/tests/generic/413 b/tests/generic/413 index a1cc514..55a871f 100755 --- a/tests/generic/413 +++ b/tests/generic/413 @@ -34,6 +34,11 @@ _cleanup() { cd / rm -f $tmp.* + _check_scratch_fs + # umount and restore SCRATCH_DEV to original mode + _scratch_unmount + $NDCTL_PROG create-namespace -f -e $scns -m $scmode \ + > /dev/null 2>&1 } # get standard environment, filters and checks @@ -47,9 +52,13 @@ _supported_fs generic _supported_os Linux _require_test _require_scratch_dax +# fsck manually in cleanup as we will reconfig SCRATCH_DEV +_require_scratch_nocheck _require_test_program "feature" _require_test_program "t_mmap_dio" _require_xfs_io_command "falloc" +_require_ndctl +_require_jq prep_files() { @@ -110,7 +119,7 @@ t_both_nondax() t_mmap_dio_dax() { t_both_dax $1 - t_dax_to_nondax $1 + [ $skipdmd -eq 0 ] && t_dax_to_nondax $1 t_nondax_to_dax $1 t_both_nondax $1 } @@ -126,6 +135,20 @@ do_tests() t_mmap_dio_dax $((64 * 1024 * 1024)) } +skipdmd=0 +# config SCRATCH_DEV to memory mode to support DAX mapped +# area DIO to non-DAX area. + +# save original mode +scmode=$(_ndctl_get_pmem_key_value $SCRATCH_DEV mode) + +# get its namespace +scns=$(_ndctl_get_pmem_key_value $SCRATCH_DEV dev) + +# skip dax to non-dax dio if config fails +$NDCTL_PROG create-namespace -f -e $scns -m memory \ + > /dev/null 2>&1 || skipdmd=1 + # make fs 2Mb aligned for PMD fault testing mkfs_opts="" if [ "$FSTYP" == "ext4" ]; then diff --git a/tests/xfs/260 b/tests/xfs/260 index e613cc0..d07b273 100755 --- a/tests/xfs/260 +++ b/tests/xfs/260 @@ -34,6 +34,11 @@ _cleanup() { cd / rm -f $tmp.* + _check_scratch_fs + # umount and restore SCRATCH_DEV to original mode + _scratch_unmount + $NDCTL_PROG create-namespace -f -e $scns -m $scmode \ + > /dev/null 2>&1 } # get standard environment, filters and checks @@ -46,10 +51,14 @@ rm -f $seqres.full _supported_fs xfs _supported_os Linux _require_scratch_dax +# fsck manually in cleanup as we will reconfig SCRATCH_DEV +_require_scratch_nocheck _require_test_program "feature" _require_test_program "t_mmap_dio" _require_xfs_io_command "chattr" "+/-x" _require_xfs_io_command "falloc" +_require_ndctl +_require_jq prep_files() { @@ -120,7 +129,7 @@ t_both_nondax() t_dax_flag_mmap_dio() { t_both_dax $1 - t_dax_to_nondax $1 + [ $skipdmd -eq 0 ] && t_dax_to_nondax $1 t_nondax_to_dax $1 t_both_nondax $1 } @@ -136,6 +145,20 @@ do_tests() t_dax_flag_mmap_dio $((64 * 1024 * 1024)) } +skipdmd=0 +# config SCRATCH_DEV to memory mode to support DAX mapped +# area DIO to non-DAX area. + +# save original mode +scmode=$(_ndctl_get_pmem_key_value $SCRATCH_DEV mode) + +# get its namespace +scns=$(_ndctl_get_pmem_key_value $SCRATCH_DEV dev) + +# skip dax to non-dax dio if config fails +$NDCTL_PROG create-namespace -f -e $scns -m memory \ + > /dev/null 2>&1 || skipdmd=1 + # make xfs 2Mb aligned for PMD fault testing _scratch_mkfs "-d su=2m,sw=1" > /dev/null 2>&1