diff options
author | Chris Mason <chris.mason@oracle.com> | 2009-06-09 18:35:15 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-06-10 11:29:51 -0400 |
commit | c604480171c510c1beeb81b82418e5bc4de8f1ae (patch) | |
tree | 54be031aa42874f827e1c7d2aa79f1ec54b36a33 /fs/btrfs/free-space-cache.c | |
parent | 3b30c22f64a6bb297719c60e494af1d26563f584 (diff) |
Btrfs: avoid allocation clusters that are too spread out
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>
Diffstat (limited to 'fs/btrfs/free-space-cache.c')
-rw-r--r-- | fs/btrfs/free-space-cache.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 280165581c57..ac23476beb6e 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
@@ -645,7 +645,8 @@ again: | |||
645 | * we haven't filled the empty size and the window is | 645 | * we haven't filled the empty size and the window is |
646 | * very large. reset and try again | 646 | * very large. reset and try again |
647 | */ | 647 | */ |
648 | if (next->offset - window_start > (bytes + empty_size) * 2) { | 648 | if (next->offset - (last->offset + last->bytes) > 128 * 1024 || |
649 | next->offset - window_start > (bytes + empty_size) * 2) { | ||
649 | entry = next; | 650 | entry = next; |
650 | window_start = entry->offset; | 651 | window_start = entry->offset; |
651 | window_free = entry->bytes; | 652 | window_free = entry->bytes; |