linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@fusionio.com>
To: <linux-btrfs@vger.kernel.org>
Subject: [PATCH] Btrfs-progs: fix reference check for roots in btrfsck
Date: Wed, 5 Jun 2013 10:12:20 -0400	[thread overview]
Message-ID: <1370441540-2034-1-git-send-email-jbacik@fusionio.com> (raw)

I noticed that I was getting these errors on a bigger file system with more
snapshots that had been removed.  This check is bogus since we won't inc
rec->found_ref if we don't find a REF_KEY _and_ a DIR_ITEM, so we only have to
worry about there being no references to a root if it actually has a root item.
If it doesn't then it's just referenced by things that will go no where anyway.
With this patch fsck no longer incorrectly complains about this file system
image I have.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
---
 cmds-check.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/cmds-check.c b/cmds-check.c
index 4083298..68cdd52 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -1637,6 +1637,14 @@ static int check_root_refs(struct btrfs_root *root,
 						rec->objectid);
 			if (ret == 0)
 				continue;
+
+			/*
+			 * If we don't have a root item then we likely just have
+			 * a dir item in a snapshot for this root but no actual
+			 * ref key or anything so it's meaningless.
+			 */
+			if (!rec->found_root_item)
+				continue;
 			errors++;
 			fprintf(stderr, "fs tree %llu not referenced\n",
 				(unsigned long long)rec->objectid);
-- 
1.7.7.6


                 reply	other threads:[~2013-06-05 14:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1370441540-2034-1-git-send-email-jbacik@fusionio.com \
    --to=jbacik@fusionio.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).