diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-08-03 17:19:48 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-08-03 17:20:13 -0400 |
commit | 8885dbe8df1f67e28464cb1d64d5ce2e05eff09d (patch) | |
tree | b87a3c9e830add70df9101c29abaf2a4d3c049fd | |
parent | bafc817a3f33adbf2ff701bf8f6757aedb0a1458 (diff) | |
download | bcachefs-tools-8885dbe8df1f67e28464cb1d64d5ce2e05eff09d.tar.gz |
cmd_dump: Making dumping the entire journal the default
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | cmd_dump.c | 21 |
1 files changed, 15 insertions, 6 deletions
@@ -1,4 +1,5 @@ #include <fcntl.h> +#include <getopt.h> #include <string.h> #include <sys/stat.h> #include <sys/types.h> @@ -21,9 +22,9 @@ static void dump_usage(void) "\n" "Options:\n" " -o output Output qcow2 image(s)\n" - " -f Force; overwrite when needed\n" - " -j Dump entire journal, not just dirty entries\n" - " -h Display this help and exit\n" + " -f, --force Force; overwrite when needed\n" + " --nojournal Don't dump entire journal, just dirty entries\n" + " -h, --help Display this help and exit\n" "Report bugs to <linux-bcachefs@vger.kernel.org>"); } @@ -106,11 +107,18 @@ static void dump_one_device(struct bch_fs *c, struct bch_dev *ca, int fd, int cmd_dump(int argc, char *argv[]) { + static const struct option longopts[] = { + { "force", no_argument, NULL, 'f' }, + { "nojournal", no_argument, NULL, 'j' }, + { "verbose", no_argument, NULL, 'v' }, + { "help", no_argument, NULL, 'h' }, + { NULL } + }; struct bch_opts opts = bch2_opts_empty(); struct bch_dev *ca; char *out = NULL; unsigned i, nr_devices = 0; - bool force = false, entire_journal = false; + bool force = false, entire_journal = true; int fd, opt; opt_set(opts, nochanges, true); @@ -119,7 +127,8 @@ int cmd_dump(int argc, char *argv[]) opt_set(opts, errors, BCH_ON_ERROR_continue); opt_set(opts, fix_errors, FSCK_FIX_no); - while ((opt = getopt(argc, argv, "o:fjvh")) != -1) + while ((opt = getopt_long(argc, argv, "o:fvh", + longopts, NULL)) != -1) switch (opt) { case 'o': out = optarg; @@ -128,7 +137,7 @@ int cmd_dump(int argc, char *argv[]) force = true; break; case 'j': - entire_journal = true; + entire_journal = false; break; case 'v': opt_set(opts, verbose, true); |