Btrfs: clean up search_extent_mapping()
authorLi Zefan <lizf@cn.fujitsu.com>
Thu, 14 Jul 2011 03:18:03 +0000 (03:18 +0000)
committerChris Mason <chris.mason@oracle.com>
Mon, 1 Aug 2011 18:30:49 +0000 (14:30 -0400)
rb_node returned by __tree_search() can be a valid pointer or NULL,
but won't be some errno.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/extent_map.c

index 2d0410344ea3667a7d505b2c543e7ba212dd01ae..911a9db801e0a776a9a960180fb2b95f0ec14863 100644 (file)
@@ -379,23 +379,12 @@ struct extent_map *search_extent_mapping(struct extent_map_tree *tree,
                em = rb_entry(next, struct extent_map, rb_node);
                goto found;
        }
-       if (!rb_node) {
-               em = NULL;
-               goto out;
-       }
-       if (IS_ERR(rb_node)) {
-               em = ERR_CAST(rb_node);
-               goto out;
-       }
-       em = rb_entry(rb_node, struct extent_map, rb_node);
-       goto found;
-
-       em = NULL;
-       goto out;
+       if (!rb_node)
+               return NULL;
 
+       em = rb_entry(rb_node, struct extent_map, rb_node);
 found:
        atomic_inc(&em->refs);
-out:
        return em;
 }