if (path->nodes[level + 1])
parent = btrfs_buffer_node(path->nodes[level + 1]);
- parent_slot = path->slots[level + 1];
+
slot = path->slots[level];
BUG_ON(nritems == 0);
if (parent) {
struct btrfs_disk_key *parent_key;
+
+ parent_slot = path->slots[level + 1];
parent_key = &parent->ptrs[parent_slot].key;
BUG_ON(memcmp(parent_key, &node->ptrs[0].key,
sizeof(struct btrfs_disk_key)));
if (path->nodes[level + 1])
parent = btrfs_buffer_node(path->nodes[level + 1]);
- parent_slot = path->slots[level + 1];
+
BUG_ON(btrfs_leaf_free_space(root, leaf) < 0);
if (nritems == 0)
if (parent) {
struct btrfs_disk_key *parent_key;
+
+ parent_slot = path->slots[level + 1];
parent_key = &parent->ptrs[parent_slot].key;
BUG_ON(memcmp(parent_key, &leaf->items[0].key,
sizeof(struct btrfs_disk_key)));
if (btrfs_root_refs(ri) != 0)
goto next;
dead_root = btrfs_read_fs_root_no_radix(root->fs_info, &key);
- if (IS_ERR(root)) {
- ret = PTR_ERR(root);
+ if (IS_ERR(dead_root)) {
+ ret = PTR_ERR(dead_root);
goto err;
}
ret = btrfs_add_dead_root(dead_root,