From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 14/34] migration: make writes blocking
Date: Wed, 19 Dec 2012 13:33:37 +0100 [thread overview]
Message-ID: <1355920437-29882-15-git-send-email-quintela@redhat.com> (raw)
In-Reply-To: <1355920437-29882-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 | 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 f449a22..0997a24 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 b8d16ad..77aef6d 100644
--- a/migration-fd.c
+++ b/migration-fd.c
@@ -76,7 +76,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 1683158..5808857 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 da00f2f..81a8176 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 90dbe8e..5aa3bca 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;
}
@@ -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;
}
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
next prev parent reply other threads:[~2012-12-19 12:34 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-19 12:33 [Qemu-devel] [PATCH 00/34] migration thread and queue Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 01/34] migration: fix migration_bitmap leak Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 02/34] buffered_file: do not send more than s->bytes_xfer bytes per tick Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 03/34] migration: remove double call to migrate_fd_close Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 04/34] migration: include qemu-file.h Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 05/34] migration-fd: remove duplicate include Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 06/34] exec: change ramlist from MRU order to a 1-item cache Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 07/34] exec: change RAM list to a TAILQ Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 08/34] exec: sort the memory from biggest to smallest Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 09/34] add a version number to ram_list Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 10/34] protect the ramlist with a separate mutex Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 11/34] buffered_file: Move from using a timer to use a thread Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 12/34] migration: make qemu_fopen_ops_buffered() return void Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 13/34] migration: move migration thread init code to migrate_fd_put_ready Juan Quintela
2012-12-19 12:33 ` Juan Quintela [this message]
2012-12-19 12:33 ` [Qemu-devel] [PATCH 15/34] migration: remove unfreeze logic Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 16/34] migration: just lock migrate_fd_put_ready Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 17/34] buffered_file: Unfold the trick to restart generating migration data Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 18/34] buffered_file: don't flush on put buffer Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 19/34] buffered_file: unfold buffered_append in buffered_put_buffer Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 20/34] savevm: New save live migration method: pending Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 21/34] migration: move buffered_file.c code into migration.c Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 22/34] migration: add XFER_LIMIT_RATIO Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 23/34] migration: move migration_fd_put_ready() Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 24/34] migration: Inline qemu_fopen_ops_buffered into migrate_fd_connect Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 25/34] migration: move migration notifier Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 26/34] ram: rename last_block to last_seen_block Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 27/34] ram: Add last_sent_block Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 28/34] memory: introduce memory_region_test_and_clear_dirty Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 29/34] ram: Use memory_region_test_and_clear_dirty Juan Quintela
2012-12-20 23:38 ` Eric Blake
2012-12-19 12:33 ` [Qemu-devel] [PATCH 30/34] ram: optimize migration bitmap walking Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 31/34] ram: account the amount of transferred ram better Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 32/34] ram: refactor ram_save_block() return value Juan Quintela
2012-12-20 23:42 ` Eric Blake
2012-12-19 12:33 ` [Qemu-devel] [PATCH 33/34] migration: fix qemu_get_fd for BufferedFile Juan Quintela
2012-12-19 12:33 ` [Qemu-devel] [PATCH 34/34] migration: merge QEMUFileBuffered into MigrationState Juan Quintela
2012-12-19 12:54 ` [Qemu-devel] [PATCH 00/34] migration thread and queue Paolo Bonzini
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=1355920437-29882-15-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).