Commit dc2ee4e2 authored by Zhaolei's avatar Zhaolei Committed by Chris Mason

btrfs: Cleanup: Remove chunk_objectid argument from btrfs_relocate_chunk()

Remove chunk_objectid argument from btrfs_relocate_chunk() because
it is not necessary, it can also cleanup some code in caller for
prepare its value.
Signed-off-by: default avatarZhao Lei <zhaolei@cn.fujitsu.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarChris Mason <clm@fb.com>
parent 4624900d
...@@ -2755,9 +2755,7 @@ int btrfs_remove_chunk(struct btrfs_trans_handle *trans, ...@@ -2755,9 +2755,7 @@ int btrfs_remove_chunk(struct btrfs_trans_handle *trans,
return ret; return ret;
} }
static int btrfs_relocate_chunk(struct btrfs_root *root, static int btrfs_relocate_chunk(struct btrfs_root *root, u64 chunk_offset)
u64 chunk_objectid,
u64 chunk_offset)
{ {
struct btrfs_root *extent_root; struct btrfs_root *extent_root;
struct btrfs_trans_handle *trans; struct btrfs_trans_handle *trans;
...@@ -2857,7 +2855,6 @@ static int btrfs_relocate_sys_chunks(struct btrfs_root *root) ...@@ -2857,7 +2855,6 @@ static int btrfs_relocate_sys_chunks(struct btrfs_root *root)
if (chunk_type & BTRFS_BLOCK_GROUP_SYSTEM) { if (chunk_type & BTRFS_BLOCK_GROUP_SYSTEM) {
ret = btrfs_relocate_chunk(chunk_root, ret = btrfs_relocate_chunk(chunk_root,
found_key.objectid,
found_key.offset); found_key.offset);
if (ret == -ENOSPC) if (ret == -ENOSPC)
failed++; failed++;
...@@ -3377,7 +3374,6 @@ static int __btrfs_balance(struct btrfs_fs_info *fs_info) ...@@ -3377,7 +3374,6 @@ static int __btrfs_balance(struct btrfs_fs_info *fs_info)
} }
ret = btrfs_relocate_chunk(chunk_root, ret = btrfs_relocate_chunk(chunk_root,
found_key.objectid,
found_key.offset); found_key.offset);
mutex_unlock(&fs_info->delete_unused_bgs_mutex); mutex_unlock(&fs_info->delete_unused_bgs_mutex);
if (ret && ret != -ENOSPC) if (ret && ret != -ENOSPC)
...@@ -4079,7 +4075,6 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size) ...@@ -4079,7 +4075,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_objectid;
u64 chunk_offset; u64 chunk_offset;
int ret; int ret;
int slot; int slot;
...@@ -4156,11 +4151,10 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size) ...@@ -4156,11 +4151,10 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size)
break; break;
} }
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_objectid, chunk_offset); ret = btrfs_relocate_chunk(root, chunk_offset);
mutex_unlock(&root->fs_info->delete_unused_bgs_mutex); mutex_unlock(&root->fs_info->delete_unused_bgs_mutex);
if (ret && ret != -ENOSPC) if (ret && ret != -ENOSPC)
goto done; goto done;
......
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