Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55177C4727C for ; Tue, 29 Sep 2020 14:56:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F28BA20759 for ; Tue, 29 Sep 2020 14:56:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729584AbgI2O4t (ORCPT ); Tue, 29 Sep 2020 10:56:49 -0400 Received: from mx2.suse.de ([195.135.220.15]:35826 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728599AbgI2O4t (ORCPT ); Tue, 29 Sep 2020 10:56:49 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 6BD2FB23D; Tue, 29 Sep 2020 14:56:47 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 45640DA701; Tue, 29 Sep 2020 16:55:28 +0200 (CEST) Date: Tue, 29 Sep 2020 16:55:28 +0200 From: David Sterba To: Josef Bacik Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com, Qu Wenruo Subject: Re: [PATCH v2 5/5] btrfs: introduce rescue=all Message-ID: <20200929145527.GG6756@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Josef Bacik , linux-btrfs@vger.kernel.org, kernel-team@fb.com, Qu Wenruo References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Mon, Sep 28, 2020 at 02:34:57PM -0400, Josef Bacik wrote: > Now that we have the building blocks for some better recovery options > with corrupted file systems, add a rescue=all option to enable all of > the relevant rescue options. This will allow distro's to simply default > to rescue=all for the "oh dear lord the world's on fire" recovery > without needing to know all the different options that we have and may > add in the future. > > Reviewed-by: Qu Wenruo > Signed-off-by: Josef Bacik > --- > fs/btrfs/super.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c > index 2282f0240c1d..3412763a9a0d 100644 > --- a/fs/btrfs/super.c > +++ b/fs/btrfs/super.c > @@ -362,6 +362,7 @@ enum { > Opt_nologreplay, > Opt_ignorebadroots, > Opt_ignoredatacsums, > + Opt_all, > > /* Deprecated options */ > Opt_recovery, > @@ -459,6 +460,7 @@ static const match_table_t rescue_tokens = { > {Opt_nologreplay, "nologreplay"}, > {Opt_ignorebadroots, "ignorebadroots"}, > {Opt_ignoredatacsums, "ignoredatacsums"}, > + {Opt_all, "all"}, > {Opt_err, NULL}, > }; > > @@ -510,6 +512,12 @@ static int parse_rescue_options(struct btrfs_fs_info *info, const char *options) > btrfs_set_and_info(info, IGNOREDATACSUMS, > "ignoring data csums"); > break; > + case Opt_all: > + btrfs_set_opt(info->mount_opt, IGNOREDATACSUMS); > + btrfs_set_opt(info->mount_opt, IGNOREBADROOTS); > + btrfs_set_opt(info->mount_opt, NOLOGREPLAY); > + btrfs_info(info, "enabling all of the rescue options"); As we're going to add more options in the future, this shoud be more specific which ones are being enabled under 'all'. btrfs_info(info, "enabling all default rescue options:"); btrfs_set_opt_and_info(info->mount_opt, IGNOREDATACSUMS, "descripton..."); btrfs_set_opt(info->mount_opt, IGNOREBADROOTS); btrfs_set_opt(info->mount_opt, NOLOGREPLAY); Also in sysfs/features we should export all supported rescue options and which are enabled by all. That's just for user convenience so we don't have to publish version + supported options separately. > + break; > case Opt_err: > btrfs_info(info, "unrecognized rescue option '%s'", p); > ret = -EINVAL; > -- > 2.26.2