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 /cmds-restore.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 'cmds-restore.c')
-rw-r--r-- | cmds-restore.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cmds-restore.c b/cmds-restore.c index dce6d7be..4a3f795a 100644 --- a/cmds-restore.c +++ b/cmds-restore.c @@ -196,7 +196,7 @@ again: reada_for_search(root, path, level, slot, 0); next = read_node_slot(root, c, slot); - if (next) + if (extent_buffer_uptodate(next)) break; offset++; } @@ -212,7 +212,7 @@ again: if (path->reada) reada_for_search(root, path, level, 0, 0); next = read_node_slot(root, next, 0); - if (!next) + if (!extent_buffer_uptodate(next)) goto again; } return 0; @@ -1263,7 +1263,7 @@ int cmd_restore(int argc, char **argv) if (fs_location != 0) { free_extent_buffer(root->node); root->node = read_tree_block(root, fs_location, root->leafsize, 0); - if (!root->node) { + if (!extent_buffer_uptodate(root->node)) { fprintf(stderr, "Failed to read fs location\n"); ret = 1; goto out; |