Commit b8eeab7f authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: Consolidate retval checking of core btree functions

Core btree functions in btrfs generally return 0 when an item is found,
1 in case the sought item cannot be found and <0 when an error happens.
Consolidate the checks for those conditions in one 'if () {} else if ()
{}' construct rather than 2 separate 'if () {}' statements. This
emphasizes that the handling code pertains to a single function. No
functional changes.
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 694c12ed
...@@ -6795,9 +6795,7 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode, ...@@ -6795,9 +6795,7 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
if (ret < 0) { if (ret < 0) {
err = ret; err = ret;
goto out; goto out;
} } else if (ret > 0) {
if (ret != 0) {
if (path->slots[0] == 0) if (path->slots[0] == 0)
goto not_found; goto not_found;
path->slots[0]--; path->slots[0]--;
...@@ -6847,9 +6845,9 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode, ...@@ -6847,9 +6845,9 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
if (ret < 0) { if (ret < 0) {
err = ret; err = ret;
goto out; goto out;
} } else if (ret > 0) {
if (ret > 0)
goto not_found; goto not_found;
}
leaf = path->nodes[0]; leaf = path->nodes[0];
} }
btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
......
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