Commit 9037d3cb authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

btrfs: introduce mount option rescue=all

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 distros 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: default avatarQu Wenruo <wqu@suse.com>
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 882dbe0c
...@@ -362,6 +362,7 @@ enum { ...@@ -362,6 +362,7 @@ enum {
Opt_nologreplay, Opt_nologreplay,
Opt_ignorebadroots, Opt_ignorebadroots,
Opt_ignoredatacsums, Opt_ignoredatacsums,
Opt_rescue_all,
/* Deprecated options */ /* Deprecated options */
Opt_recovery, Opt_recovery,
...@@ -461,6 +462,7 @@ static const match_table_t rescue_tokens = { ...@@ -461,6 +462,7 @@ static const match_table_t rescue_tokens = {
{Opt_ignorebadroots, "ibadroots"}, {Opt_ignorebadroots, "ibadroots"},
{Opt_ignoredatacsums, "ignoredatacsums"}, {Opt_ignoredatacsums, "ignoredatacsums"},
{Opt_ignoredatacsums, "idatacsums"}, {Opt_ignoredatacsums, "idatacsums"},
{Opt_rescue_all, "all"},
{Opt_err, NULL}, {Opt_err, NULL},
}; };
...@@ -512,6 +514,15 @@ static int parse_rescue_options(struct btrfs_fs_info *info, const char *options) ...@@ -512,6 +514,15 @@ static int parse_rescue_options(struct btrfs_fs_info *info, const char *options)
btrfs_set_and_info(info, IGNOREDATACSUMS, btrfs_set_and_info(info, IGNOREDATACSUMS,
"ignoring data csums"); "ignoring data csums");
break; break;
case Opt_rescue_all:
btrfs_info(info, "enabling all of the rescue options");
btrfs_set_and_info(info, IGNOREDATACSUMS,
"ignoring data csums");
btrfs_set_and_info(info, IGNOREBADROOTS,
"ignoring bad roots");
btrfs_set_and_info(info, NOLOGREPLAY,
"disabling log replay at mount time");
break;
case Opt_err: case Opt_err:
btrfs_info(info, "unrecognized rescue option '%s'", p); btrfs_info(info, "unrecognized rescue option '%s'", p);
ret = -EINVAL; ret = -EINVAL;
......
...@@ -334,6 +334,7 @@ static const char *rescue_opts[] = { ...@@ -334,6 +334,7 @@ static const char *rescue_opts[] = {
"nologreplay", "nologreplay",
"ignorebadroots", "ignorebadroots",
"ignoredatacsums", "ignoredatacsums",
"all",
}; };
static ssize_t supported_rescue_options_show(struct kobject *kobj, static ssize_t supported_rescue_options_show(struct kobject *kobj,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment