From patchwork Mon Sep 11 20:01:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Zwisler X-Patchwork-Id: 9948055 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 06CED6035D for ; Mon, 11 Sep 2017 20:01:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F23ED28D35 for ; Mon, 11 Sep 2017 20:01:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6F5C28D38; Mon, 11 Sep 2017 20:01:13 +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 5947D28D35 for ; Mon, 11 Sep 2017 20:01:12 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 1952D21CEB0F9; Mon, 11 Sep 2017 12:58:14 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 33BA220945C0D for ; Mon, 11 Sep 2017 12:58:13 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Sep 2017 13:01:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,379,1500966000"; d="scan'208";a="310464343" Received: from theros.lm.intel.com ([10.232.112.77]) by fmsmga004.fm.intel.com with ESMTP; 11 Sep 2017 13:01:08 -0700 From: Ross Zwisler To: fstests@vger.kernel.org, Eryu Guan Subject: [fstests PATCH v2] xfs: add regression test for DAX mount option usage Date: Mon, 11 Sep 2017 14:01:03 -0600 Message-Id: <20170911200103.28226-1-ross.zwisler@linux.intel.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: 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@lists.01.org, "Darrick J. Wong" , Dave Chinner , linux-xfs@vger.kernel.org, Christoph Hellwig MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP This adds a regression test for the following kernel patch: xfs: always use DAX if mount option is used This test will also pass with kernel v4.14-rc1 and beyond because the XFS DAX I/O mount option has been disabled (but not removed), so the "chattr -x" to turn off DAX doesn't actually do anything. Signed-off-by: Ross Zwisler Suggested-by: Christoph Hellwig --- Changes since v1: - Use perf instead of tracepoints to detect whether DAX is used. (Dan) --- tests/xfs/431 | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/431.out | 2 ++ tests/xfs/group | 1 + 3 files changed, 80 insertions(+) create mode 100755 tests/xfs/431 create mode 100644 tests/xfs/431.out diff --git a/tests/xfs/431 b/tests/xfs/431 new file mode 100755 index 0000000..2865a6d --- /dev/null +++ b/tests/xfs/431 @@ -0,0 +1,77 @@ +#! /bin/bash +# FS QA Test xfs/431 +# +# This is a regression test for kernel patch: +# xfs: always use DAX if mount option is used +# created by Ross Zwisler +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Intel Corporation. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc + +# remove previous $seqres.full before test +rm -f $seqres.full + +# Modify as appropriate. +_supported_os Linux +_supported_fs xfs +_require_scratch_dax + +# real QA test starts here +export PERF_PROG="`set_prog_path perf`" +[ "$PERF_PROG" = "" ] && _notrun "perf not found" + +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount "-o dax" >> $seqres.full 2>&1 + +pgsize=`$here/src/feature -s` + +PERF_OUTPUT=$tmp.perf + +$PERF_PROG record -o $PERF_OUTPUT -e 'fs_dax:dax_load_hole' \ + $XFS_IO_PROG -t -c "truncate $pgsize" \ + -c "chattr -x" \ + -c "mmap -r 0 $pgsize" -c "mread 0 $pgsize" -c "munmap" \ + -f $SCRATCH_MNT/testfile > /dev/null 2>&1 + +$PERF_PROG script -i $PERF_OUTPUT | grep -q 'fs_dax:dax_load_hole' +if [[ $? == 0 ]]; then + echo "DAX was used" +else + echo "DAX was NOT used" +fi + +# success, all done +status=0 +exit diff --git a/tests/xfs/431.out b/tests/xfs/431.out new file mode 100644 index 0000000..194ae1e --- /dev/null +++ b/tests/xfs/431.out @@ -0,0 +1,2 @@ +QA output created by 431 +DAX was used diff --git a/tests/xfs/group b/tests/xfs/group index 0a449b9..4e7019c 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -427,3 +427,4 @@ 428 dangerous_fuzzers dangerous_scrub dangerous_online_repair 429 dangerous_fuzzers dangerous_scrub dangerous_repair 430 dangerous_fuzzers dangerous_scrub dangerous_online_repair +431 auto quick