summaryrefslogtreecommitdiff
path: root/btrfs-corrupt-block.c
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2015-01-28 10:12:55 +0800
committerDavid Sterba <dsterba@suse.cz>2015-02-02 19:21:24 +0100
commitccdd0a067f36b689a0928074d53e5020f3ff5f5d (patch)
treef06f2dcf7788ab6a3b1e698c1c1b13e15d0b75b3 /btrfs-corrupt-block.c
parent3e7524911214c4399f25ed2dabc0ad2956f7e90e (diff)
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 'btrfs-corrupt-block.c')
-rw-r--r--btrfs-corrupt-block.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/btrfs-corrupt-block.c b/btrfs-corrupt-block.c
index 29ddeb9a..5db18a18 100644
--- a/btrfs-corrupt-block.c
+++ b/btrfs-corrupt-block.c
@@ -157,7 +157,7 @@ static int corrupt_keys_in_block(struct btrfs_root *root, u64 bytenr)
struct extent_buffer *eb;
eb = read_tree_block(root, bytenr, root->leafsize, 0);
- if (!eb)
+ if (!extent_buffer_uptodate(eb))
return -EIO;;
corrupt_keys(NULL, root, eb);
@@ -285,7 +285,7 @@ static void btrfs_corrupt_extent_tree(struct btrfs_trans_handle *trans,
next = read_tree_block(root, btrfs_node_blockptr(eb, i),
root->leafsize,
btrfs_node_ptr_generation(eb, i));
- if (!next)
+ if (!extent_buffer_uptodate(next))
continue;
btrfs_corrupt_extent_tree(trans, root, next);
free_extent_buffer(next);
@@ -693,7 +693,7 @@ static int corrupt_metadata_block(struct btrfs_root *root, u64 block,
}
eb = read_tree_block(root, block, root->leafsize, 0);
- if (!eb) {
+ if (!extent_buffer_uptodate(eb)) {
fprintf(stderr, "Couldn't read in tree block %s\n", field);
return -EINVAL;
}