From patchwork Sat Jan 30 19:10:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 8172271 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EB0839FC36 for ; Sat, 30 Jan 2016 19:11:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0F05C20253 for ; Sat, 30 Jan 2016 19:11:13 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 02CE72024F for ; Sat, 30 Jan 2016 19:11:12 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id DB1E01A250C; Sat, 30 Jan 2016 11:11:11 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by ml01.01.org (Postfix) with ESMTP id 5256C1A250C for ; Sat, 30 Jan 2016 11:11:10 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 30 Jan 2016 11:11:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,371,1449561600"; d="scan'208";a="644253306" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.136]) by FMSMGA003.fm.intel.com with ESMTP; 30 Jan 2016 11:11:09 -0800 Subject: [ndctl PATCH] ndctl: test memmap location From: Dan Williams To: linux-nvdimm@lists.01.org Date: Sat, 30 Jan 2016 11:10:45 -0800 Message-ID: <20160130191045.17974.45357.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add tests to validate placing the memmap in ram vs pmem. Reported-by: Jeff Moyer Signed-off-by: Dan Williams --- test/dax.sh | 53 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/test/dax.sh b/test/dax.sh index c5fce475afce..9d2c27225653 100755 --- a/test/dax.sh +++ b/test/dax.sh @@ -1,13 +1,15 @@ #!/bin/bash MNT=test_dax_mnt FILE=image -DEV="" +NDCTL="./ndctl" +json2var="s/[{}\",]//g; s/:/=/g" +blockdev="" err() { rc=1 echo "test-dax: failed at line $1" - if [ -n "$DEV" ]; then - umount $DEV + if [ -n "$blockdev" ]; then + umount /dev/$blockdev else rc=77 fi @@ -19,16 +21,51 @@ set -e mkdir -p $MNT trap 'err $LINENO' ERR -DEV=$(test/dax-dev) +blockdev=$(basename $(test/dax-dev)) +dev=$(basename $(readlink -f /sys/block/$(basename $blockdev)/device)) -mkfs.ext4 $DEV -mount $DEV $MNT -o dax +mkfs.ext4 /dev/$blockdev +mount /dev/$blockdev $MNT -o dax fallocate -l 1GiB $MNT/$FILE test/dax-pmd $MNT/$FILE umount $MNT -mkfs.xfs -f $DEV -mount $DEV $MNT -o dax +# convert pmem to put the memmap on the device +json=$($NDCTL create-namespace -m memory -M dev -f -e $dev) +eval $(echo $json | sed -e "$json2var") +[ $mode != "memory" ] && echo "fail: $LINENO" && exit 1 + +#note the blockdev returned from ndctl create-namespace lacks the /dev prefix +mkfs.ext4 /dev/$blockdev +mount /dev/$blockdev $MNT -o dax fallocate -l 1GiB $MNT/$FILE test/dax-pmd $MNT/$FILE umount $MNT + +json=$($NDCTL create-namespace -m raw -f -e $dev) +eval $(echo $json | sed -e "$json2var") +[ $mode != "memory" ] && echo "fail: $LINENO" && exit 1 + +mkfs.xfs -f /dev/$blockdev +mount /dev/$blockdev $MNT -o dax +fallocate -l 1GiB $MNT/$FILE +test/dax-pmd $MNT/$FILE +umount $MNT + +# convert pmem to put the memmap on the device +json=$($NDCTL create-namespace -m memory -M dev -f -e $dev) +eval $(echo $json | sed -e "$json2var") +[ $mode != "memory" ] && echo "fail: $LINENO" && exit 1 + +mkfs.xfs -f /dev/$blockdev +mount /dev/$blockdev $MNT -o dax +fallocate -l 1GiB $MNT/$FILE +test/dax-pmd $MNT/$FILE +umount $MNT + +# revert namespace to raw mode +json=$($NDCTL create-namespace -m raw -f -e $dev) +eval $(echo $json | sed -e "$json2var") +[ $mode != "memory" ] && echo "fail: $LINENO" && exit 1 + +exit 0