]> git.proxmox.com Git - mirror_qemu.git/commitdiff
migration: make writes blocking
authorJuan Quintela <quintela@redhat.com>
Mon, 23 Jul 2012 04:15:02 +0000 (06:15 +0200)
committerJuan Quintela <quintela@redhat.com>
Thu, 20 Dec 2012 22:09:25 +0000 (23:09 +0100)
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>
include/migration/qemu-file.h
migration-exec.c
migration-fd.c
migration-tcp.c
migration-unix.c
migration.c
savevm.c

index d64bdbb19b63ca12b74949de878299573cca6df3..68deefbcfba08ed059d77af609b0a85e57f42f34 100644 (file)
@@ -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);
index b7b760b1d42316a6d48df1b70829bd64df11bea9..a051a6e668ead21b40bee1a5c649581d46f5fc8d 100644 (file)
@@ -69,7 +69,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");
 
index 5086a9038ae76075a55799a4cf800c046adce31b..a99e0e3971350bbe89929e477ae6810460fe266a 100644 (file)
@@ -75,7 +75,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;
index 1fca42843e42993c70add6541744f8e70ba2c605..e78a296137dde435a4a320f5225620cbb5ad9dac 100644 (file)
@@ -60,6 +60,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);
     }
 }
index f2f368c528078dc4745e27f29c6fef64301c6de2..218835a7a44ca8db3f5c53f00972ec620c15b3c7 100644 (file)
@@ -60,6 +60,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);
     }
 }
index 249eea389d563bcd6b79ba03daf69047638d32bc..207c754e52459dd86d26f93012ff39affe3cce37 100644 (file)
@@ -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;
 }
 
@@ -425,7 +409,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;
     }
index b2a844f2b1daacb7ed395dd58b2e22bf167194c6..c93d0b4fded74159a9fe62c5a32bd923cb367cac 100644 (file)
--- a/savevm.c
+++ b/savevm.c
@@ -555,11 +555,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;