}
/* Ok we can allocate now, reinit the extent root */
- ret = btrfs_fsck_reinit_root(trans, fs_info->extent_root, 1);
+ ret = btrfs_fsck_reinit_root(trans, fs_info->extent_root, 0);
if (ret) {
fprintf(stderr, "extent root initialization failed\n");
/*
if (!extent_buffer_uptodate(info->tree_root->node) ||
!extent_buffer_uptodate(info->dev_root->node) ||
- !extent_buffer_uptodate(info->extent_root->node) ||
!extent_buffer_uptodate(info->chunk_root->node)) {
fprintf(stderr, "Critical roots corrupted, unable to fsck the FS\n");
return -EIO;
}
root = info->fs_root;
-
if (init_extent_tree) {
printf("Creating a new extent tree\n");
ret = reinit_extent_tree(info);
if (ret)
return ret;
}
+ if (!extent_buffer_uptodate(info->extent_root->node)) {
+ fprintf(stderr, "Critical roots corrupted, unable to fsck the FS\n");
+ return -EIO;
+ }
+
fprintf(stderr, "checking extents\n");
if (init_csum_tree) {
struct btrfs_trans_handle *trans;
fs_info->extent_root);
if (ret) {
printk("Couldn't setup extent tree\n");
- return -EIO;
+ if (!(flags & OPEN_CTREE_PARTIAL))
+ return -EIO;
+ /* Need a blank node here just so we don't screw up in the
+ * million of places that assume a root has a valid ->node
+ */
+ fs_info->extent_root->node =
+ btrfs_find_create_tree_block(fs_info->extent_root, 0,
+ leafsize);
+ if (!fs_info->extent_root->node)
+ return -ENOMEM;
+ clear_extent_buffer_uptodate(NULL, fs_info->extent_root->node);
}
fs_info->extent_root->track_dirty = 1;