summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorYan <yanzheng@21cn.com>2007-11-01 16:28:41 +0100
committerChris Mason <chris.mason@oracle.com>2008-09-25 17:03:57 +0200
commitb97f9203b4d672c06eca50a1b1b99e4f69e1daf8 (patch)
treedcb39177e5e5b2456107a87566ee5fcb39abcffb /fs/btrfs/extent-tree.c
parentBtrfs: Fix a number of inline extent problems that Yan Zheng reported. (diff)
downloadlinux-b97f9203b4d672c06eca50a1b1b99e4f69e1daf8.tar.xz
linux-b97f9203b4d672c06eca50a1b1b99e4f69e1daf8.zip
Btrfs: Fix typo and memory leak in extent-tree.c
This patch fixes a typo in update_block_group and memory leak in btrfs_free_block_groups. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 7de7707d939c..e7192ea8f96c 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -588,16 +588,15 @@ static int update_block_group(struct btrfs_trans_handle *trans,
old_val < (cache->key.offset >> 1)) {
int bit_to_clear;
int bit_to_set;
-
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,13 +1458,16 @@ int btrfs_free_block_groups(struct btrfs_fs_info *info)
{
u64 start;
u64 end;
+ u64 ptr;
int ret;
-
while(1) {
ret = find_first_extent_bit(&info->block_group_cache, 0,
&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);
}