Btrfs: move get root out of btrfs_search_slot to a helper
authorLiu Bo <bo.liu@linux.alibaba.com>
Fri, 18 May 2018 03:00:21 +0000 (11:00 +0800)
committerDavid Sterba <dsterba@suse.com>
Wed, 30 May 2018 14:46:44 +0000 (16:46 +0200)
commit1fc28d8e2e9bf22044f1bacd17fe941cd0df5ba6
treefeda6b6a30825b0c9016f516267363b72a22bd5c
parente6a1d6fd276965db0ca91e91dffc0a6fb7d89254
Btrfs: move get root out of btrfs_search_slot to a helper

It's good to have a helper instead of having all get-root details
open-coded.  The new helper locks (if necessary) and sets root node of
the path.

Also invert the checks to make the code flow easier to read.  There is
no functional change in this commit.

Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.c