From patchwork Wed Mar 9 08:33:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 8543961 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1BC27C0553 for ; Wed, 9 Mar 2016 08:36:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 22A1C201EF for ; Wed, 9 Mar 2016 08:36:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1574120204 for ; Wed, 9 Mar 2016 08:36:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752580AbcCIIgZ (ORCPT ); Wed, 9 Mar 2016 03:36:25 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:47714 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751610AbcCIIgX (ORCPT ); Wed, 9 Mar 2016 03:36:23 -0500 X-IronPort-AV: E=Sophos;i="5.20,367,1444665600"; d="scan'208";a="384592" Received: from unknown (HELO cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 09 Mar 2016 16:35:56 +0800 Received: from localhost.localdomain (unknown [10.167.226.34]) by cn.fujitsu.com (Postfix) with ESMTP id F2FF04056406; Wed, 9 Mar 2016 16:35:54 +0800 (CST) From: Qu Wenruo To: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [PATCH v4 3/6] fstests: btrfs: Add testcase for btrfs dedup enable disable race test Date: Wed, 9 Mar 2016 16:33:41 +0800 Message-Id: <1457512424-9215-4-git-send-email-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 2.7.2 In-Reply-To: <1457512424-9215-1-git-send-email-quwenruo@cn.fujitsu.com> References: <1457512424-9215-1-git-send-email-quwenruo@cn.fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: F2FF04056406.AC756 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: quwenruo@cn.fujitsu.com X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,LOTS_OF_MONEY, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add test case to check btrfs dedup enable/disable race. Signed-off-by: Qu Wenruo --- tests/btrfs/201 | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/201.out | 2 ++ tests/btrfs/group | 1 + 3 files changed, 101 insertions(+) create mode 100755 tests/btrfs/201 create mode 100644 tests/btrfs/201.out diff --git a/tests/btrfs/201 b/tests/btrfs/201 new file mode 100755 index 0000000..1c523c5 --- /dev/null +++ b/tests/btrfs/201 @@ -0,0 +1,98 @@ +#! /bin/bash +# FS QA Test 201 +# +# Basic btrfs inband dedup enable/disable race test +# +#----------------------------------------------------------------------- +# Copyright (c) 2016 Fujitsu. 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.* + killall $FSSTRESS_PROG &> /dev/null + kill $fsstress_pid &> /dev/null + wait +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here + +_supported_fs btrfs +_supported_os Linux +_require_scratch +_require_btrfs_subcommand dedup +_require_btrfs_fs_feature dedup +_require_btrfs_mkfs_feature dedup + +# Use 64K dedup size to keep compatibility for 64K page size +dedup_bs=64K + +_scratch_mkfs "-O dedup" >> $seqres.full 2>&1 +_scratch_mount + +mkdir -p $SCRATCH_MNT/stressdir + +runtime=$((60 * $TIME_FACTOR)) + +trigger_work() +{ + while true; do + _run_btrfs_util_prog dedup enable -s inmemory \ + -b $dedup_bs $SCRATCH_MNT + sleep 5 + _run_btrfs_util_prog dedup disable $SCRATCH_MNT + sleep 5 + _run_btrfs_util_prog dedup enable -s ondisk \ + -b $dedup_bs $SCRATCH_MNT + sleep 5 + _run_btrfs_util_prog dedup disable $SCRATCH_MNT + sleep 5 + done +} + +$FSSTRESS_PROG $(_scale_fsstress_args -p 8 -n 10000000) $FSSTRESS_AVOID \ + -d $SCRATCH_MNT/stressdir > /dev/null 2>&1 & + +trigger_work & +trigger_pid=$! + +sleep $runtime +killall $FSSTRESS_PROG +kill $trigger_pid +wait + +echo "Silence is golden" +# success, all done +status=0 +exit diff --git a/tests/btrfs/201.out b/tests/btrfs/201.out new file mode 100644 index 0000000..5ac973f --- /dev/null +++ b/tests/btrfs/201.out @@ -0,0 +1,2 @@ +QA output created by 201 +Silence is golden diff --git a/tests/btrfs/group b/tests/btrfs/group index 0b7354b..76ebea7 100644 --- a/tests/btrfs/group +++ b/tests/btrfs/group @@ -120,3 +120,4 @@ 117 auto quick send clone 118 auto quick snapshot metadata 200 auto dedup +201 auto dedup