]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
Btrfs: avoid allocation clusters that are too spread out
authorChris Mason <chris.mason@oracle.com>
Tue, 9 Jun 2009 22:35:15 +0000 (18:35 -0400)
committerChris Mason <chris.mason@oracle.com>
Wed, 10 Jun 2009 15:29:51 +0000 (11:29 -0400)
In SSD mode for data, and all the time for metadata the allocator
will try to find a cluster of nearby blocks for allocations.  This
commit adds extra checks to make sure that each free block in the
cluster is close to the last one.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/free-space-cache.c

index 280165581c57213bbf46fdf81cb2711142250060..ac23476beb6eac1e6c279cd269001bb67742f9a9 100644 (file)
@@ -645,7 +645,8 @@ again:
                 * we haven't filled the empty size and the window is
                 * very large.  reset and try again
                 */
-               if (next->offset - window_start > (bytes + empty_size) * 2) {
+               if (next->offset - (last->offset + last->bytes) > 128 * 1024 ||
+                   next->offset - window_start > (bytes + empty_size) * 2) {
                        entry = next;
                        window_start = entry->offset;
                        window_free = entry->bytes;