Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp6377315rwb; Tue, 9 Aug 2022 14:17:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR6x8+enIfelZ8QFUjZse7Gnp5tUB/IQ8QWM86UwAG3BzFxDrbdWk4+13TiVLX2wtuxsA+mK X-Received: by 2002:a17:902:7612:b0:16d:c805:7d4d with SMTP id k18-20020a170902761200b0016dc8057d4dmr24045431pll.171.1660079870487; Tue, 09 Aug 2022 14:17:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660079870; cv=none; d=google.com; s=arc-20160816; b=DbRZbZfD3J08E2dVPCYxvNyGkWKOZl38xUqfrzklAuIXubF47+z5mwiAHHg0ZHJOQc lq2uKOUSi/wu6qsD5u5LoQFRMmp158yXsIDfUio7WP8JmfmYeVzp85FyonB/CEUmQjKu 4PhzSzMnBXDp59G6SlHQM17BQX3pAx01enJtyp+WToBgij4MAU7VEZdRlYoMC/TrgiCW 8axuJEQB8sFW+f2JOibYOoWDgQLAFPHosVxca5MATWZBRO9of5xLrk1PPxBF2U/c3TVL IuFRIsj8c2MoiNFXKtwkgS+RnWWrGDruXctJYOakVAL5x4m1YIkPJntvulccCChEhh4x U+Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=0VIzKUdpZysaKuR5dbdpP2LyZQFRbdf+6/MlZStsrxE=; b=PlZrvMbQr+4saqWcMAagLZado5SM26WsrHdix98fkC/rLHbJyQF5qx08mHdp9Z02oR YiPrLir8hjLP1dE8HeK7hK7nNReZ73pTfge3kk+yc/eFnEqblZ5wf60kqFsMVI5Bn9ti 5KWeVtwwSPn7W/r+i+5o0wxbZTR6HP02Xtl3NS42a5gnaR3O8VRnDGahcF6Hzk7Kuxuf JcxnT2Oet+BV+kEajCZjZlLZJ1x2eR3AoDcaQxPUlEIKLGyVFz6eAsIRl70YD6uzoXPF 52eAGvi7qgqG12EfTSJ7Z+DLwyVaW9dwQy45yTGDeECI6KQ7fmJNA8Vd9tqHt/hFKTRm xv7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EwdEeAVm; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d68-20020a633647000000b0041bc3507335si14447272pga.158.2022.08.09.14.17.35; Tue, 09 Aug 2022 14:17:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EwdEeAVm; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229577AbiHIVBt (ORCPT + 99 others); Tue, 9 Aug 2022 17:01:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230399AbiHIVA5 (ORCPT ); Tue, 9 Aug 2022 17:00:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 471BB2C659; Tue, 9 Aug 2022 14:00:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 71F1A60B9F; Tue, 9 Aug 2022 21:00:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF2ABC433D6; Tue, 9 Aug 2022 21:00:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660078852; bh=bnN3+rr2Irc5hVunotTz6N7Asyuu/jHCPgME80PdV/0=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=EwdEeAVmeLmhyGUN7Dyi9mf7JE4cvsQdlP1QcGfNpm57tI/1sMIpvx3/hig7GwxOe Xv9D4YS8pVp2oqD+ttJfylYfaj97ZalB+rcSO3lVbTGzyMZu1F55sDAZ7E8md5AVam +qvP5G1VJFtv0EgLROX2sElULWT1aQdZj03zzEGWFuWmH1oLqPtUYJVwkra4giWAHM pqaZps2YERmd+GBrHc0kb4rpNLc6TJsF3hkvsYHQ8HuZ/0OKJHEFs4y4AKQqwtEeP0 tLV/L/UHJbsGRrkv7bzgIYyqSRpETmXnQ9G8TuZYXcZ1pq8wtstKEaV5q+Nmd1J/1R 5ZypLORPVytfA== Subject: [PATCH 2/3] common/rc: move XFS-specific parts of _scratch_options into common/xfs From: "Darrick J. Wong" To: djwong@kernel.org, guaneryu@gmail.com, zlang@redhat.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me, tytso@mit.edu, linux-ext4@vger.kernel.org Date: Tue, 09 Aug 2022 14:00:52 -0700 Message-ID: <166007885241.3276300.13584305054616588936.stgit@magnolia> In-Reply-To: <166007884125.3276300.15348421560641051945.stgit@magnolia> References: <166007884125.3276300.15348421560641051945.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Darrick J. Wong Move all the non-XFS code in _scratch_options into a _scratch_xfs_options helper in common/xfs, in preparation to add ext4 bits. Signed-off-by: Darrick J. Wong --- common/rc | 23 +++-------------------- common/xfs | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/common/rc b/common/rc index 52dd3b41..dc1d65c3 100644 --- a/common/rc +++ b/common/rc @@ -172,30 +172,13 @@ _clear_mount_stack() _scratch_options() { - local type=$1 - local rt_opt="" - local log_opt="" SCRATCH_OPTIONS="" - if [ "$FSTYP" != "xfs" ]; then - return - fi - - case $type in - mkfs) - SCRATCH_OPTIONS="$SCRATCH_OPTIONS -f" - rt_opt="-r" - log_opt="-l" - ;; - mount) - rt_opt="-o" - log_opt="-o" + case "$FSTYP" in + "xfs") + _scratch_xfs_options "$@" ;; esac - [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \ - SCRATCH_OPTIONS="$SCRATCH_OPTIONS ${rt_opt}rtdev=$SCRATCH_RTDEV" - [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ - SCRATCH_OPTIONS="$SCRATCH_OPTIONS ${log_opt}logdev=$SCRATCH_LOGDEV" } _test_options() diff --git a/common/xfs b/common/xfs index 9f84dffb..f6f4cdd2 100644 --- a/common/xfs +++ b/common/xfs @@ -265,6 +265,29 @@ _xfs_check() return $status } +_scratch_xfs_options() +{ + local type=$1 + local rt_opt="" + local log_opt="" + + case $type in + mkfs) + SCRATCH_OPTIONS="$SCRATCH_OPTIONS -f" + rt_opt="-r" + log_opt="-l" + ;; + mount) + rt_opt="-o" + log_opt="-o" + ;; + esac + [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \ + SCRATCH_OPTIONS="$SCRATCH_OPTIONS ${rt_opt}rtdev=$SCRATCH_RTDEV" + [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ + SCRATCH_OPTIONS="$SCRATCH_OPTIONS ${log_opt}logdev=$SCRATCH_LOGDEV" +} + _scratch_xfs_db_options() { SCRATCH_OPTIONS=""