Commit a688a04a authored by Zhao Lei's avatar Zhao Lei Committed by David Sterba

btrfs: remove unused chunk_tree argument in several functions

There functions include unused chunk_tree argument from the begining,
it is time to remove them and clean up relative code to prepare value
of this argument in caller.
Signed-off-by: default avatarZhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.cz>
parent b9fd47cd
...@@ -2487,8 +2487,7 @@ int btrfs_grow_device(struct btrfs_trans_handle *trans, ...@@ -2487,8 +2487,7 @@ int btrfs_grow_device(struct btrfs_trans_handle *trans,
} }
static int btrfs_free_chunk(struct btrfs_trans_handle *trans, static int btrfs_free_chunk(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root, u64 chunk_objectid,
u64 chunk_tree, u64 chunk_objectid,
u64 chunk_offset) u64 chunk_offset)
{ {
int ret; int ret;
...@@ -2580,7 +2579,6 @@ int btrfs_remove_chunk(struct btrfs_trans_handle *trans, ...@@ -2580,7 +2579,6 @@ int btrfs_remove_chunk(struct btrfs_trans_handle *trans,
struct map_lookup *map; struct map_lookup *map;
u64 dev_extent_len = 0; u64 dev_extent_len = 0;
u64 chunk_objectid = BTRFS_FIRST_CHUNK_TREE_OBJECTID; u64 chunk_objectid = BTRFS_FIRST_CHUNK_TREE_OBJECTID;
u64 chunk_tree = root->fs_info->chunk_root->objectid;
int i, ret = 0; int i, ret = 0;
/* Just in case */ /* Just in case */
...@@ -2634,8 +2632,7 @@ int btrfs_remove_chunk(struct btrfs_trans_handle *trans, ...@@ -2634,8 +2632,7 @@ int btrfs_remove_chunk(struct btrfs_trans_handle *trans,
} }
} }
} }
ret = btrfs_free_chunk(trans, root, chunk_tree, chunk_objectid, ret = btrfs_free_chunk(trans, root, chunk_objectid, chunk_offset);
chunk_offset);
if (ret) { if (ret) {
btrfs_abort_transaction(trans, root, ret); btrfs_abort_transaction(trans, root, ret);
goto out; goto out;
...@@ -2664,7 +2661,7 @@ int btrfs_remove_chunk(struct btrfs_trans_handle *trans, ...@@ -2664,7 +2661,7 @@ int btrfs_remove_chunk(struct btrfs_trans_handle *trans,
} }
static int btrfs_relocate_chunk(struct btrfs_root *root, static int btrfs_relocate_chunk(struct btrfs_root *root,
u64 chunk_tree, u64 chunk_objectid, u64 chunk_objectid,
u64 chunk_offset) u64 chunk_offset)
{ {
struct btrfs_root *extent_root; struct btrfs_root *extent_root;
...@@ -2707,7 +2704,6 @@ static int btrfs_relocate_sys_chunks(struct btrfs_root *root) ...@@ -2707,7 +2704,6 @@ static int btrfs_relocate_sys_chunks(struct btrfs_root *root)
struct btrfs_chunk *chunk; struct btrfs_chunk *chunk;
struct btrfs_key key; struct btrfs_key key;
struct btrfs_key found_key; struct btrfs_key found_key;
u64 chunk_tree = chunk_root->root_key.objectid;
u64 chunk_type; u64 chunk_type;
bool retried = false; bool retried = false;
int failed = 0; int failed = 0;
...@@ -2744,7 +2740,7 @@ static int btrfs_relocate_sys_chunks(struct btrfs_root *root) ...@@ -2744,7 +2740,7 @@ static int btrfs_relocate_sys_chunks(struct btrfs_root *root)
btrfs_release_path(path); btrfs_release_path(path);
if (chunk_type & BTRFS_BLOCK_GROUP_SYSTEM) { if (chunk_type & BTRFS_BLOCK_GROUP_SYSTEM) {
ret = btrfs_relocate_chunk(chunk_root, chunk_tree, ret = btrfs_relocate_chunk(chunk_root,
found_key.objectid, found_key.objectid,
found_key.offset); found_key.offset);
if (ret == -ENOSPC) if (ret == -ENOSPC)
...@@ -3255,7 +3251,6 @@ static int __btrfs_balance(struct btrfs_fs_info *fs_info) ...@@ -3255,7 +3251,6 @@ static int __btrfs_balance(struct btrfs_fs_info *fs_info)
} }
ret = btrfs_relocate_chunk(chunk_root, ret = btrfs_relocate_chunk(chunk_root,
chunk_root->root_key.objectid,
found_key.objectid, found_key.objectid,
found_key.offset); found_key.offset);
if (ret && ret != -ENOSPC) if (ret && ret != -ENOSPC)
...@@ -3957,7 +3952,6 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size) ...@@ -3957,7 +3952,6 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size)
struct btrfs_dev_extent *dev_extent = NULL; struct btrfs_dev_extent *dev_extent = NULL;
struct btrfs_path *path; struct btrfs_path *path;
u64 length; u64 length;
u64 chunk_tree;
u64 chunk_objectid; u64 chunk_objectid;
u64 chunk_offset; u64 chunk_offset;
int ret; int ret;
...@@ -4027,13 +4021,11 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size) ...@@ -4027,13 +4021,11 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size)
break; break;
} }
chunk_tree = btrfs_dev_extent_chunk_tree(l, dev_extent);
chunk_objectid = btrfs_dev_extent_chunk_objectid(l, dev_extent); chunk_objectid = btrfs_dev_extent_chunk_objectid(l, dev_extent);
chunk_offset = btrfs_dev_extent_chunk_offset(l, dev_extent); chunk_offset = btrfs_dev_extent_chunk_offset(l, dev_extent);
btrfs_release_path(path); btrfs_release_path(path);
ret = btrfs_relocate_chunk(root, chunk_tree, chunk_objectid, ret = btrfs_relocate_chunk(root, chunk_objectid, chunk_offset);
chunk_offset);
if (ret && ret != -ENOSPC) if (ret && ret != -ENOSPC)
goto done; goto done;
if (ret == -ENOSPC) if (ret == -ENOSPC)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment