public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@redhat.com>
To: linux-btrfs@vger.kernel.org
Cc: chris.mason@oracle.com
Subject: [PATCH] Btrfs: Fix cluster window start
Date: Mon, 2 Nov 2009 14:40:24 -0500	[thread overview]
Message-ID: <20091102194024.GA3382@localhost.localdomain> (raw)

We use cluster->window_start as a hint of where to find the block group for
our allocation.  The problem is we also use this offset as a minimum starting
offset when we look through our cluster for allocations.  So what happens is
we end up setting this offset to whatever the last entry we found was, so if
there happen to be multiple entries, every allocation after the first one once
we've refilled the cluster will fail, and we'll have to refill the cluster.
Fix this by setting cluster->window_start to window_start, which is the offset
of the _first_ entry we find in this cluster.

Signed-off-by: Josef Bacik <josef@redhat.com>
---
 fs/btrfs/free-space-cache.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index cb2849f..8f01904 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -1305,8 +1305,6 @@ again:
 		}
 	}
 
-	cluster->window_start = entry->offset;
-
 	/*
 	 * now we've found our entries, pull them out of the free space
 	 * cache and put them into the cluster rbtree
@@ -1336,6 +1334,7 @@ again:
 	}
 
 	cluster->max_size = max_extent;
+	cluster->window_start = window_start;
 got_it:
 	ret = 0;
 	atomic_inc(&block_group->count);
-- 
1.6.2.5


                 reply	other threads:[~2009-11-02 19:40 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=20091102194024.GA3382@localhost.localdomain \
    --to=josef@redhat.com \
    --cc=chris.mason@oracle.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