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 /btrfs-debug-tree.c | |
parent | 3e7524911214c4399f25ed2dabc0ad2956f7e90e (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-debug-tree.c')
-rw-r--r-- | btrfs-debug-tree.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/btrfs-debug-tree.c b/btrfs-debug-tree.c index 10d02974..ce7a7920 100644 --- a/btrfs-debug-tree.c +++ b/btrfs-debug-tree.c @@ -67,6 +67,8 @@ static void print_extents(struct btrfs_root *root, struct extent_buffer *eb) btrfs_node_blockptr(eb, i), size, btrfs_node_ptr_generation(eb, i)); + if (!extent_buffer_uptodate(next)) + continue; if (btrfs_is_leaf(next) && btrfs_header_level(eb) != 1) BUG(); @@ -202,7 +204,8 @@ int main(int ac, char **av) block_only, root->leafsize, 0); - if (leaf && btrfs_header_level(leaf) != 0) { + if (extent_buffer_uptodate(leaf) && + btrfs_header_level(leaf) != 0) { free_extent_buffer(leaf); leaf = NULL; } @@ -212,7 +215,7 @@ int main(int ac, char **av) block_only, root->nodesize, 0); } - if (!leaf) { + if (!extent_buffer_uptodate(leaf)) { fprintf(stderr, "failed to read %llu\n", (unsigned long long)block_only); goto close_root; |