Message ID | b3975f6ad0362885ffd7ff8ff53e7861a316515a.1601318001.git.josef@toxicpanda.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | New rescue mount options | expand |
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 <wqu@suse.com> > Signed-off-by: Josef Bacik <josef@toxicpanda.com> > --- > 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
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"); + break; case Opt_err: btrfs_info(info, "unrecognized rescue option '%s'", p); ret = -EINVAL;