Skip to content

Commit

Permalink
Btrfs: clean up search_extent_mapping()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Li Zefan authored and Chris Mason committed Aug 1, 2011
1 parent 85d85a7 commit 7e016a0
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions fs/btrfs/extent_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 7e016a0

Please sign in to comment.