mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-23 00:00:02 +03:00
Add reconstruct_alloc option to fsck
This commit is contained in:
parent
34c9be19b3
commit
6a765fd085
15
cmd_fsck.c
15
cmd_fsck.c
@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
|
#include <getopt.h>
|
||||||
#include "cmds.h"
|
#include "cmds.h"
|
||||||
#include "libbcachefs/error.h"
|
#include "libbcachefs/error.h"
|
||||||
#include "libbcachefs.h"
|
#include "libbcachefs.h"
|
||||||
@ -15,13 +16,18 @@ static void usage(void)
|
|||||||
" -n Don't repair, only check for errors\n"
|
" -n Don't repair, only check for errors\n"
|
||||||
" -y Assume \"yes\" to all questions\n"
|
" -y Assume \"yes\" to all questions\n"
|
||||||
" -f Force checking even if filesystem is marked clean\n"
|
" -f Force checking even if filesystem is marked clean\n"
|
||||||
|
" --reconstruct_alloc Reconstruct the alloc btree\n"
|
||||||
" -v Be verbose\n"
|
" -v Be verbose\n"
|
||||||
" --h Display this help and exit\n"
|
" --h Display this help and exit\n"
|
||||||
"Report bugs to <linux-bcache@vger.kernel.org>");
|
"Report bugs to <linux-bcachefs@vger.kernel.org>");
|
||||||
}
|
}
|
||||||
|
|
||||||
int cmd_fsck(int argc, char *argv[])
|
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();
|
struct bch_opts opts = bch2_opts_empty();
|
||||||
unsigned i;
|
unsigned i;
|
||||||
int opt, ret = 0;
|
int opt, ret = 0;
|
||||||
@ -30,7 +36,9 @@ int cmd_fsck(int argc, char *argv[])
|
|||||||
opt_set(opts, fsck, true);
|
opt_set(opts, fsck, true);
|
||||||
opt_set(opts, fix_errors, FSCK_OPT_ASK);
|
opt_set(opts, fix_errors, FSCK_OPT_ASK);
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "apynfo:vh")) != -1)
|
while ((opt = getopt_long(argc, argv,
|
||||||
|
"apynfo:vh",
|
||||||
|
longopts, NULL)) != -1)
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'a': /* outdated alias for -p */
|
case 'a': /* outdated alias for -p */
|
||||||
case 'p':
|
case 'p':
|
||||||
@ -51,6 +59,9 @@ int cmd_fsck(int argc, char *argv[])
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
break;
|
break;
|
||||||
|
case 'R':
|
||||||
|
opt_set(opts, reconstruct_alloc, true);
|
||||||
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
opt_set(opts, verbose, true);
|
opt_set(opts, verbose, true);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user