return ERR_PTR(ret);
}
-static int do_send(struct btrfs_send *send, u64 root_id, u64 parent_root_id,
- int is_first_subvol, int is_last_subvol)
+static int do_send(struct btrfs_send *send, u64 parent_root_id,
+ int is_first_subvol, int is_last_subvol, char *subvol)
{
int ret;
pthread_t t_read;
pthread_attr_t t_attr;
struct btrfs_ioctl_send_args io_send;
- struct subvol_info *si;
void *t_err = NULL;
int subvol_fd = -1;
int pipefd[2] = {-1, -1};
- si = subvol_uuid_search(&send->sus, root_id, NULL, 0, NULL,
- subvol_search_by_root_id);
- if (!si) {
- ret = -ENOENT;
- fprintf(stderr, "ERROR: could not find subvol info for %llu",
- root_id);
- goto out;
- }
-
- subvol_fd = openat(send->mnt_fd, si->path, O_RDONLY | O_NOATIME);
+ subvol_fd = openat(send->mnt_fd, subvol, O_RDONLY | O_NOATIME);
if (subvol_fd < 0) {
ret = -errno;
- fprintf(stderr, "ERROR: open %s failed. %s\n", si->path,
+ fprintf(stderr, "ERROR: open %s failed. %s\n", subvol,
strerror(-ret));
goto out;
}
close(pipefd[0]);
if (pipefd[1] != -1)
close(pipefd[1]);
- if (si) {
- free(si->path);
- free(si);
- }
return ret;
}
goto out;
}
- ret = get_root_id(&send, get_subvol_name(send.root_path, subvol),
- &root_id);
- if (ret < 0) {
- fprintf(stderr, "ERROR: could not resolve root_id "
- "for %s\n", subvol);
- goto out;
- }
-
if (!full_send && !parent_root_id) {
ret = find_good_parent(&send, root_id, &parent_root_id);
if (ret < 0) {
is_first_subvol = 1;
is_last_subvol = 1;
}
- ret = do_send(&send, root_id, parent_root_id,
- is_first_subvol, is_last_subvol);
+ ret = do_send(&send, parent_root_id, is_first_subvol,
+ is_last_subvol, subvol);
if (ret < 0)
goto out;