}
trans = btrfs_start_transaction(root, 1);
+ BUG_ON(IS_ERR(trans));
btrfs_set_super_flags(disk_super, super_flags);
ret = btrfs_commit_transaction(trans, root);
super_flags = btrfs_super_incompat_flags(disk_super);
super_flags |= flags;
trans = btrfs_start_transaction(root, 1);
+ BUG_ON(IS_ERR(trans));
btrfs_set_super_incompat_flags(disk_super, super_flags);
ret = btrfs_commit_transaction(trans, root);
goto next;
bytenr = key.objectid;
- eb = read_tree_block(fs_info, bytenr, fs_info->nodesize, 0);
+ eb = read_tree_block(fs_info, bytenr, 0);
if (IS_ERR(eb)) {
error("failed to read tree block: %llu", bytenr);
ret = PTR_ERR(eb);
return ret;
}
-static int change_device_uuid(struct btrfs_root *root, struct extent_buffer *eb,
+static int change_device_uuid(struct btrfs_fs_info *fs_info, struct extent_buffer *eb,
int slot)
{
- struct btrfs_fs_info *fs_info = root->fs_info;
struct btrfs_dev_item *di;
int ret = 0;
if (key.type != BTRFS_DEV_ITEM_KEY ||
key.objectid != BTRFS_DEV_ITEMS_OBJECTID)
goto next;
- ret = change_device_uuid(root, path.nodes[0], path.slots[0]);
+ ret = change_device_uuid(fs_info, path.nodes[0], path.slots[0]);
if (ret < 0)
goto out;
next:
btrfs_set_super_flags(fs_info->super_copy, flags);
memcpy(fs_info->super_copy->fsid, fs_info->new_fsid, BTRFS_FSID_SIZE);
- ret = write_all_supers(tree_root);
+ ret = write_all_supers(fs_info);
if (ret < 0)
return ret;
flags &= ~BTRFS_SUPER_FLAG_CHANGING_FSID;
btrfs_set_super_flags(fs_info->super_copy, flags);
- return write_all_supers(fs_info->tree_root);
+ return write_all_supers(fs_info);
}
/*
BTRFS_FSID_SIZE);
memcpy(fs_info->super_copy->fsid, fs_info->new_fsid,
BTRFS_FSID_SIZE);
- ret = write_all_supers(fs_info->tree_root);
+ ret = write_all_supers(fs_info);
if (ret < 0)
goto out;