All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@fb.com>
To: <dsterba@suse.cz>, <linux-btrfs@vger.kernel.org>
Subject: [PATCH 03/11] Btrfs-progs: allow fsck to take the tree bytenr
Date: Fri, 31 Oct 2014 14:01:21 -0400	[thread overview]
Message-ID: <1414778489-4049-4-git-send-email-jbacik@fb.com> (raw)
In-Reply-To: <1414778489-4049-1-git-send-email-jbacik@fb.com>

Sometimes we have a pretty corrupted fs but have an old tree bytenr that we
could use, add the ability to specify the tree root bytenr.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
---
 cmds-check.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/cmds-check.c b/cmds-check.c
index 2a5f823..38f8d11 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -7546,6 +7546,7 @@ static struct option long_options[] = {
 	{ "backup", 0, NULL, 0 },
 	{ "subvol-extents", no_argument, NULL, 'E' },
 	{ "qgroup-report", 0, NULL, 'Q' },
+	{ "tree-root", 1, NULL, 'r' },
 	{ NULL, 0, NULL, 0}
 };
 
@@ -7561,6 +7562,7 @@ const char * const cmd_check_usage[] = {
 	"--check-data-csum           verify checkums of data blocks",
 	"--qgroup-report             print a report on qgroup consistency",
 	"--subvol-extents            print subvolume extents and sharing state",
+	"--tree-root                 use the given bytenr for the tree root",
 	NULL
 };
 
@@ -7571,6 +7573,7 @@ int cmd_check(int argc, char **argv)
 	struct btrfs_fs_info *info;
 	u64 bytenr = 0;
 	u64 subvolid = 0;
+	u64 tree_root_bytenr = 0;
 	char uuidbuf[BTRFS_UUID_UNPARSED_SIZE];
 	int ret;
 	u64 num;
@@ -7581,7 +7584,7 @@ int cmd_check(int argc, char **argv)
 
 	while(1) {
 		int c;
-		c = getopt_long(argc, argv, "as:b", long_options,
+		c = getopt_long(argc, argv, "as:br:", long_options,
 				&option_index);
 		if (c < 0)
 			break;
@@ -7608,6 +7611,9 @@ int cmd_check(int argc, char **argv)
 			case 'E':
 				subvolid = arg_strtou64(optarg);
 				break;
+			case 'r':
+				tree_root_bytenr = arg_strtou64(optarg);
+				break;
 			case '?':
 			case 'h':
 				usage(cmd_check_usage);
@@ -7651,7 +7657,8 @@ int cmd_check(int argc, char **argv)
 	if (repair)
 		ctree_flags |= OPEN_CTREE_PARTIAL;
 
-	info = open_ctree_fs_info(argv[optind], bytenr, 0, ctree_flags);
+	info = open_ctree_fs_info(argv[optind], bytenr, tree_root_bytenr,
+				  ctree_flags);
 	if (!info) {
 		fprintf(stderr, "Couldn't open file system\n");
 		ret = -EIO;
-- 
1.8.3.1


  parent reply	other threads:[~2014-10-31 18:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-31 18:01 [GIT PULL] Various btrfsck updates Josef Bacik
2014-10-31 18:01 ` [PATCH 01/11] Btrfs-progs: add the ability to delete items Josef Bacik
2014-10-31 18:01 ` Josef Bacik [this message]
2014-11-04 21:58   ` [PATCH 03/11] Btrfs-progs: allow fsck to take the tree bytenr Ansgar Hockmann-Stolle
2014-10-31 18:01 ` [PATCH 04/11] Btrfs-progs: don't fail on log tree opening with PARTIAL Josef Bacik
2014-10-31 18:01 ` [PATCH 05/11] Btrfs-progs: spit out the broken file when ignoring errors Josef Bacik
2014-10-31 18:01 ` [PATCH 06/11] Btrfs-progs: make zero-log use partial open Josef Bacik
2014-10-31 18:01 ` [PATCH 07/11] Btrfs-progs: add a message to know zero log ran successfully Josef Bacik
2014-10-31 18:01 ` [PATCH 08/11] Btrfs-progs: add ability to replace missing dir item/dir indexes Josef Bacik
2014-10-31 18:01 ` [PATCH 09/11] Btrfs-progs: fix missing inode items Josef Bacik
2014-10-31 18:01 ` [PATCH 10/11] Btrfs-progs: create missing root dirid Josef Bacik

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=1414778489-4049-4-git-send-email-jbacik@fb.com \
    --to=jbacik@fb.com \
    --cc=dsterba@suse.cz \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.