qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 07/14] migration: make writes blocking
Date: Fri, 21 Sep 2012 16:08:13 +0200	[thread overview]
Message-ID: <1348236500-2565-8-git-send-email-quintela@redhat.com> (raw)
In-Reply-To: <1348236500-2565-1-git-send-email-quintela@redhat.com>

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>
---
 migration-exec.c |  2 --
 migration-fd.c   |  6 ------
 migration-tcp.c  |  2 +-
 migration-unix.c |  2 --
 migration.c      | 19 -------------------
 qemu-file.h      |  5 -----
 savevm.c         |  5 -----
 7 files changed, 1 insertion(+), 40 deletions(-)

diff --git a/migration-exec.c b/migration-exec.c
index 6c97db9..908f22e 100644
--- a/migration-exec.c
+++ b/migration-exec.c
@@ -76,8 +76,6 @@ int exec_start_outgoing_migration(MigrationState *s, const char *command)
         goto err_after_open;
     }

-    socket_set_nonblock(s->fd);
-
     s->opaque = qemu_popen(f, "w");

     s->close = exec_close;
diff --git a/migration-fd.c b/migration-fd.c
index 50138ed..e5be972 100644
--- a/migration-fd.c
+++ b/migration-fd.c
@@ -81,11 +81,6 @@ int fd_start_outgoing_migration(MigrationState *s, const char *fdname)
         goto err_after_get_fd;
     }

-    if (fcntl(s->fd, F_SETFL, O_NONBLOCK) == -1) {
-        DPRINTF("Unable to set nonblocking mode on file descriptor\n");
-        goto err_after_open;
-    }
-
     s->get_error = fd_errno;
     s->write = fd_write;
     s->close = fd_close;
@@ -93,7 +88,6 @@ int fd_start_outgoing_migration(MigrationState *s, const char *fdname)
     migrate_fd_connect(s);
     return 0;

-err_after_open:
     close(s->fd);
 err_after_get_fd:
     return -1;
diff --git a/migration-tcp.c b/migration-tcp.c
index ac891c3..942f199 100644
--- a/migration-tcp.c
+++ b/migration-tcp.c
@@ -88,7 +88,7 @@ int tcp_start_outgoing_migration(MigrationState *s, const char *host_port,
     s->write = socket_write;
     s->close = tcp_close;

-    s->fd = inet_connect(host_port, false, &in_progress, errp);
+    s->fd = inet_connect(host_port, true, &in_progress, errp);
     if (error_is_set(errp)) {
         migrate_fd_error(s);
         return -1;
diff --git a/migration-unix.c b/migration-unix.c
index 169de88..bb41bac 100644
--- a/migration-unix.c
+++ b/migration-unix.c
@@ -96,8 +96,6 @@ int unix_start_outgoing_migration(MigrationState *s, const char *path)
         return -errno;
     }

-    socket_set_nonblock(s->fd);
-
     do {
         ret = connect(s->fd, (struct sockaddr *)&addr, sizeof(addr));
         if (ret == -1) {
diff --git a/migration.c b/migration.c
index ee0519e..a8b2f4a 100644
--- a/migration.c
+++ b/migration.c
@@ -247,8 +247,6 @@ static int migrate_fd_cleanup(MigrationState *s)
 {
     int ret = 0;

-    qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
-
     if (s->file) {
         DPRINTF("closing file\n");
         ret = qemu_fclose(s->file);
@@ -283,18 +281,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)
 {
@@ -311,10 +297,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;
 }

@@ -410,7 +392,6 @@ int migrate_fd_wait_for_unfreeze(MigrationState *s)

 int migrate_fd_close(MigrationState *s)
 {
-    qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
     return s->close(s);
 }

diff --git a/qemu-file.h b/qemu-file.h
index 9c8985b..e88892c 100644
--- a/qemu-file.h
+++ b/qemu-file.h
@@ -104,11 +104,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 2ea1fa6..ef44a78 100644
--- a/savevm.c
+++ b/savevm.c
@@ -523,11 +523,6 @@ int qemu_fclose(QEMUFile *f)
     return ret;
 }

-int qemu_file_put_notify(QEMUFile *f)
-{
-    return f->put_buffer(f->opaque, NULL, 0, 0);
-}
-
 void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size)
 {
     int l;
-- 
1.7.11.4

  parent reply	other threads:[~2012-09-21 14:08 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-21 14:08 [Qemu-devel] [RFC 00/14] Migration thread Juan Quintela
2012-09-21 14:08 ` [Qemu-devel] [PATCH 01/14] split MRU ram list Juan Quintela
2012-09-21 14:38   ` Paolo Bonzini
2012-09-21 14:08 ` [Qemu-devel] [PATCH 02/14] add a version number to ram_list Juan Quintela
2012-09-21 14:42   ` Paolo Bonzini
2012-09-21 14:08 ` [Qemu-devel] [PATCH 03/14] protect the ramlist with a separate mutex Juan Quintela
2012-09-21 14:44   ` Paolo Bonzini
2012-09-21 14:08 ` [Qemu-devel] [PATCH 04/14] buffered_file: Move from using a timer to use a thread Juan Quintela
2012-09-21 15:29   ` Paolo Bonzini
2012-09-21 14:08 ` [Qemu-devel] [PATCH 05/14] migration: make qemu_fopen_ops_buffered() return void Juan Quintela
2012-09-21 14:57   ` Paolo Bonzini
2012-09-21 14:08 ` [Qemu-devel] [PATCH 06/14] migration: stop all cpus correctly Juan Quintela
2012-09-21 15:20   ` Paolo Bonzini
2012-09-21 14:08 ` Juan Quintela [this message]
2012-09-21 15:31   ` [Qemu-devel] [PATCH 07/14] migration: make writes blocking Paolo Bonzini
2012-12-14 12:40     ` Juan Quintela
2012-09-21 14:08 ` [Qemu-devel] [PATCH 08/14] migration: remove unfreeze logic Juan Quintela
2012-09-21 14:58   ` Paolo Bonzini
2012-09-21 14:08 ` [Qemu-devel] [PATCH 09/14] migration: take finer locking Juan Quintela
2012-09-21 15:33   ` Paolo Bonzini
2012-12-14 12:44     ` Juan Quintela
2012-09-21 14:08 ` [Qemu-devel] [PATCH 10/14] buffered_file: Unfold the trick to restart generating migration data Juan Quintela
2012-09-21 15:00   ` Paolo Bonzini
2012-09-21 14:08 ` [Qemu-devel] [PATCH 11/14] buffered_file: don't flush on put buffer Juan Quintela
2012-09-21 15:34   ` Paolo Bonzini
2012-09-21 21:12     ` Eric Blake
2012-09-21 14:08 ` [Qemu-devel] [PATCH 12/14] buffered_file: unfold buffered_append in buffered_put_buffer Juan Quintela
2012-09-21 17:07   ` Paolo Bonzini
2012-09-21 14:08 ` [Qemu-devel] [PATCH 13/14] savevm: New save live migration method: pending Juan Quintela
2012-09-21 15:11   ` Paolo Bonzini
2012-09-21 14:08 ` [Qemu-devel] [PATCH 14/14] migration: print times for end phase Juan Quintela
2012-09-21 15:13   ` Paolo Bonzini
2012-09-21 15:27     ` Juan Quintela

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1348236500-2565-8-git-send-email-quintela@redhat.com \
    --to=quintela@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).