diff options
author | Nikolay Borisov <nborisov@suse.com> | 2018-12-17 10:49:00 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2019-02-25 14:13:22 +0100 |
commit | b8eeab7fced20169f5d8b4e3894e9e470fdf01ef (patch) | |
tree | 93f5a015c7e6f35aab373403e48881d039384d8d /fs/btrfs | |
parent | btrfs: Rename found_type to extent_type in btrfs_get_extent (diff) | |
download | linux-b8eeab7fced20169f5d8b4e3894e9e470fdf01ef.tar.xz linux-b8eeab7fced20169f5d8b4e3894e9e470fdf01ef.zip |
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 <wqu@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/inode.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 902577d5fc8c..c6fc283164b8 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -6795,9 +6795,7 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode, if (ret < 0) { err = ret; goto out; - } - - if (ret != 0) { + } else if (ret > 0) { if (path->slots[0] == 0) goto not_found; path->slots[0]--; @@ -6847,9 +6845,9 @@ next: if (ret < 0) { err = ret; goto out; - } - if (ret > 0) + } else if (ret > 0) { goto not_found; + } leaf = path->nodes[0]; } btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); |