Skip to content

Commit 9037d3c

Browse files
josefbacikkdave
authored andcommitted
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: Qu Wenruo <[email protected]> Signed-off-by: Josef Bacik <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 882dbe0 commit 9037d3c

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

fs/btrfs/super.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ enum {
362362
Opt_nologreplay,
363363
Opt_ignorebadroots,
364364
Opt_ignoredatacsums,
365+
Opt_rescue_all,
365366

366367
/* Deprecated options */
367368
Opt_recovery,
@@ -461,6 +462,7 @@ static const match_table_t rescue_tokens = {
461462
{Opt_ignorebadroots, "ibadroots"},
462463
{Opt_ignoredatacsums, "ignoredatacsums"},
463464
{Opt_ignoredatacsums, "idatacsums"},
465+
{Opt_rescue_all, "all"},
464466
{Opt_err, NULL},
465467
};
466468

@@ -512,6 +514,15 @@ static int parse_rescue_options(struct btrfs_fs_info *info, const char *options)
512514
btrfs_set_and_info(info, IGNOREDATACSUMS,
513515
"ignoring data csums");
514516
break;
517+
case Opt_rescue_all:
518+
btrfs_info(info, "enabling all of the rescue options");
519+
btrfs_set_and_info(info, IGNOREDATACSUMS,
520+
"ignoring data csums");
521+
btrfs_set_and_info(info, IGNOREBADROOTS,
522+
"ignoring bad roots");
523+
btrfs_set_and_info(info, NOLOGREPLAY,
524+
"disabling log replay at mount time");
525+
break;
515526
case Opt_err:
516527
btrfs_info(info, "unrecognized rescue option '%s'", p);
517528
ret = -EINVAL;

fs/btrfs/sysfs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ static const char *rescue_opts[] = {
334334
"nologreplay",
335335
"ignorebadroots",
336336
"ignoredatacsums",
337+
"all",
337338
};
338339

339340
static ssize_t supported_rescue_options_show(struct kobject *kobj,

0 commit comments

Comments
 (0)