Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp112447imn; Wed, 3 Aug 2022 22:16:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR6J9HbJ9F4/cDrklBmIU0xAUDTK6phUSTiHIYyjxGz8/nWUJBShQX7nw492fz0xJfwX5DLe X-Received: by 2002:a17:907:16a8:b0:730:a324:2712 with SMTP id hc40-20020a17090716a800b00730a3242712mr131077ejc.368.1659590218133; Wed, 03 Aug 2022 22:16:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659590218; cv=none; d=google.com; s=arc-20160816; b=piIgPT5qs1jH3hGdZgqIfwbhW4popEK/WhzFUXgCXWLK44n9kusxm67H/WNVxOSxKe VfqNsiHWl5D6MgTU7pBV0b/75THeFbDCL1WItXABPWmkrNHkx5YvtXeXYXdrJ+HL2tBH Kln1W7572ArVObvm/YT9qkMTsqkEYBfeH5yPk1gSzTzyDCd9Pndd+XTice7jT4EjmJdQ j/rulUqECgcQhjCywV3E91tnjZYdfofZmFhowM4qxWG9N8paA3SUBU0mW8kehyg73adY U3UyzhbtkZ8bAVE7xLhOiJmf5ALXzz20eTdBTmaZyaNmYbkkjZd3+5nuja34FyLPaVz1 BeBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=qYPevAGIhS245wQ3JrB5iLyBz8QlV5Hxx51ia8/CUVg=; b=Woi34xCj8t7WSYfIzOWwVF7p8/zpvltjmGLixYX9BTArnp1rKC9dMxlL0gSAF5Yu26 XtFXq1T/FzwqdwI/89Oy8vhl/mIfQu+gEWdjRmNGB6rXNUqaOb6UxRnvzemxl45Tv6HN CxLmOcyoDn85ejB0lV4tbi1T+TXB9J/EBVK1S1EIVc4fVC4NTucl5YCpmxpg+UR/y2mX H3yOzmx5QU9vKpoeS5A5xkY4wdvt7NQbASKvMMYhG+AS9hfYZ+TL2cnVmrqPt5tC3iCh dKSTFtS7WoCB49fecRiBbcTzbrfyH8WEtww8DW2HoV3wrRXYiG4vluAq13ui7UHeeLml xGPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=R9bzvLMf; 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 o9-20020a170906974900b0072b6ea73316si8520772ejy.664.2022.08.03.22.16.21; Wed, 03 Aug 2022 22:16:58 -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=R9bzvLMf; 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 S231843AbiHDFDy (ORCPT + 99 others); Thu, 4 Aug 2022 01:03:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229991AbiHDFDx (ORCPT ); Thu, 4 Aug 2022 01:03:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C5595FADD; Wed, 3 Aug 2022 22:03:52 -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 ams.source.kernel.org (Postfix) with ESMTPS id 4BCD6B82394; Thu, 4 Aug 2022 05:03:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01D6CC433C1; Thu, 4 Aug 2022 05:03:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659589430; bh=MNAl6XZ8UoFXNt+z/eBH1q/kL/m18X8MdS29g9B+SYw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=R9bzvLMfNE8ySAJH4ks7Nmkn7AjD0SOiS8CcWt7ycmIQWXE/tBfWJ5YhnCo5U8t6/ 8ZPclcbY0aSjgz5S2sagbJomxyrQNIay1D9JGTikegh39iMvUoFBjhMkGEmwwBWpFt ncaaDLz90qv5DlW3nvm7/kLfm6QMZ3RXGCn0R3OZL99XrYHWQ3xr+u/FbGN7a0Dczs DEObkDNJ0p1w4ur1G0JbeT1zOauZJW0J8QWIf9a2qypywyBTLdeg/7/Enz5A03+b2n f+Dkc9l9CU4CbtrUFJZ/4apvl6aoflk/5hfzXgNrd8t1gSVspwHLKThUitdV9VmVxs 8piqfeNQW4xcg== Date: Wed, 3 Aug 2022 22:03:49 -0700 From: "Darrick J. Wong" To: 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 Subject: Re: [PATCH v1.2 3/3] common/ext4: provide custom ext4 scratch fs options Message-ID: References: <165950050051.198922.13423077997881086438.stgit@magnolia> <165950051745.198922.6487109955066878945.stgit@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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 On Wed, Aug 03, 2022 at 05:25:11PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong > > Create a _scratch_options backend for ext* so that we can inject > pathnames to external log devices into the scratch fs mount options. > This enables common/dm* to install block device filters, e.g. dm-error > for stress testing. > > Signed-off-by: Darrick J. Wong > v1.2: refactor _scratch_mkfs_ext4 to use _scratch_options too Self NAK, this still has broken bits... > --- > common/ext4 | 34 +++++++++++++++++++++++++++++++--- > common/rc | 3 +++ > 2 files changed, 34 insertions(+), 3 deletions(-) > > diff --git a/common/ext4 b/common/ext4 > index 287705af..8a3385af 100644 > --- a/common/ext4 > +++ b/common/ext4 > @@ -63,16 +63,24 @@ _setup_large_ext4_fs() > return 0 > } > > +_scratch_mkfs_ext4_opts() > +{ > + mkfs_opts=$* > + > + _scratch_options mkfs > + > + echo "$MKFS_EXT4_PROG -F $SCRATCH_OPTIONS $mkfs_opts" ...the -F should go in _scratch_ext4_options... > +} > + > _scratch_mkfs_ext4() > { > - local mkfs_cmd="$MKFS_EXT4_PROG -F" > + local mkfs_cmd="`_scratch_mkfs_ext4_opts`" > local mkfs_filter="grep -v -e ^Warning: -e \"^mke2fs \" | grep -v \"^$\"" > local tmp=`mktemp -u` > local mkfs_status > > [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ > - $mkfs_cmd -O journal_dev $MKFS_OPTIONS $SCRATCH_LOGDEV && \ > - mkfs_cmd="$mkfs_cmd -J device=$SCRATCH_LOGDEV" > + $MKFS_EXT4_PROG -F -O journal_dev $MKFS_OPTIONS $SCRATCH_LOGDEV > > _scratch_do_mkfs "$mkfs_cmd" "$mkfs_filter" $* 2>$tmp.mkfserr 1>$tmp.mkfsstd > mkfs_status=$? > @@ -154,3 +162,23 @@ _require_scratch_richacl_ext4() > || _notrun "kernel doesn't support richacl feature on $FSTYP" > _scratch_unmount > } > + > +_scratch_ext4_options() > +{ > + local type=$1 > + local log_opt="" > + > + case $type in > + mkfs) > + log_opt="-J device=$SCRATCH_LOGDEV" > + ;; > + mount) > + # As of kernel 5.19, the kernel mount option path parser only accepts > + # direct paths to block devices--the final path component cannot be a > + # symlink. > + log_opt="-o journal_path=$(realpath $SCRATCH_LOGDEV)" ...and this ought to be `realpath -q "$SCRATCH_LOGDEV"' to avoid breaking the non-external-journal case. > + ;; > + esac > + [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ > + SCRATCH_OPTIONS="$SCRATCH_OPTIONS ${log_opt}" Tab/space insanity here. --D > +} > diff --git a/common/rc b/common/rc > index dc1d65c3..b82bb36b 100644 > --- a/common/rc > +++ b/common/rc > @@ -178,6 +178,9 @@ _scratch_options() > "xfs") > _scratch_xfs_options "$@" > ;; > + ext2|ext3|ext4|ext4dev) > + _scratch_ext4_options "$@" > + ;; > esac > } >