From c328e0db4a6759941d6c44e08aa78e5b1cd16bef Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Mon, 2 Nov 2015 16:34:19 +0800 Subject: btrfs-progs: show-super: Add option to print superblock at given bytenr Add '-s ' option to show superblock at given bytenr. This is very useful to debug non-standard btrfs, like debuging the 1st stage btrfs of btrfs-convert. Signed-off-by: Qu Wenruo [ minor updates in docs ] Signed-off-by: David Sterba --- btrfs-show-super.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'btrfs-show-super.c') diff --git a/btrfs-show-super.c b/btrfs-show-super.c index 27414c88..d8ad69e2 100644 --- a/btrfs-show-super.c +++ b/btrfs-show-super.c @@ -48,6 +48,7 @@ static void print_usage(void) fprintf(stderr, "\t-a : print information of all superblocks\n"); fprintf(stderr, "\t-i : specify which mirror to print out\n"); fprintf(stderr, "\t-F : attempt to dump superblocks with bad magic\n"); + fprintf(stderr, "\t-s : specify alternate superblock offset\n"); fprintf(stderr, "%s\n", PACKAGE_STRING); } @@ -63,7 +64,7 @@ int main(int argc, char **argv) u64 arg; u64 sb_bytenr = btrfs_sb_offset(0); - while ((opt = getopt(argc, argv, "fFai:")) != -1) { + while ((opt = getopt(argc, argv, "fFai:s:")) != -1) { switch (opt) { case 'i': arg = arg_strtou64(optarg); @@ -86,6 +87,10 @@ int main(int argc, char **argv) case 'F': force = 1; break; + case 's': + sb_bytenr = arg_strtou64(optarg); + all = 0; + break; default: print_usage(); exit(1); -- cgit v1.2.3