Commit 408fbf19 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: Remove extraneous chunk_objectid variable

BTRFS_FIRST_CHUNK_TREE_OBJECTIS id the only objectid being used in the
chunk_tree. So remove a variable which is always set to that value and collapse
its usage in callees which are passed this variable. No functional changes
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 0174484d
...@@ -2712,8 +2712,7 @@ int btrfs_grow_device(struct btrfs_trans_handle *trans, ...@@ -2712,8 +2712,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_fs_info *fs_info, u64 chunk_objectid, struct btrfs_fs_info *fs_info, u64 chunk_offset)
u64 chunk_offset)
{ {
struct btrfs_root *root = fs_info->chunk_root; struct btrfs_root *root = fs_info->chunk_root;
int ret; int ret;
...@@ -2724,7 +2723,7 @@ static int btrfs_free_chunk(struct btrfs_trans_handle *trans, ...@@ -2724,7 +2723,7 @@ static int btrfs_free_chunk(struct btrfs_trans_handle *trans,
if (!path) if (!path)
return -ENOMEM; return -ENOMEM;
key.objectid = chunk_objectid; key.objectid = BTRFS_FIRST_CHUNK_TREE_OBJECTID;
key.offset = chunk_offset; key.offset = chunk_offset;
key.type = BTRFS_CHUNK_ITEM_KEY; key.type = BTRFS_CHUNK_ITEM_KEY;
...@@ -2747,8 +2746,7 @@ static int btrfs_free_chunk(struct btrfs_trans_handle *trans, ...@@ -2747,8 +2746,7 @@ static int btrfs_free_chunk(struct btrfs_trans_handle *trans,
return ret; return ret;
} }
static int btrfs_del_sys_chunk(struct btrfs_fs_info *fs_info, static int btrfs_del_sys_chunk(struct btrfs_fs_info *fs_info, u64 chunk_offset)
u64 chunk_objectid, u64 chunk_offset)
{ {
struct btrfs_super_block *super_copy = fs_info->super_copy; struct btrfs_super_block *super_copy = fs_info->super_copy;
struct btrfs_disk_key *disk_key; struct btrfs_disk_key *disk_key;
...@@ -2781,7 +2779,7 @@ static int btrfs_del_sys_chunk(struct btrfs_fs_info *fs_info, ...@@ -2781,7 +2779,7 @@ static int btrfs_del_sys_chunk(struct btrfs_fs_info *fs_info,
ret = -EIO; ret = -EIO;
break; break;
} }
if (key.objectid == chunk_objectid && if (key.objectid == BTRFS_FIRST_CHUNK_TREE_OBJECTID &&
key.offset == chunk_offset) { key.offset == chunk_offset) {
memmove(ptr, ptr + len, array_size - (cur + len)); memmove(ptr, ptr + len, array_size - (cur + len));
array_size -= len; array_size -= len;
...@@ -2830,7 +2828,6 @@ int btrfs_remove_chunk(struct btrfs_trans_handle *trans, ...@@ -2830,7 +2828,6 @@ int btrfs_remove_chunk(struct btrfs_trans_handle *trans,
struct extent_map *em; struct extent_map *em;
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;
int i, ret = 0; int i, ret = 0;
struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
...@@ -2886,7 +2883,7 @@ int btrfs_remove_chunk(struct btrfs_trans_handle *trans, ...@@ -2886,7 +2883,7 @@ int btrfs_remove_chunk(struct btrfs_trans_handle *trans,
} }
mutex_unlock(&fs_devices->device_list_mutex); mutex_unlock(&fs_devices->device_list_mutex);
ret = btrfs_free_chunk(trans, fs_info, chunk_objectid, chunk_offset); ret = btrfs_free_chunk(trans, fs_info, chunk_offset);
if (ret) { if (ret) {
btrfs_abort_transaction(trans, ret); btrfs_abort_transaction(trans, ret);
goto out; goto out;
...@@ -2895,8 +2892,7 @@ int btrfs_remove_chunk(struct btrfs_trans_handle *trans, ...@@ -2895,8 +2892,7 @@ int btrfs_remove_chunk(struct btrfs_trans_handle *trans,
trace_btrfs_chunk_free(fs_info, map, chunk_offset, em->len); trace_btrfs_chunk_free(fs_info, map, chunk_offset, em->len);
if (map->type & BTRFS_BLOCK_GROUP_SYSTEM) { if (map->type & BTRFS_BLOCK_GROUP_SYSTEM) {
ret = btrfs_del_sys_chunk(fs_info, chunk_objectid, ret = btrfs_del_sys_chunk(fs_info, chunk_offset);
chunk_offset);
if (ret) { if (ret) {
btrfs_abort_transaction(trans, ret); btrfs_abort_transaction(trans, ret);
goto out; goto out;
......
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