aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/free-space-cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/free-space-cache.c')
-rw-r--r--fs/btrfs/free-space-cache.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 11d2e9cea09e..63731a1fb0a1 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -1768,10 +1768,13 @@ void btrfs_remove_free_space_cache(struct btrfs_block_group_cache *block_group)
1768 1768
1769 while ((node = rb_last(&block_group->free_space_offset)) != NULL) { 1769 while ((node = rb_last(&block_group->free_space_offset)) != NULL) {
1770 info = rb_entry(node, struct btrfs_free_space, offset_index); 1770 info = rb_entry(node, struct btrfs_free_space, offset_index);
1771 unlink_free_space(block_group, info); 1771 if (!info->bitmap) {
1772 if (info->bitmap) 1772 unlink_free_space(block_group, info);
1773 kfree(info->bitmap); 1773 kmem_cache_free(btrfs_free_space_cachep, info);
1774 kmem_cache_free(btrfs_free_space_cachep, info); 1774 } else {
1775 free_bitmap(block_group, info);
1776 }
1777
1775 if (need_resched()) { 1778 if (need_resched()) {
1776 spin_unlock(&block_group->tree_lock); 1779 spin_unlock(&block_group->tree_lock);
1777 cond_resched(); 1780 cond_resched();
@@ -2301,7 +2304,7 @@ int btrfs_trim_block_group(struct btrfs_block_group_cache *block_group,
2301 start = entry->offset; 2304 start = entry->offset;
2302 bytes = min(entry->bytes, end - start); 2305 bytes = min(entry->bytes, end - start);
2303 unlink_free_space(block_group, entry); 2306 unlink_free_space(block_group, entry);
2304 kfree(entry); 2307 kmem_cache_free(btrfs_free_space_cachep, entry);
2305 } 2308 }
2306 2309
2307 spin_unlock(&block_group->tree_lock); 2310 spin_unlock(&block_group->tree_lock);