summaryrefslogtreecommitdiff
path: root/btrfs-find-root.c
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2013-07-03 21:25:11 +0800
committerChris Mason <chris.mason@fusionio.com>2013-07-03 14:06:54 -0400
commitd25aa23b0236418e891e1db66562035891a8faa8 (patch)
tree74db86927c6cd437babc868c0c687052b8831916 /btrfs-find-root.c
parent0daa219ee1119e30059077da5be03c4506963fe2 (diff)
downloadbtrfs-progs-d25aa23b0236418e891e1db66562035891a8faa8.tar.gz
Btrfs-progs: Don't free the devices when close the ctree
Some commands(such as btrfs-convert) access the devices again after we close the ctree, so it is better that we don't free the devices objects when the ctree is closed, or we need re-allocate the memory for the devices. We needn't worry the memory leak problem, because all the memory will be freed after the taskes die. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'btrfs-find-root.c')
-rw-r--r--btrfs-find-root.c21
1 files changed, 1 insertions, 20 deletions
diff --git a/btrfs-find-root.c b/btrfs-find-root.c
index 3e1396d..da22c1d 100644
--- a/btrfs-find-root.c
+++ b/btrfs-find-root.c
@@ -65,25 +65,6 @@ int csum_block(void *buf, u32 len)
return ret;
}
-static int close_all_devices(struct btrfs_fs_info *fs_info)
-{
- struct list_head *list;
- struct list_head *next;
- struct btrfs_device *device;
-
- return 0;
-
- list = &fs_info->fs_devices->devices;
- list_for_each(next, list) {
- device = list_entry(next, struct btrfs_device, dev_list);
- if (device->fd != -1) {
- close(device->fd);
- device->fd = -1;
- }
- }
- return 0;
-}
-
static struct btrfs_root *open_ctree_broken(int fd, const char *device)
{
u32 sectorsize;
@@ -217,7 +198,7 @@ static struct btrfs_root *open_ctree_broken(int fd, const char *device)
out_chunk:
free_extent_buffer(fs_info->chunk_root->node);
out_devices:
- close_all_devices(fs_info);
+ btrfs_close_devices(fs_info->fs_devices);
out_cleanup:
extent_io_tree_cleanup(&fs_info->extent_cache);
extent_io_tree_cleanup(&fs_info->free_space_cache);