btrfs-progs: read_tree_block() and read_node_slot() cleanup.
[platform/upstream/btrfs-progs.git] / cmds-restore.c
index dce6d7b..4a3f795 100644 (file)
@@ -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;