Skip to content

Commit b8eeab7

Browse files
lorddoskiaskdave
authored andcommitted
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: Qu Wenruo <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Nikolay Borisov <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 694c12e commit b8eeab7

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

fs/btrfs/inode.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6795,9 +6795,7 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
67956795
if (ret < 0) {
67966796
err = ret;
67976797
goto out;
6798-
}
6799-
6800-
if (ret != 0) {
6798+
} else if (ret > 0) {
68016799
if (path->slots[0] == 0)
68026800
goto not_found;
68036801
path->slots[0]--;
@@ -6847,9 +6845,9 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
68476845
if (ret < 0) {
68486846
err = ret;
68496847
goto out;
6850-
}
6851-
if (ret > 0)
6848+
} else if (ret > 0) {
68526849
goto not_found;
6850+
}
68536851
leaf = path->nodes[0];
68546852
}
68556853
btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);

0 commit comments

Comments
 (0)