projects
/
platform
/
upstream
/
btrfs-progs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Btrfs-progs: fix memory leaks on cleanup
[platform/upstream/btrfs-progs.git]
/
extent-tree.c
diff --git
a/extent-tree.c
b/extent-tree.c
index
85f5670
..
2d82977
100644
(file)
--- a/
extent-tree.c
+++ b/
extent-tree.c
@@
-1830,12
+1830,12
@@
static int update_block_group(struct btrfs_trans_handle *trans,
u64 end;
/* block accounting for super block */
u64 end;
/* block accounting for super block */
- old_val = btrfs_super_bytes_used(
&
info->super_copy);
+ old_val = btrfs_super_bytes_used(info->super_copy);
if (alloc)
old_val += num_bytes;
else
old_val -= num_bytes;
if (alloc)
old_val += num_bytes;
else
old_val -= num_bytes;
- btrfs_set_super_bytes_used(
&
info->super_copy, old_val);
+ btrfs_set_super_bytes_used(info->super_copy, old_val);
/* block accounting for root item */
old_val = btrfs_root_used(&root->root_item);
/* block accounting for root item */
old_val = btrfs_root_used(&root->root_item);
@@
-3003,10
+3003,12
@@
out:
int btrfs_free_block_groups(struct btrfs_fs_info *info)
{
int btrfs_free_block_groups(struct btrfs_fs_info *info)
{
+ struct btrfs_space_info *sinfo;
u64 start;
u64 end;
u64 ptr;
int ret;
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);
while(1) {
ret = find_first_extent_bit(&info->block_group_cache, 0,
&start, &end, (unsigned int)-1);
@@
-3026,6
+3028,13
@@
int btrfs_free_block_groups(struct btrfs_fs_info *info)
clear_extent_dirty(&info->free_space_cache, start,
end, GFP_NOFS);
}
clear_extent_dirty(&info->free_space_cache, start,
end, GFP_NOFS);
}
+
+ while (!list_empty(&info->space_info)) {
+ sinfo = list_entry(info->space_info.next,
+ struct btrfs_space_info, list);
+ list_del_init(&sinfo->list);
+ kfree(sinfo);
+ }
return 0;
}
return 0;
}
@@
-3216,7
+3225,7
@@
int btrfs_make_block_groups(struct btrfs_trans_handle *trans,
extent_root = root->fs_info->extent_root;
block_group_cache = &root->fs_info->block_group_cache;
chunk_objectid = BTRFS_FIRST_CHUNK_TREE_OBJECTID;
extent_root = root->fs_info->extent_root;
block_group_cache = &root->fs_info->block_group_cache;
chunk_objectid = BTRFS_FIRST_CHUNK_TREE_OBJECTID;
- total_bytes = btrfs_super_total_bytes(
&
root->fs_info->super_copy);
+ total_bytes = btrfs_super_total_bytes(root->fs_info->super_copy);
group_align = 64 * root->sectorsize;
cur_start = 0;
group_align = 64 * root->sectorsize;
cur_start = 0;
@@
-3451,7
+3460,7
@@
int btrfs_fix_block_accounting(struct btrfs_trans_handle *trans,
}
path.slots[0]++;
}
}
path.slots[0]++;
}
- btrfs_set_super_bytes_used(
&
root->fs_info->super_copy, bytes_used);
+ btrfs_set_super_bytes_used(root->fs_info->super_copy, bytes_used);
btrfs_release_path(root, &path);
return 0;
}
btrfs_release_path(root, &path);
return 0;
}