From patchwork Thu Mar 8 05:56:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lu Fengqi X-Patchwork-Id: 10266491 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 F14F6602C8 for ; Thu, 8 Mar 2018 05:57:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E331029739 for ; Thu, 8 Mar 2018 05:57:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D572429730; Thu, 8 Mar 2018 05:57:03 +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 50F1629730 for ; Thu, 8 Mar 2018 05:57:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966153AbeCHF5B (ORCPT ); Thu, 8 Mar 2018 00:57:01 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:50416 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S966024AbeCHF44 (ORCPT ); Thu, 8 Mar 2018 00:56:56 -0500 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="37601388" Received: from bogon (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 08 Mar 2018 13:56:53 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id 3E85348AE763; Thu, 8 Mar 2018 13:56:54 +0800 (CST) Received: from fnst.localdomain (10.167.226.155) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 8 Mar 2018 13:56:57 +0800 From: Lu Fengqi To: , Subject: [PATCH v2] fstests: btrfs/146: make sure hit all stripes in the case of compression Date: Thu, 8 Mar 2018 13:56:45 +0800 Message-ID: <20180308055645.22917-1-lufq.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.16.2 MIME-Version: 1.0 X-Originating-IP: [10.167.226.155] X-yoursite-MailScanner-ID: 3E85348AE763.AA8FE X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: lufq.fnst@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 In the case of compression, each 128K input data chunk will be compressed to 4K (because of the characters written are duplicate). Therefore we have to write (128K * 16) to make sure every stripe can be hit. Signed-off-by: Lu Fengqi --- V2: Modify the regular expression to ensure that it matches various compress mount options. tests/btrfs/146 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/btrfs/146 b/tests/btrfs/146 index 7071c128ca0a..a51eda68eaf3 100755 --- a/tests/btrfs/146 +++ b/tests/btrfs/146 @@ -74,9 +74,16 @@ _scratch_pool_mkfs "-d raid0 -m raid1" > $seqres.full 2>&1 _scratch_mount # How much do we need to write? We need to hit all of the stripes. btrfs uses -# a fixed 64k stripesize, so write enough to hit each one +# a fixed 64k stripesize, so write enough to hit each one. In the case of +# compression, each 128K input data chunk will be compressed to 4K (because of +# the characters written are duplicate). Therefore we have to write (128K * 16) +# to make sure every stripe can be hit. number_of_devices=`echo $SCRATCH_DEV_POOL | wc -w` -write_kb=$(($number_of_devices * 64)) +if ! echo $MOUNT_OPTIONS | grep -qoP 'compress(-force)?(=(?!no)|,|$)'; then + write_kb=$(($number_of_devices * 64)) +else + write_kb=$(($number_of_devices * 2048)) +fi _require_fs_space $SCRATCH_MNT $write_kb testfile=$SCRATCH_MNT/fsync-err-test