Commit 0f5053eb authored by Goldwyn Rodrigues's avatar Goldwyn Rodrigues Committed by David Sterba

btrfs: parent_start initialization cleanup

Code cleanup. parent_start is initialized multiple times when it is
not necessary to do so.
Signed-off-by: default avatarGoldwyn Rodrigues <rgoldwyn@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 6cea66e5
...@@ -1100,7 +1100,7 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans, ...@@ -1100,7 +1100,7 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans,
int level, ret; int level, ret;
int last_ref = 0; int last_ref = 0;
int unlock_orig = 0; int unlock_orig = 0;
u64 parent_start; u64 parent_start = 0;
if (*cow_ret == buf) if (*cow_ret == buf)
unlock_orig = 1; unlock_orig = 1;
...@@ -1119,13 +1119,8 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans, ...@@ -1119,13 +1119,8 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans,
else else
btrfs_node_key(buf, &disk_key, 0); btrfs_node_key(buf, &disk_key, 0);
if (root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID) { if ((root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID) && parent)
if (parent) parent_start = parent->start;
parent_start = parent->start;
else
parent_start = 0;
} else
parent_start = 0;
cow = btrfs_alloc_tree_block(trans, root, parent_start, cow = btrfs_alloc_tree_block(trans, root, parent_start,
root->root_key.objectid, &disk_key, level, root->root_key.objectid, &disk_key, level,
...@@ -1168,8 +1163,6 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans, ...@@ -1168,8 +1163,6 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans,
if (root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID || if (root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID ||
btrfs_header_backref_rev(buf) < BTRFS_MIXED_BACKREF_REV) btrfs_header_backref_rev(buf) < BTRFS_MIXED_BACKREF_REV)
parent_start = buf->start; parent_start = buf->start;
else
parent_start = 0;
extent_buffer_get(cow); extent_buffer_get(cow);
tree_mod_log_set_root_pointer(root, cow, 1); tree_mod_log_set_root_pointer(root, cow, 1);
...@@ -1180,11 +1173,6 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans, ...@@ -1180,11 +1173,6 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans,
free_extent_buffer(buf); free_extent_buffer(buf);
add_root_to_dirty_list(root); add_root_to_dirty_list(root);
} else { } else {
if (root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID)
parent_start = parent->start;
else
parent_start = 0;
WARN_ON(trans->transid != btrfs_header_generation(parent)); WARN_ON(trans->transid != btrfs_header_generation(parent));
tree_mod_log_insert_key(root->fs_info, parent, parent_slot, tree_mod_log_insert_key(root->fs_info, parent, parent_slot,
MOD_LOG_KEY_REPLACE, GFP_NOFS); MOD_LOG_KEY_REPLACE, GFP_NOFS);
......
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