From patchwork Wed Sep 14 01:55:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 9330233 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 C59376048F for ; Wed, 14 Sep 2016 01:56:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B405029409 for ; Wed, 14 Sep 2016 01:56:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A76922943C; Wed, 14 Sep 2016 01:56:01 +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 38E5829846 for ; Wed, 14 Sep 2016 01:56:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755671AbcINBzz (ORCPT ); Tue, 13 Sep 2016 21:55:55 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:49885 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751091AbcINBzq (ORCPT ); Tue, 13 Sep 2016 21:55:46 -0400 X-IronPort-AV: E=Sophos;i="5.20,367,1444665600"; d="scan'208";a="841717" Received: from unknown (HELO cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 14 Sep 2016 09:55:36 +0800 Received: from adam-work.localdomain (unknown [10.167.226.34]) by cn.fujitsu.com (Postfix) with ESMTP id B2C074043CED; Wed, 14 Sep 2016 09:55:28 +0800 (CST) From: Qu Wenruo To: linux-btrfs@vger.kernel.org, fstests@vger.kernel.org Cc: fdmanana@gmail.com, mfasheh@suse.de Subject: [PATCH v6 3/6] fstests: Add btrfs dedupe post mount hook Date: Wed, 14 Sep 2016 09:55:24 +0800 Message-Id: <20160914015527.10274-4-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160914015527.10274-1-quwenruo@cn.fujitsu.com> References: <20160914015527.10274-1-quwenruo@cn.fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: B2C074043CED.AF351 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: quwenruo@cn.fujitsu.com Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now fstests can run any test cases with btrfs inband-dedupe enabled. Signed-off-by: Qu Wenruo --- common/rc | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/common/rc b/common/rc index 636cba6..e0da69b 100644 --- a/common/rc +++ b/common/rc @@ -326,10 +326,26 @@ _run_btrfs_post_mount_hook() mnt_point=$1 for n in $ALWAYS_ENABLE_BTRFS_FEATURE; do if [ $n == "quota" -o $n == "qgroup" ]; then - # Quota can be enabled for several times - # and won't cause bug + # Re-enable quota won't cause anything wrong _run_btrfs_util_prog quota enable $mnt_point fi + if [ $n == "dedupe" -o $n == "inband-dedupe" -o $n == "dedupe-inband" ]; then + # Need to check if kernel/progs support dedupe + _require_btrfs_fs_feature dedupe + _require_btrfs_subcommand dedupe + + # Check if dedupe is already enabled, or we will + # overwrite previous on-disk backend config + $BTRFS_UTIL_PROG dedupe status $mnt_point | grep -q "Enabled" + if [ $1 -eq 0 ]; then + continue + fi + + # This will enable dedupe with default options, so + # btrfs dedupe test cases needs to use '-f' option to + # override default config. + _run_btrfs_util_prog dedupe enable $mnt_point + fi done }