linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <josef@redhat.com>
To: Mathieu Chouquet-Stringer <mathieu@csetco.com>
Cc: dave@jikos.cz, linux-btrfs@vger.kernel.org
Subject: Re: Btrfs bug with g38867a2 and a question
Date: Thu, 22 Sep 2011 15:00:03 -0400	[thread overview]
Message-ID: <4E7B85B3.6080106@redhat.com> (raw)
In-Reply-To: <20110922182222.GA18449@kashmir>

On 09/22/2011 02:22 PM, Mathieu Chouquet-Stringer wrote:
> On Thu, Sep 22, 2011 at 10:12:12AM -0400, Josef Bacik wrote:
>> Well that is from the tree logging code, so give this a whirl.  It's
>> going to dump a lot of info so make sure you capture everything before
>> the --- cut here --- line.  Thanks,
> 
> Here's the output of this patch:
> 
> http://mathieu.csetco.com/btrfs/IMG_20110922_200713.jpg
> http://mathieu.csetco.com/btrfs/IMG_20110922_200817.jpg
> http://mathieu.csetco.com/btrfs/IMG_20110922_200829.jpg
> http://mathieu.csetco.com/btrfs/IMG_20110922_200841.jpg
> http://mathieu.csetco.com/btrfs/IMG_20110922_200849.jpg
> http://mathieu.csetco.com/btrfs/IMG_20110922_200900.jpg
> http://mathieu.csetco.com/btrfs/IMG_20110922_200909.jpg
> http://mathieu.csetco.com/btrfs/IMG_20110922_200922.jpg

Oh wow sorry I sent you the completely wrong patch, I wish I had caught
your reply earlier.  Can you run with this patch, which is the one I
meant to give you :).  Thanks,

Josef


diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 0a8ccdb..0739498 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -1319,6 +1319,7 @@ static noinline int remove_from_bitmap(struct
btrfs_free_space_ctl *ctl,
 	u64 search_start, search_bytes;
 	int ret;

+	BUG_ON(!bitmap_info->bitmap);
 again:
 	end = bitmap_info->offset + (u64)(BITS_PER_BITMAP * ctl->unit) - 1;

@@ -1336,7 +1337,21 @@ again:
 	search_bytes = *bytes;
 	search_bytes = min(search_bytes, end - search_start + 1);
 	ret = search_bitmap(ctl, bitmap_info, &search_start, &search_bytes);
-	BUG_ON(ret < 0 || search_start != *offset);
+	if (ret < 0 || search_start != *offset) {
+		struct rb_node *n;
+		struct btrfs_free_space *entry;
+
+		printk(KERN_CRIT "Couldn't find in bitmap offset=%Lu, "
+		       "bytes=%Lu, search=%Lu, search_bytes=%Lu, ret=%d\n",
+		       *offset, *bytes, search_start, search_bytes, ret);
+		for (n = rb_first(&ctl->free_space_offset); n; n = rb_next(n)) {
+			entry = rb_entry(n, struct btrfs_free_space, offset_index);
+			printk(KERN_CRIT "entry offset=%Lu, bytes=%Lu, bitmap=%s\n",
+			       entry->offset, entry->bytes,
+			       entry->bitmap ? "yes" : "no");
+		}
+		BUG();
+	}

 	if (*offset > bitmap_info->offset && *offset + *bytes > end) {
 		bitmap_clear_bits(ctl, bitmap_info, *offset, end - *offset + 1);

  reply	other threads:[~2011-09-22 19:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-21 18:53 Btrfs bug with g38867a2 and a question Mathieu Chouquet-Stringer
2011-09-21 20:18 ` Josef Bacik
2011-09-21 20:35   ` Mathieu Chouquet-Stringer
2011-09-21 23:10   ` David Sterba
2011-09-22 10:13     ` Mathieu Chouquet-Stringer
2011-09-22 11:05       ` David Sterba
2011-09-22 11:35         ` Mathieu Chouquet-Stringer
     [not found]     ` <CALiWzOg8CQJF7OfMex1uJTa+doDZ8oufV1nAbos99Z4ev-+xKg@mail.gmail.com>
2011-09-22 14:12       ` Josef Bacik
2011-09-22 15:16         ` Mathieu Chouquet-Stringer
2011-09-22 18:22         ` Mathieu Chouquet-Stringer
2011-09-22 19:00           ` Josef Bacik [this message]
2011-09-22 19:30             ` Mathieu Chouquet-Stringer
2011-09-22 20:32               ` Mathieu Chouquet-Stringer
2011-09-23 12:55                 ` Mathieu Chouquet-Stringer
2011-09-23 14:49                   ` Josef Bacik
2011-09-23 15:31                     ` Mathieu Chouquet-Stringer
2011-09-23 15:34                       ` Josef Bacik
2011-09-23 17:16                         ` Mathieu Chouquet-Stringer

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=4E7B85B3.6080106@redhat.com \
    --to=josef@redhat.com \
    --cc=dave@jikos.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=mathieu@csetco.com \
    /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).