From patchwork Wed May 23 10:50:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eryu Guan X-Patchwork-Id: 10420917 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 1D91660545 for ; Wed, 23 May 2018 10:50:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DC0328CFD for ; Wed, 23 May 2018 10:50:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0288828E43; Wed, 23 May 2018 10:50:52 +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=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=unavailable 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 ADB7328E50 for ; Wed, 23 May 2018 10:50:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932489AbeEWKuv (ORCPT ); Wed, 23 May 2018 06:50:51 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:45154 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932312AbeEWKuv (ORCPT ); Wed, 23 May 2018 06:50:51 -0400 Received: by mail-pl0-f68.google.com with SMTP id bi12-v6so12783646plb.12; Wed, 23 May 2018 03:50:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=TjBqjLrOmdXXkWsgSPTV9bQRYnB4wjsxv9vLxRBbHqk=; b=apQnMYbx+OiGCjVjzznDsvy4jQuMRlrUE6xOfJgPpwBBq4U5pz508WNm66B/VjNLDy g2jkOHwOPbK/0dfMlQ0LIuViTEnAYViLKEw+RVGYuDpImJjtnUbIjV7EuG6/SQxWzQxB R9Uui72BK10GjgdsOx4N16Z5rQ9b4vOoosWICu2DO8w58ER3/7V8JpGbQYUP8ZY748an 86Psf3QbDYmmBB39BGRQEoggnQ9zai6A6ehGsW7EkkF6SZYnaIfkaPs82UHdezpwKtP1 aQuXlNhpu2pzhQpOfi0VRLP4jncBUwd7CFxlENfCKB9GSv2qSsmo9J+H7nf5GdK5p1vG DQMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=TjBqjLrOmdXXkWsgSPTV9bQRYnB4wjsxv9vLxRBbHqk=; b=h64Uah0sMxwrzsblD6KNLPmaOnoL8M12pbVNjENGxB2vK0YqLsVLWG1Qx/ItupQ+gw 6rDwfsCNYspvdBGyDRg01p/RkRzw5O/1faFNohMNywtNaMOSpq41JDizqMJ+1nglsp6q m4Mh530Up+i5BUq6mPu65yc9ANVz03liUxrqqgJHyk9d3f3RifFy6lk1TqLXSeiUCFYu QDjkWerMRCMbs1tvrCqNvqMnCsshV2YrRGYzm+sy4ytI9dldDEtVgLDeJs0uLqqVBhOs uogJ/0ZPibGYIFqMa4CppHqhMD/DDSAcDsZKxiIIqiIGRQ8JFy4FQgPAv6Rexzru2zs9 Sfew== X-Gm-Message-State: ALKqPwe9wJkPa525rQZJ+5jfKjqEUEXjcCpt3mrCdnXnzL2t58YFOcUN GJUG7t8qieKrwHe4FQz9NVLG7aQv X-Google-Smtp-Source: AB8JxZqezThx15D3HUUzbtQm8v3Pon87yCa3EsDAKBWRolW9uEtHk9+LMBRgA0I3cqeoHVeHgnUp1Q== X-Received: by 2002:a17:902:82c3:: with SMTP id u3-v6mr2410541plz.83.1527072650248; Wed, 23 May 2018 03:50:50 -0700 (PDT) Received: from localhost ([128.199.137.77]) by smtp.gmail.com with ESMTPSA id b13-v6sm25297662pgu.54.2018.05.23.03.50.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 May 2018 03:50:49 -0700 (PDT) From: Eryu Guan To: fstests@vger.kernel.org Cc: Dave Chinner , Zorro Lang , linux-xfs@vger.kernel.org, Eryu Guan Subject: [PATCH v2] xfs: remove meta mkfs options correctly in _scratch_mkfs_xfs Date: Wed, 23 May 2018 18:50:35 +0800 Message-Id: <20180523105035.8157-1-guaneryu@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Prior to commit 596a068bf130 ("fstests: teach _scratch_mkfs to handle mkfs option conflicts"), one of _scratch_mkfs_xfs_opts()'s job is to remove any metadata related mkfs options if mkfs.xfs binary doesn't support them, so that tests that pass metadada mkfs options to _scratch_mkfs, e.g. "_scratch_mkfs -m crc=0" won't break with old mkfs.xfs. But commit 596a068bf130 broke this, because it didn't pass any mkfs options to _scratch_mkfs_xfs_opts(). Fix it by introducing a new helper _xfs_mkfs_remove_meta_opts() to remove any meta related mkfs options if necessary, and moving that function out of _scratch_mkfs_xfs_opts(). Reported-by: Dave Chinner Signed-off-by: Eryu Guan --- v2: - treat "extra options" as extra options, so move remove-meta-opts function out of _scratch_mkfs_xfs_opts() to a new helper _xfs_mkfs_remove_meta_opts common/xfs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/common/xfs b/common/xfs index 92223513d561..1385c8c7e57b 100644 --- a/common/xfs +++ b/common/xfs @@ -44,18 +44,20 @@ _setup_large_xfs_fs() return 0 } -_scratch_mkfs_xfs_opts() +# remove metadata related mkfs options if mkfs.xfs doesn't support them +_xfs_mkfs_remove_meta_opts() { - mkfs_opts=$* - - # remove metadata related mkfs options if mkfs.xfs doesn't them + local mkfs_opts="$*" if [ -n "$XFS_MKFS_HAS_NO_META_SUPPORT" ]; then - mkfs_opts=`echo $mkfs_opts | sed "s/-m\s\+\S\+//g"` + mkfs_opts=`echo $* | sed "s/-m\s\+\S\+//g"` fi + echo "$mkfs_opts" +} +_scratch_mkfs_xfs_opts() +{ _scratch_options mkfs - - echo "$MKFS_XFS_PROG $SCRATCH_OPTIONS $mkfs_opts" + echo "$MKFS_XFS_PROG $SCRATCH_OPTIONS" } @@ -83,10 +85,12 @@ _scratch_mkfs_xfs() local mkfs_filter="sed -e '/less than device physical sector/d' \ -e '/switching to logical sector/d' \ -e '/Default configuration/d'" + local extra_mkfs_opts="`_xfs_mkfs_remove_meta_opts $*`" local tmp=`mktemp -u` local mkfs_status - _scratch_do_mkfs "$mkfs_cmd" "$mkfs_filter" $* 2>$tmp.mkfserr 1>$tmp.mkfsstd + _scratch_do_mkfs "$mkfs_cmd" "$mkfs_filter" "$extra_mkfs_opts" \ + 2>$tmp.mkfserr 1>$tmp.mkfsstd mkfs_status=$?