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 <quint...@redhat.com> --- migration-exec.c | 1 - migration-fd.c | 1 - migration-tcp.c | 1 + migration-unix.c | 1 + migration.c | 17 ----------------- qemu-file.h | 5 ----- savevm.c | 5 ----- 7 files changed, 2 insertions(+), 29 deletions(-) diff --git a/migration-exec.c b/migration-exec.c index 2b6fcb4..df76606 100644 --- a/migration-exec.c +++ b/migration-exec.c @@ -70,7 +70,6 @@ void exec_start_outgoing_migration(MigrationState *s, const char *command, Error s->fd = fileno(f); assert(s->fd != -1); - socket_set_nonblock(s->fd); s->opaque = qemu_popen(f, "w"); diff --git a/migration-fd.c b/migration-fd.c index 5fe28e0..a161338 100644 --- a/migration-fd.c +++ b/migration-fd.c @@ -77,7 +77,6 @@ void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error ** return; } - fcntl(s->fd, F_SETFL, O_NONBLOCK); s->get_error = fd_errno; s->write = fd_write; s->close = fd_close; diff --git a/migration-tcp.c b/migration-tcp.c index 5e855fe..c0256ec 100644 --- a/migration-tcp.c +++ b/migration-tcp.c @@ -61,6 +61,7 @@ static void tcp_wait_for_connect(int fd, void *opaque) } else { DPRINTF("migrate connect success\n"); s->fd = fd; + socket_set_block(s->fd); migrate_fd_connect(s); } } diff --git a/migration-unix.c b/migration-unix.c index dba72b4..536cec8 100644 --- a/migration-unix.c +++ b/migration-unix.c @@ -61,6 +61,7 @@ static void unix_wait_for_connect(int fd, void *opaque) } else { DPRINTF("migrate connect success\n"); s->fd = fd; + socket_set_block(s->fd); migrate_fd_connect(s); } } diff --git a/migration.c b/migration.c index 9c34627..17ee872 100644 --- a/migration.c +++ b/migration.c @@ -297,18 +297,6 @@ static void migrate_fd_completed(MigrationState *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) { @@ -325,10 +313,6 @@ ssize_t migrate_fd_put_buffer(MigrationState *s, const void *data, if (ret == -1) ret = -(s->get_error(s)); - if (ret == -EAGAIN) { - qemu_set_fd_handler2(s->fd, NULL, NULL, migrate_fd_put_notify, s); - } - return ret; } @@ -426,7 +410,6 @@ int migrate_fd_close(MigrationState *s) { int rc = 0; if (s->fd != -1) { - qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL); rc = s->close(s); s->fd = -1; } diff --git a/qemu-file.h b/qemu-file.h index d64bdbb..68deefb 100644 --- a/qemu-file.h +++ b/qemu-file.h @@ -113,11 +113,6 @@ int64_t qemu_file_set_rate_limit(QEMUFile *f, int64_t new_rate); 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); diff --git a/savevm.c b/savevm.c index 5d04d59..c4ee899 100644 --- a/savevm.c +++ b/savevm.c @@ -556,11 +556,6 @@ int qemu_fclose(QEMUFile *f) return ret; } -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; -- 1.7.11.7