From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Subject: [PATCH v2 09/10] btrfs-progs: Add new option for btrfs-find-root to search through all the metadata extents.
Date: Mon, 19 Jan 2015 14:45:11 +0800 [thread overview]
Message-ID: <1421649912-14539-10-git-send-email-quwenruo@cn.fujitsu.com> (raw)
In-Reply-To: <1421649912-14539-1-git-send-email-quwenruo@cn.fujitsu.com>
Add option '-a' for btrfs-find-root to iterate all the metadata extents
even the root is already found.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
Documentation/btrfs-find-root.txt | 2 ++
btrfs-find-root.c | 31 +++++++++++++++++--------------
2 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/Documentation/btrfs-find-root.txt b/Documentation/btrfs-find-root.txt
index c934b4c..e04cd3e 100644
--- a/Documentation/btrfs-find-root.txt
+++ b/Documentation/btrfs-find-root.txt
@@ -16,6 +16,8 @@ root tree's objectid, generation, level.
OPTIONS
-------
+-a::
+Search through all the metadata extents, even the root is already found.
-g <generation>::
Filter root tree by it's original transaction id, tree root's generation in default.
-o <objectid>::
diff --git a/btrfs-find-root.c b/btrfs-find-root.c
index 31fe0ae..1da5513 100644
--- a/btrfs-find-root.c
+++ b/btrfs-find-root.c
@@ -39,7 +39,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 ] <device>\n");
}
@@ -152,20 +152,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);
}
}
--
2.2.2
next prev parent reply other threads:[~2015-01-19 6:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-19 6:45 [PATCH v2 00/10] Enhance btrfs-find-root and open_ctree() to provide better chance on damaged btrfs Qu Wenruo
2015-01-19 6:45 ` [PATCH v2 01/10] btrfs-progs: Cleanup, use bitshift instead of immediate number in btrfs_open_ctree_flags Qu Wenruo
2015-01-19 6:45 ` [PATCH v2 02/10] btrfs-progs: Add support to suppress tree block csum error output Qu Wenruo
2015-01-28 18:16 ` David Sterba
2015-01-29 0:58 ` Qu Wenruo
2015-01-19 6:45 ` [PATCH v2 03/10] btrfs-progs: Add new btrfs_open_ctree_flags CHUNK_ONLY Qu Wenruo
2015-01-19 6:45 ` [PATCH v2 04/10] btrfs-progs: Add new find-root.[ch] infrastructure Qu Wenruo
2015-01-19 6:45 ` [PATCH v2 05/10] btrfs-progs: Switch btrfs-find-root to use the new open_ctree flags Qu Wenruo
2015-01-19 6:45 ` [PATCH v2 06/10] btrfs-progs: Add better search generation judgment for btrfs-find-root Qu Wenruo
2015-01-19 6:45 ` [PATCH v2 07/10] btrfs-progs: Swith btrfs-find-root to use the find-root infrastructure Qu Wenruo
2015-01-19 6:45 ` [PATCH v2 08/10] btrfs-progs: Cleanup unneeded btrfs-find-root codes Qu Wenruo
2015-01-19 6:45 ` Qu Wenruo [this message]
2015-01-19 6:45 ` [PATCH v2 10/10] btrfs-progs: Allow open_ctree use backup tree root or search it automatically if primary tree root is corrupted Qu Wenruo
2015-07-27 15:04 ` David Sterba
2015-07-28 0:34 ` Qu Wenruo
2015-07-28 12:00 ` David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1421649912-14539-10-git-send-email-quwenruo@cn.fujitsu.com \
--to=quwenruo@cn.fujitsu.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).