Commit 32cb0840 authored by Josef Bacik's avatar Josef Bacik

Btrfs: don't be as aggressive about using bitmaps

We have been creating bitmaps for small extents unconditionally forever.  This
was great when testing to make sure the bitmap stuff was working, but is
overkill normally.  So instead of always adding small chunks of free space to
bitmaps, only start doing it if we go past half of our extent threshold.  This
will keeps us from creating a bitmap for just one small free extent at the front
of the block group, and will make the allocator a little faster as a result.
Thanks,
Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
parent d0a365e8
...@@ -1287,9 +1287,22 @@ static int insert_into_bitmap(struct btrfs_block_group_cache *block_group, ...@@ -1287,9 +1287,22 @@ static int insert_into_bitmap(struct btrfs_block_group_cache *block_group,
* If we are below the extents threshold then we can add this as an * If we are below the extents threshold then we can add this as an
* extent, and don't have to deal with the bitmap * extent, and don't have to deal with the bitmap
*/ */
if (block_group->free_extents < block_group->extents_thresh && if (block_group->free_extents < block_group->extents_thresh) {
info->bytes > block_group->sectorsize * 4) /*
return 0; * If this block group has some small extents we don't want to
* use up all of our free slots in the cache with them, we want
* to reserve them to larger extents, however if we have plent
* of cache left then go ahead an dadd them, no sense in adding
* the overhead of a bitmap if we don't have to.
*/
if (info->bytes <= block_group->sectorsize * 4) {
if (block_group->free_extents * 2 <=
block_group->extents_thresh)
return 0;
} else {
return 0;
}
}
/* /*
* some block groups are so tiny they can't be enveloped by a bitmap, so * some block groups are so tiny they can't be enveloped by a bitmap, so
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment