int compress_level, int sanitize, int walk_trees)
{
struct btrfs_root *root;
- struct btrfs_path *path = NULL;
+ struct btrfs_path path;
struct metadump_struct metadump;
int ret;
int err = 0;
goto out;
}
- path = btrfs_alloc_path();
- if (!path) {
- error("not enough memory to allocate path");
- err = -ENOMEM;
- goto out;
- }
+ btrfs_init_path(&path);
if (walk_trees) {
ret = copy_tree_blocks(root, root->fs_info->chunk_root->node,
goto out;
}
} else {
- ret = copy_from_extent_tree(&metadump, path);
+ ret = copy_from_extent_tree(&metadump, &path);
if (ret) {
err = ret;
goto out;
}
}
- ret = copy_log_trees(root, &metadump, path);
+ ret = copy_log_trees(root, &metadump, &path);
if (ret) {
err = ret;
goto out;
}
- ret = copy_space_cache(root, &metadump, path);
+ ret = copy_space_cache(root, &metadump, &path);
out:
ret = flush_pending(&metadump, 1);
if (ret) {
metadump_destroy(&metadump, num_threads);
- btrfs_free_path(path);
+ btrfs_release_path(&path);
ret = close_ctree(root);
return err ? err : ret;
}