From ccdd0a067f36b689a0928074d53e5020f3ff5f5d Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Wed, 28 Jan 2015 10:12:55 +0800 Subject: 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 Signed-off-by: David Sterba --- btrfs-image.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'btrfs-image.c') diff --git a/btrfs-image.c b/btrfs-image.c index 73dbfcdc..f6347f36 100644 --- a/btrfs-image.c +++ b/btrfs-image.c @@ -907,7 +907,7 @@ static int flush_pending(struct metadump_struct *md, int done) while (!md->data && size > 0) { u64 this_read = min(blocksize, size); eb = read_tree_block(md->root, start, this_read, 0); - if (!eb) { + if (!extent_buffer_uptodate(eb)) { free(async->buffer); free(async); fprintf(stderr, @@ -1036,7 +1036,7 @@ static int copy_tree_blocks(struct btrfs_root *root, struct extent_buffer *eb, ri = btrfs_item_ptr(eb, i, struct btrfs_root_item); bytenr = btrfs_disk_root_bytenr(eb, ri); tmp = read_tree_block(root, bytenr, root->leafsize, 0); - if (!tmp) { + if (!extent_buffer_uptodate(tmp)) { fprintf(stderr, "Error reading log root block\n"); return -EIO; @@ -1048,7 +1048,7 @@ static int copy_tree_blocks(struct btrfs_root *root, struct extent_buffer *eb, } else { bytenr = btrfs_node_blockptr(eb, i); tmp = read_tree_block(root, bytenr, root->leafsize, 0); - if (!tmp) { + if (!extent_buffer_uptodate(tmp)) { fprintf(stderr, "Error reading log block\n"); return -EIO; } -- cgit v1.2.3