From: Tsutomu Itoh Date: Thu, 13 Sep 2012 09:32:32 +0000 (-0600) Subject: Btrfs: cleanup of error processing in btree_get_extent() X-Git-Tag: next-20121002~89^2~40 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=9e7fb05216136cfe5cd0aaed85869756315e3f56;p=karo-tx-linux.git Btrfs: cleanup of error processing in btree_get_extent() This patch simplifies a little complex error processing in btree_get_extent(). Signed-off-by: Tsutomu Itoh --- diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 8054f7ccf46a..8db87bc53d27 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -222,21 +222,17 @@ static struct extent_map *btree_get_extent(struct inode *inode, free_extent_map(em); em = lookup_extent_mapping(em_tree, start, len); - if (em) { - ret = 0; - } else { - em = lookup_extent_mapping(em_tree, failed_start, - failed_len); - ret = -EIO; + if (!em) { + lookup_extent_mapping(em_tree, failed_start, + failed_len); + em = ERR_PTR(-EIO); } } else if (ret) { free_extent_map(em); - em = NULL; + em = ERR_PTR(ret); } write_unlock(&em_tree->lock); - if (ret) - em = ERR_PTR(ret); out: return em; }