From patchwork Tue Dec 5 11:36:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 10092737 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 D1F1A60327 for ; Tue, 5 Dec 2017 11:36:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC2CE2893F for ; Tue, 5 Dec 2017 11:36:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B0F282898B; Tue, 5 Dec 2017 11:36:11 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY 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 7D7482893F for ; Tue, 5 Dec 2017 11:36:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752366AbdLELgK (ORCPT ); Tue, 5 Dec 2017 06:36:10 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:45259 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752283AbdLELgJ (ORCPT ); Tue, 5 Dec 2017 06:36:09 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.21/8.16.0.21) with SMTP id vB5BWF6x160352; Tue, 5 Dec 2017 11:36:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=2WGDj+yDJFj6//NEfgM9GyvFqCWb1GKEPCVzUHPvomY=; b=BDGXT/MSPFwKVCP6Pb8TAaKssTcNyvqI4jXVefNX39MpkBWClbkCMyAvKHOnqyt4AF1L fWhijPHFXLAnGyZKMj8XWm/pvzvGrFR3PmKV37BP6iJAxZyYO/znB7al86rvimkbdXxa gp4X6UxCJz9f4+PTBilLv3oOgYX0maifx2z3D85D52P4EkNFZiIqqcgw0vyUlqeu14xK 18qOnDnN/I5t1zbEON3UyXbaBtcKz93Oun6J2npMGcyHK+TIjdE1/W6Jp5R4wVO3usSz XGp6K6xr4pY1UI/NMYKj7QKyZGekio+m+/zjnagQqTsogJ0afj3Xv9/tuuCU/JTOxlXA Bg== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2130.oracle.com with ESMTP id 2en9pgtr9c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 05 Dec 2017 11:36:08 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id vB5Ba7oZ028209 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 5 Dec 2017 11:36:08 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id vB5Ba7Vf020464; Tue, 5 Dec 2017 11:36:07 GMT Received: from localhost.localdomain (/42.60.24.64) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 05 Dec 2017 03:36:07 -0800 From: Anand Jain To: fstests@vger.kernel.org Cc: linux-btrfs@vger.kernel.org Subject: [PATCH v2] btrfs/124: add balance --full-balance option Date: Tue, 5 Dec 2017 19:36:32 +0800 Message-Id: <20171205113632.12589-1-anand.jain@oracle.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171205082628.1676-1-anand.jain@oracle.com> References: <20171205082628.1676-1-anand.jain@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8735 signatures=668637 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1712050166 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP btrfs balance needs --full-balance option since 4.6, so check the version and then use it. As this may be useful for other btrfs tests as well, so this patch also adds _run_btrfs_balance_start() to the common/btrfs file. Signed-off-by: Anand Jain --- v2: Use help to find if --full-balance is supported Make a local variable run the balance instead of getting the options common/btrfs | 11 +++++++++++ tests/btrfs/124 | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/common/btrfs b/common/btrfs index c09206c6f292..c3a62b29c70e 100644 --- a/common/btrfs +++ b/common/btrfs @@ -356,3 +356,14 @@ _btrfs_compression_algos() echo "${feature#/sys/fs/btrfs/features/compress_}" done } + +#runs btrfs balance start with required --full-balance if available. +_run_btrfs_balance_start() +{ + local bal_opt="" + + $BTRFS_UTIL_PROG balance start --help | grep -q "full-balance" + (( $? == 0 )) && bal_opt="--full-balance" + + run_check $BTRFS_UTIL_PROG balance start $bal_opt $* +} diff --git a/tests/btrfs/124 b/tests/btrfs/124 index a6486270a972..94c35fe1ede8 100755 --- a/tests/btrfs/124 +++ b/tests/btrfs/124 @@ -129,7 +129,7 @@ _run_btrfs_util_prog device scan _scratch_mount >> $seqres.full 2>&1 _run_btrfs_util_prog filesystem show echo >> $seqres.full -_run_btrfs_util_prog balance start ${SCRATCH_MNT} +_run_btrfs_balance_start ${SCRATCH_MNT} checkpoint2=`md5sum $SCRATCH_MNT/tf2` echo $checkpoint2 >> $seqres.full 2>&1