diff options
author | Qu Wenruo <quwenruo@cn.fujitsu.com> | 2015-01-28 10:12:55 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2015-02-02 19:21:24 +0100 |
commit | ccdd0a067f36b689a0928074d53e5020f3ff5f5d (patch) | |
tree | f06f2dcf7788ab6a3b1e698c1c1b13e15d0b75b3 /extent_io.c | |
parent | 3e7524911214c4399f25ed2dabc0ad2956f7e90e (diff) | |
download | btrfs-progs-ccdd0a067f36b689a0928074d53e5020f3ff5f5d.tar.gz |
btrfs-progs: read_tree_block() and read_node_slot() cleanup.
Allow read_tree_block() and read_node_slot() to return error pointer.
This should help caller to get more specified error number.
For existing callers, change (!eb) judgmentt to
(!extent_buffer_uptodate(eb)) to keep the compatibility, and for caller
missing the check, use PTR_ERR(eb) if possible.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'extent_io.c')
-rw-r--r-- | extent_io.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/extent_io.c b/extent_io.c index cd0efdd..66aa214 100644 --- a/extent_io.c +++ b/extent_io.c @@ -575,7 +575,7 @@ struct extent_buffer *btrfs_clone_extent_buffer(struct extent_buffer *src) void free_extent_buffer(struct extent_buffer *eb) { - if (!eb) + if (!eb || IS_ERR(eb)) return; eb->refs--; @@ -843,9 +843,8 @@ int clear_extent_buffer_uptodate(struct extent_io_tree *tree, int extent_buffer_uptodate(struct extent_buffer *eb) { - if (!eb) + if (!eb || IS_ERR(eb)) return 0; - if (eb->flags & EXTENT_UPTODATE) return 1; return 0; |