aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorYan <yanzheng@21cn.com>2007-11-01 11:28:41 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:03:57 -0400
commitb97f9203b4d672c06eca50a1b1b99e4f69e1daf8 (patch)
treedcb39177e5e5b2456107a87566ee5fcb39abcffb /fs/btrfs/extent-tree.c
parent179e29e488cc74f1e9bd67bc45f70b832740e9ec (diff)
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,
588 old_val < (cache->key.offset >> 1)) { 588 old_val < (cache->key.offset >> 1)) {
589 int bit_to_clear; 589 int bit_to_clear;
590 int bit_to_set; 590 int bit_to_set;
591
592 cache->data = data; 591 cache->data = data;
593 if (data) { 592 if (data) {
594 bit_to_clear = BLOCK_GROUP_DATA; 593 bit_to_clear = BLOCK_GROUP_METADATA;
595 bit_to_set = BLOCK_GROUP_METADATA; 594 bit_to_set = BLOCK_GROUP_DATA;
596 cache->item.flags |= 595 cache->item.flags |=
597 BTRFS_BLOCK_GROUP_DATA; 596 BTRFS_BLOCK_GROUP_DATA;
598 } else { 597 } else {
599 bit_to_clear = BLOCK_GROUP_METADATA; 598 bit_to_clear = BLOCK_GROUP_DATA;
600 bit_to_set = BLOCK_GROUP_DATA; 599 bit_to_set = BLOCK_GROUP_METADATA;
601 cache->item.flags &= 600 cache->item.flags &=
602 ~BTRFS_BLOCK_GROUP_DATA; 601 ~BTRFS_BLOCK_GROUP_DATA;
603 } 602 }
@@ -1459,13 +1458,16 @@ int btrfs_free_block_groups(struct btrfs_fs_info *info)
1459{ 1458{
1460 u64 start; 1459 u64 start;
1461 u64 end; 1460 u64 end;
1461 u64 ptr;
1462 int ret; 1462 int ret;
1463
1464 while(1) { 1463 while(1) {
1465 ret = find_first_extent_bit(&info->block_group_cache, 0, 1464 ret = find_first_extent_bit(&info->block_group_cache, 0,
1466 &start, &end, (unsigned int)-1); 1465 &start, &end, (unsigned int)-1);
1467 if (ret) 1466 if (ret)
1468 break; 1467 break;
1468 ret = get_state_private(&info->block_group_cache, start, &ptr);
1469 if (!ret)
1470 kfree((void *)(unsigned long)ptr);
1469 clear_extent_bits(&info->block_group_cache, start, 1471 clear_extent_bits(&info->block_group_cache, start,
1470 end, (unsigned int)-1, GFP_NOFS); 1472 end, (unsigned int)-1, GFP_NOFS);
1471 } 1473 }