On 2018/12/17 下午5:49, Nikolay Borisov wrote:
> 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 () {}' struct rather
> than 2 separate 'if () {}' statements. This emphasizes that the handling code
> pertains to a single function. No functional changes.
> 
> Signed-off-by: Nikolay Borisov <[email protected]>

Reviewed-by: Qu Wenruo <[email protected]>

Thanks,
Qu

> ---
> 
> V2: 
>  * Properly describe return value convention in changelog no other changes. 
> 
>  fs/btrfs/inode.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index fe25f66a98d9..511d3b314af2 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -6801,9 +6801,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]--;
> @@ -6853,8 +6851,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)
>                               goto not_found;
>                       leaf = path->nodes[0];
>               }
> 

Reply via email to