diff options
author | Josef Bacik <josef@redhat.com> | 2012-01-26 15:01:11 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2012-01-26 15:01:11 -0500 |
commit | 357b9784b79924a31ccded5d9a0c688f48cc28f2 (patch) | |
tree | ba47dcbcc40b956b30e4b27c790547cb5d3fc563 /fs | |
parent | b1375d64c539c5b76794be759b62d3f178e67c32 (diff) |
Btrfs: make sure a bitmap has enough bytes
We have only been checking for min_bytes available in bitmap entries, but we
won't successfully setup a bitmap cluster unless it has at least bytes in the
bitmap, so in the common case min_bytes is 4k and we want something like 2MB, so
if there are a bunch of bitmap entries with less than 2mb's in them, we'll
search all them anyway, which is suboptimal. Fix this check. Thanks,
Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/free-space-cache.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index efe20032e4a1..6e7406932341 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
@@ -2475,7 +2475,7 @@ setup_cluster_bitmap(struct btrfs_block_group_cache *block_group, | |||
2475 | } | 2475 | } |
2476 | 2476 | ||
2477 | list_for_each_entry(entry, bitmaps, list) { | 2477 | list_for_each_entry(entry, bitmaps, list) { |
2478 | if (entry->bytes < min_bytes) | 2478 | if (entry->bytes < bytes) |
2479 | continue; | 2479 | continue; |
2480 | ret = btrfs_bitmap_cluster(block_group, entry, cluster, offset, | 2480 | ret = btrfs_bitmap_cluster(block_group, entry, cluster, offset, |
2481 | bytes, cont1_bytes, min_bytes); | 2481 | bytes, cont1_bytes, min_bytes); |