From patchwork Wed Mar 7 08:30:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lu Fengqi X-Patchwork-Id: 10263625 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 D041A60247 for ; Wed, 7 Mar 2018 08:30:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D733228A1E for ; Wed, 7 Mar 2018 08:30:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB96D293C1; Wed, 7 Mar 2018 08:30:38 +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 4983D28A1E for ; Wed, 7 Mar 2018 08:30:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751112AbeCGIah (ORCPT ); Wed, 7 Mar 2018 03:30:37 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:56943 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751090AbeCGIah (ORCPT ); Wed, 7 Mar 2018 03:30:37 -0500 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="37570298" Received: from bogon (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 07 Mar 2018 16:30:34 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id 8776A48AE766; Wed, 7 Mar 2018 16:30:36 +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; Wed, 7 Mar 2018 16:30:39 +0800 From: Lu Fengqi To: , Subject: [PATCH] fstests: btrfs/146: make sure hit all stripes in the case of compression Date: Wed, 7 Mar 2018 16:30:28 +0800 Message-ID: <20180307083028.3625-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: 8776A48AE766.A9CFD X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: lufq.fnst@cn.fujitsu.com Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@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 --- tests/btrfs/146 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/btrfs/146 b/tests/btrfs/146 index 7071c128..b5d17c49 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=\K(?!no)\w+'; 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