Skip to contentSkip to conversation

Btrfs: Free free_space item properly in btrfs_trim_block_group()

PATCH In review Li Zefan 3 participants 3 messages Apr 20, 2011 Btrfs file system

lore
Share & tools
lore

Li Zefan

author
#0 lore raw

PATCH 1/1 Btrfs: Free free_space item properly in btrfs_trim_block_group()

Since commit dc89e9824464e91fa0b06267864ceabe3186fd8b, we've changed to use a specific slab for alocation of free_space items.

---
 fs/btrfs/free-space-cache.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/btrfs/free-space-cache.c +1 -1
index 11d2e9c..13c29b1 100644
@@ -2301,7 +2301,7 @@ int btrfs_trim_block_group(struct btrfs_block_group_cache *block_group,
 			start = entry->offset;
 			bytes = min(entry->bytes, end - start);
 			unlink_free_space(block_group, entry);
-			kfree(entry);
+			kmem_cache_free(btrfs_free_space_cachep, entry);
 		}
 
 		spin_unlock(&block_group->tree_lock);

-- 1.7.3.1

#1 lore raw

Excerpts from Li Zefan's message of 2011-04-20 04:37:39 -0400:

Quoted 2 lines

Since commit dc89e9824464e91fa0b06267864ceabe3186fd8b, we've changed to use a specific slab for alocation of free_space items.

Oh, nice catch. Thanks!

-chris

#2 lore raw
In reply to Li Zefan

Hi,

reviewed, and made sure by the means of a coccinelle script that there are no other instances of any kmem_cache allocated data being kfreed.

dave

Quoted 26 lines · Li Zefan

Since commit dc89e9824464e91fa0b06267864ceabe3186fd8b, we've changed to use a specific slab for alocation of free_space items.

---
 fs/btrfs/free-space-cache.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/btrfs/free-space-cache.c +1 -3
index 11d2e9c..13c29b1 100644
@@ -2301,7 +2301,7 @@ int btrfs_trim_block_group(struct btrfs_block_group_cache *block_group,
 			start = entry->offset;
 			bytes = min(entry->bytes, end - start);
 			unlink_free_space(block_group, entry);
-			kfree(entry);
+			kmem_cache_free(btrfs_free_space_cachep, entry);
 		}
 
 		spin_unlock(&block_group->tree_lock);
-- 1.7.3.1 
--

To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html