Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp18418imn; Wed, 3 Aug 2022 17:41:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uBf610wjRWRBuMTeVIdxGQS6lFlXKrba4piStrRvGavhzhNEetKPRkaNigyKBsLmGe3X49 X-Received: by 2002:a05:6402:16:b0:43a:f435:5d07 with SMTP id d22-20020a056402001600b0043af4355d07mr29044243edu.420.1659573669801; Wed, 03 Aug 2022 17:41:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659573669; cv=none; d=google.com; s=arc-20160816; b=Z5Majmjzzdfy2df9d5++ugFKMYaMVSBoOLNpMEHC+/yNPl7eybtGG/5DGPlPm5PdX8 ME8bmuOHjHd5oxy2ZrV1TJf9FWkd7DUEZURj5WPMvOAiXfO6BeAbv8kAnnF+nVpYj839 vbfnE9Wd9GJDj/xhcGtATAqKCzJsI/JBWoyt4zEw150zbO6b1Btf0VyH3XwKkFLWi+wi TXSMgoAEwd1vZ0h/1sRw3BDkieg1LBLeGHkv96NbOPcwWulFlGk468WsH1l06zVMlkqV Do8ZN5mj8xEUDlH1WPl1bxKDlXqpgtW55NcF6yH+0RxF5BzKhHem9BXv/czN1zhy1bbi D0yA== 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=abjZs7xFb4c2Od/gTMSwZfj8i3dZ6yPjhTIRtBw0HOg=; b=zJ0D7r+fyZrke3TWLeB1pei532cR2nrPLCwzb91dDCheZrC+TzYFxOb49Gd1+ZPT7h jV893YVz3I3oBewFdBDXJUkPUDpceBxryGF/KjY40tw0dnHhKapyfxvow5JoViEdgjTu 42AucMBWzBxaqSfI1NZZ/+IsS/y9+mFXtMyN6ssfekMJQqH7g3n/SDOrF3Y7/rLfBWk5 wHiyxS2y641D8Zy4YOXEOCstttm6dasjKmd5zAkcY8y4M2+VRKT9lrLgGFORLWxwdLeW kk8by5JH+M50Z2uKJUTgwjkWT7BXyaqP1TWkkFU8awCN4DaEFuPgicDen73JpKy0HZ6k BeJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p0zK5xCZ; 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 oz31-20020a1709077d9f00b0072aeaa77021si18434832ejc.179.2022.08.03.17.40.23; Wed, 03 Aug 2022 17:41:09 -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=p0zK5xCZ; 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 S236937AbiHDAZO (ORCPT + 99 others); Wed, 3 Aug 2022 20:25:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236904AbiHDAZO (ORCPT ); Wed, 3 Aug 2022 20:25:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0679B52; Wed, 3 Aug 2022 17:25:12 -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 6C99B61737; Thu, 4 Aug 2022 00:25:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C88FDC433D6; Thu, 4 Aug 2022 00:25:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659572711; bh=kqKZ7ISpCOBkkf9SIOPno19SY8z+jeRc+EusXoBgFgA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=p0zK5xCZh1z2AWHnjsB8hd9Vaa1oXPh+RkQWeXSRJzjy8gHy5X+pilsNL6+VHf8zG LI8lyn8NmmWsUskgL6VxHGzk1BMOjk8cd2/U9w0Fs2EkozH5hfM7MgzWQTnY89Y8dM BqqLFzcH4Y87m+UI+JEqXXof/E8h7POS03yOcLgSbcnabewtlNvppvs4kJPVu9NWRK /mTWSEY2rVnENtROP4cOKi2j3j1WhyQITMT2KJgj+jZVc/5QGQTYbLrWvAQr9A6AgV 9DiyBXr8Ew8wuC0Q1mG++3+UHop9E/g/4SsOLaKzsrXwbMwZGCtK5FbfM8AqYAxdPb wmqexXhwKlj4g== Date: Wed, 3 Aug 2022 17:25:11 -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: [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: <165950051745.198922.6487109955066878945.stgit@magnolia> 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 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 --- 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" +} + _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)" + ;; + esac + [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ + SCRATCH_OPTIONS="$SCRATCH_OPTIONS ${log_opt}" +} 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 }