Btrfs: allocator tweaks
Signed-off-by: Chris Mason <chris.mason@oracle.com>
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 71e3b31..aca5802 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -311,7 +311,10 @@
clear_radix_bit(pinned_radix, gang[i]);
}
}
- root->fs_info->block_group_cache = NULL;
+ if (root->fs_info->block_group_cache) {
+ root->fs_info->block_group_cache->last_alloc =
+ root->fs_info->block_group_cache->first_free;
+ }
return 0;
}
@@ -578,7 +581,7 @@
if (last_block < search_start)
last_block = search_start;
hole_size = key.objectid - last_block;
- if (hole_size > num_blocks) {
+ if (hole_size >= num_blocks) {
ins->objectid = last_block;
ins->offset = hole_size;
goto check_pending;