5 #include "tools-util.h"
7 static void usage(void)
9 puts("bcache fsck - filesystem check and repair\n"
10 "Usage: bcache fsck [OPTION]... <devices>\n"
13 " -p Automatic repair (no questions\n"
14 " -n Don't repair, only check for errors\n"
15 " -y Assume \"yes\" to all questions\n"
16 " -f Force checking even if filesystem is marked clean\n"
18 " --h Display this help and exit\n"
19 "Report bugs to <linux-bcache@vger.kernel.org>");
22 int cmd_fsck(int argc, char *argv[])
24 struct bch_opts opts = bch_opts_empty();
25 struct bch_fs *c = NULL;
29 while ((opt = getopt(argc, argv, "pynfvh")) != -1)
32 fsck_err_opt = FSCK_ERR_YES;
35 fsck_err_opt = FSCK_ERR_YES;
38 opts.nochanges = true;
39 fsck_err_opt = FSCK_ERR_NO;
42 /* force check, even if filesystem marked clean: */
45 opts.verbose_recovery = true;
53 die("Please supply device(s) to check");
55 err = bch_fs_open(argv + optind, argc - optind, opts, &c);
57 die("error opening %s: %s", argv[optind], err);