From patchwork Wed Jan 18 03:07:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murphy Zhou X-Patchwork-Id: 9522531 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 87FD46020A for ; Wed, 18 Jan 2017 03:07:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7672F28516 for ; Wed, 18 Jan 2017 03:07:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 697F72849C; Wed, 18 Jan 2017 03:07:36 +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 193F72849C for ; Wed, 18 Jan 2017 03:07:36 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8178B81E27; Tue, 17 Jan 2017 19:07:35 -0800 (PST) X-Original-To: linux-nvdimm@ml01.01.org Delivered-To: linux-nvdimm@ml01.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (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 583B381E21 for ; Tue, 17 Jan 2017 19:07:34 -0800 (PST) Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7BC32C05678F; Wed, 18 Jan 2017 03:07:35 +0000 (UTC) Received: from localhost (dhcp-12-130.nay.redhat.com [10.66.12.130]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v0I37Y8u019338; Tue, 17 Jan 2017 22:07:34 -0500 From: Xiong Zhou To: fstests@vger.kernel.org Subject: [PATCH 3/4] xfs: test per-inode DAX flag by IO Date: Wed, 18 Jan 2017 11:07:05 +0800 Message-Id: <1484708826-23529-4-git-send-email-xzhou@redhat.com> In-Reply-To: <1484708826-23529-1-git-send-email-xzhou@redhat.com> References: <1484708826-23529-1-git-send-email-xzhou@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 18 Jan 2017 03:07:35 +0000 (UTC) X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-nvdimm@ml01.01.org MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP We do mmap and O_DIRECT read/write, through files with and without DAX flag. Signed-off-by: Xiong Zhou --- tests/xfs/138 | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/138.out | 2 ++ tests/xfs/group | 1 + 3 files changed, 108 insertions(+) create mode 100755 tests/xfs/138 create mode 100644 tests/xfs/138.out diff --git a/tests/xfs/138 b/tests/xfs/138 new file mode 100755 index 0000000..4b965b3 --- /dev/null +++ b/tests/xfs/138 @@ -0,0 +1,105 @@ +#! /bin/bash +# FS QA Test 138 +# +# Test per-inode DAX flag by mmap direct IO. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat Inc. 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 +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +_supported_fs xfs +_supported_os Linux +_require_scratch_dax +_require_test_program "feature" +_require_xfs_io_command "chattr" "+/-x" + +# $1 mmap read/write size +_dax_flag_mmap_dio() +{ + # both dax + $XFS_IO_PROG -c "chattr +x" $SCRATCH_MNT/tf_s + $XFS_IO_PROG -c "chattr +x" $SCRATCH_MNT/tf_d + src/t_mmap_dio $SCRATCH_MNT/tf_s $SCRATCH_MNT/tf_d $1 + + # from non dax to dax + $XFS_IO_PROG -c "chattr -x" $SCRATCH_MNT/tf_s + src/t_mmap_dio $SCRATCH_MNT/tf_s $SCRATCH_MNT/tf_d $1 + + # from dax to non dax + $XFS_IO_PROG -c "chattr +x" $SCRATCH_MNT/tf_s + $XFS_IO_PROG -c "chattr -x" $SCRATCH_MNT/tf_d + src/t_mmap_dio $SCRATCH_MNT/tf_s $SCRATCH_MNT/tf_d $1 + + # both non dax + $XFS_IO_PROG -c "chattr -x" $SCRATCH_MNT/tf_s + src/t_mmap_dio $SCRATCH_MNT/tf_s $SCRATCH_MNT/tf_d $1 +} + +_do_tests() +{ + # less than page size + _dax_flag_mmap_dio 1024 + # page size + _dax_flag_mmap_dio `src/feature -s` + # bigger sizes, for PMD faults + _dax_flag_mmap_dio 16777216 + _dax_flag_mmap_dio 67108864 +} + +_scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed" + +# mount with dax option +_scratch_mount "-o dax" >> $seqres.full 2>&1 || \ + _fail "mount -o dax failed" + +dd if=/dev/zero of=$SCRATCH_MNT/tf_s bs=4k count=256k > /dev/null 2>&1 +dd if=/dev/zero of=$SCRATCH_MNT/tf_d bs=4k count=256k > /dev/null 2>&1 + +_do_tests +_scratch_unmount >> $seqres.full 2>&1 || _fail "umount failed" + +# mount again wo/ dax option +_scratch_mount >> $seqres.full 2>&1 || _fail "mount failed" +_do_tests +_scratch_unmount >> $seqres.full 2>&1 + +# success, all done +echo "Silence is golden" +status=0 +exit diff --git a/tests/xfs/138.out b/tests/xfs/138.out new file mode 100644 index 0000000..614ba1a --- /dev/null +++ b/tests/xfs/138.out @@ -0,0 +1,2 @@ +QA output created by 138 +Silence is golden diff --git a/tests/xfs/group b/tests/xfs/group index 3c5884c..4b406c0 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -135,6 +135,7 @@ 135 auto logprint quick v2log 136 attr2 137 auto metadata v2log +138 auto attr quick 139 auto quick clone 140 auto clone 141 auto log metadata