Move all the writes to the migration_thread, and make writings
blocking. Notice that are still using the iothread for everything
that we do.
Signed-off-by: Juan Quintela <quintela@redhat.com>
int64_t qemu_file_get_rate_limit(QEMUFile *f);
int qemu_file_get_error(QEMUFile *f);
int64_t qemu_file_get_rate_limit(QEMUFile *f);
int qemu_file_get_error(QEMUFile *f);
-/* Try to send any outstanding data. This function is useful when output is
- * halted due to rate limiting or EAGAIN errors occur as it can be used to
- * resume output. */
-int qemu_file_put_notify(QEMUFile *f);
-
static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv)
{
qemu_put_be64(f, *pv);
static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv)
{
qemu_put_be64(f, *pv);
s->fd = fileno(f);
assert(s->fd != -1);
s->fd = fileno(f);
assert(s->fd != -1);
- socket_set_nonblock(s->fd);
s->opaque = qemu_popen(f, "w");
s->opaque = qemu_popen(f, "w");
- fcntl(s->fd, F_SETFL, O_NONBLOCK);
s->get_error = fd_errno;
s->write = fd_write;
s->close = fd_close;
s->get_error = fd_errno;
s->write = fd_write;
s->close = fd_close;
} else {
DPRINTF("migrate connect success\n");
s->fd = fd;
} else {
DPRINTF("migrate connect success\n");
s->fd = fd;
+ socket_set_block(s->fd);
migrate_fd_connect(s);
}
}
migrate_fd_connect(s);
}
}
} else {
DPRINTF("migrate connect success\n");
s->fd = fd;
} else {
DPRINTF("migrate connect success\n");
s->fd = fd;
+ socket_set_block(s->fd);
migrate_fd_connect(s);
}
}
migrate_fd_connect(s);
}
}
notifier_list_notify(&migration_state_notifiers, s);
}
notifier_list_notify(&migration_state_notifiers, s);
}
-static void migrate_fd_put_notify(void *opaque)
-{
- MigrationState *s = opaque;
- int ret;
-
- qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
- ret = qemu_file_put_notify(s->file);
- if (ret) {
- migrate_fd_error(s);
- }
-}
-
ssize_t migrate_fd_put_buffer(MigrationState *s, const void *data,
size_t size)
{
ssize_t migrate_fd_put_buffer(MigrationState *s, const void *data,
size_t size)
{
if (ret == -1)
ret = -(s->get_error(s));
if (ret == -1)
ret = -(s->get_error(s));
- if (ret == -EAGAIN) {
- qemu_set_fd_handler2(s->fd, NULL, NULL, migrate_fd_put_notify, s);
- }
-
{
int rc = 0;
if (s->fd != -1) {
{
int rc = 0;
if (s->fd != -1) {
- qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
rc = s->close(s);
s->fd = -1;
}
rc = s->close(s);
s->fd = -1;
}
-int qemu_file_put_notify(QEMUFile *f)
-{
- return f->ops->put_buffer(f->opaque, NULL, 0, 0);
-}
-
void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size)
{
int l;
void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size)
{
int l;