struct btrfs_item *item;
struct btrfs_root_item *ri;
struct btrfs_key key;
+ struct btrfs_key found_key;
struct btrfs_path *path;
int ret;
u32 nritems;
path = btrfs_alloc_path();
if (!path)
return -ENOMEM;
+
+again:
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
if (ret < 0)
goto err;
if (btrfs_disk_root_refs(leaf, ri) != 0)
goto next;
- dead_root = btrfs_read_fs_root_no_radix(root->fs_info, &key);
+ memcpy(&found_key, &key, sizeof(key));
+ key.offset++;
+ btrfs_release_path(root, path);
+ dead_root = btrfs_read_fs_root_no_radix(root->fs_info,
+ &found_key);
if (IS_ERR(dead_root)) {
ret = PTR_ERR(dead_root);
goto err;
&root->fs_info->dead_roots);
if (ret)
goto err;
+ goto again;
next:
slot++;
path->slots[0]++;