[Btrfs-devel][PATCH]Fix type and memory leak in extent-tree.c
Yan Zheng
yanzheng at 21cn.com
Thu Nov 1 01:05:51 PDT 2007
Hello,
This patch fixes a type in update_block_group and memory leak in
btrfs_free_block_groups.
Regards
YZ
----
diff -r bc6bfcf7a158 extent-tree.c
--- a/extent-tree.c Tue Oct 30 16:56:53 2007 -0400
+++ b/extent-tree.c Thu Nov 01 16:04:48 2007 +0800
@@ -591,13 +591,13 @@ static int update_block_group(struct btr
cache->data = data;
if (data) {
- bit_to_clear = BLOCK_GROUP_DATA;
- bit_to_set = BLOCK_GROUP_METADATA;
+ bit_to_clear = BLOCK_GROUP_METADATA;
+ bit_to_set = BLOCK_GROUP_DATA;
cache->item.flags |=
BTRFS_BLOCK_GROUP_DATA;
} else {
- bit_to_clear = BLOCK_GROUP_METADATA;
- bit_to_set = BLOCK_GROUP_DATA;
+ bit_to_clear = BLOCK_GROUP_DATA;
+ bit_to_set = BLOCK_GROUP_METADATA;
cache->item.flags &=
~BTRFS_BLOCK_GROUP_DATA;
}
@@ -1459,6 +1459,7 @@ int btrfs_free_block_groups(struct btrfs
{
u64 start;
u64 end;
+ u64 ptr;
int ret;
while(1) {
@@ -1466,6 +1467,9 @@ int btrfs_free_block_groups(struct btrfs
&start, &end, (unsigned int)-1);
if (ret)
break;
+ ret = get_state_private(&info->block_group_cache, start, &ptr);
+ if (!ret)
+ kfree((void *)(unsigned long)ptr);
clear_extent_bits(&info->block_group_cache, start,
end, (unsigned int)-1, GFP_NOFS);
}
More information about the Btrfs-devel
mailing list