Message ID | 2377349868151ecd4be5f7077d22220793492f58.1600961206.git.josef@toxicpanda.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | New rescue mount options | expand |
On 2020/9/24 下午11:32, 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. > > Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Thanks, Qu > --- > 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"); > + break; > case Opt_err: > btrfs_info(info, "unrecognized rescue option '%s'", p); > ret = -EINVAL; >
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;
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. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- fs/btrfs/super.c | 8 ++++++++ 1 file changed, 8 insertions(+)