]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Btrfs: cleanup of error processing in btree_get_extent()
authorTsutomu Itoh <t-itoh@jp.fujitsu.com>
Thu, 13 Sep 2012 09:32:32 +0000 (03:32 -0600)
committerChris Mason <chris.mason@fusionio.com>
Mon, 1 Oct 2012 19:19:23 +0000 (15:19 -0400)
This patch simplifies a little complex error processing in
btree_get_extent().

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
fs/btrfs/disk-io.c

index 8054f7ccf46a49c371b5cf524acee513c16f6160..8db87bc53d2706dff39f60cb3b50847bc73be86c 100644 (file)
@@ -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;
 }