X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=cmd_fsck.c;h=736a4ca5023fa272dbab91877abcbab4c5f4a5bd;hb=37c9ba26af8aacba394ff8e6450ed6d49db6d623;hp=824c4a1c29304ac651092861a2a9507ff20c03c8;hpb=be02db130bf75c28e402d890f4d994f3608707ff;p=bcachefs-tools-debian diff --git a/cmd_fsck.c b/cmd_fsck.c index 824c4a1..736a4ca 100644 --- a/cmd_fsck.c +++ b/cmd_fsck.c @@ -1,4 +1,5 @@ +#include #include "cmds.h" #include "libbcachefs/error.h" #include "libbcachefs.h" @@ -11,25 +12,33 @@ static void usage(void) "Usage: bcachefs fsck [OPTION]... \n" "\n" "Options:\n" - " -p Automatic repair (no questions)\n" - " -n Don't repair, only check for errors\n" - " -y Assume \"yes\" to all questions\n" - " -f Force checking even if filesystem is marked clean\n" - " -v Be verbose\n" - " --h Display this help and exit\n" - "Report bugs to "); + " -p Automatic repair (no questions)\n" + " -n Don't repair, only check for errors\n" + " -y Assume \"yes\" to all questions\n" + " -f Force checking even if filesystem is marked clean\n" + " --reconstruct_alloc Reconstruct the alloc btree\n" + " -v Be verbose\n" + " -h Display this help and exit\n" + "Report bugs to "); } int cmd_fsck(int argc, char *argv[]) { + static const struct option longopts[] = { + { "reconstruct_alloc", no_argument, NULL, 'R' }, + { NULL } + }; struct bch_opts opts = bch2_opts_empty(); unsigned i; int opt, ret = 0; opt_set(opts, degraded, true); + opt_set(opts, fsck, true); opt_set(opts, fix_errors, FSCK_OPT_ASK); - while ((opt = getopt(argc, argv, "apynfvh")) != -1) + while ((opt = getopt_long(argc, argv, + "apynfo:vh", + longopts, NULL)) != -1) switch (opt) { case 'a': /* outdated alias for -p */ case 'p': @@ -45,6 +54,14 @@ int cmd_fsck(int argc, char *argv[]) case 'f': /* force check, even if filesystem marked clean: */ break; + case 'o': + ret = bch2_parse_mount_opts(&opts, optarg); + if (ret) + return ret; + break; + case 'R': + opt_set(opts, reconstruct_alloc, true); + break; case 'v': opt_set(opts, verbose, true); break;