From d91d68294c40d63b7a8d0910e5ee0167f9a70228 Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Fri, 16 Jan 2015 19:32:54 +0800 Subject: btrfs-progs: find-root, add option to search through all the metadata extents Add option '-a' for btrfs-find-root to iterate all the metadata extents even the root is already found. Signed-off-by: Qu Wenruo Signed-off-by: David Sterba --- btrfs-find-root.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'btrfs-find-root.c') diff --git a/btrfs-find-root.c b/btrfs-find-root.c index b7481645..9e56c81d 100644 --- a/btrfs-find-root.c +++ b/btrfs-find-root.c @@ -36,7 +36,7 @@ static void usage(void) { - fprintf(stderr, "Usage: find-roots [-o search_objectid] " + fprintf(stderr, "Usage: find-roots [-a] [-o search_objectid] " "[ -g search_generation ] [ -l search_level ] \n"); } @@ -149,20 +149,23 @@ int main(int argc, char **argv) filter.objectid = BTRFS_ROOT_TREE_OBJECTID; filter.match_gen = (u64)-1; filter.match_level = (u8)-1; - while ((opt = getopt(argc, argv, "l:o:g:")) != -1) { + while ((opt = getopt(argc, argv, "al:o:g:")) != -1) { switch(opt) { - case 'o': - filter.objectid = arg_strtou64(optarg); - break; - case 'g': - filter.generation = arg_strtou64(optarg); - break; - case 'l': - filter.level = arg_strtou64(optarg); - break; - default: - usage(); - exit(1); + case 'a': + filter.search_all = 1; + break; + case 'o': + filter.objectid = arg_strtou64(optarg); + break; + case 'g': + filter.generation = arg_strtou64(optarg); + break; + case 'l': + filter.level = arg_strtou64(optarg); + break; + default: + usage(); + exit(1); } } -- cgit v1.2.3