btrfs: Remove redundant extent_buffer_get in get_old_root
authorNikolay Borisov <nborisov@suse.com>
Wed, 15 Aug 2018 15:26:53 +0000 (18:26 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Sep 2020 17:03:10 +0000 (19:03 +0200)
commite23efd6da3a660168a053122b6e26917231bfcdf
tree3df35a3cd74592ef5a91853b1591f7ef1a1e1527
parent72de52916de69cce0b3f85198e656252ce236a81
btrfs: Remove redundant extent_buffer_get in get_old_root

[ Upstream commit 6c122e2a0c515cfb3f3a9cefb5dad4cb62109c78 ]

get_old_root used used only by btrfs_search_old_slot to initialise the
path structure. The old root is always a cloned buffer (either via alloc
dummy or via btrfs_clone_extent_buffer) and its reference count is 2: 1
from allocation, 1 from extent_buffer_get call in get_old_root.

This latter explicit ref count acquire operation is in fact unnecessary
since the semantic is such that the newly allocated buffer is handed
over to the btrfs_path for lifetime management. Considering this just
remove the extra extent_buffer_get in get_old_root.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/ctree.c