[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 23/27] migration: remove unfreeze logic
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 23/27] migration: remove unfreeze logic |
Date: |
Tue, 24 Jul 2012 20:36:48 +0200 |
Now that we have a thread, and blocking writes, we don't need it.
Signed-off-by: Juan Quintela <address@hidden>
---
buffered_file.c | 19 +------------------
migration.c | 22 ----------------------
migration.h | 1 -
3 files changed, 1 insertion(+), 41 deletions(-)
diff --git a/buffered_file.c b/buffered_file.c
index 94830fa..b5e809c 100644
--- a/buffered_file.c
+++ b/buffered_file.c
@@ -26,7 +26,6 @@ typedef struct QEMUFileBuffered
{
MigrationState *migration_state;
QEMUFile *file;
- int freeze_output;
size_t bytes_xfer;
size_t xfer_limit;
uint8_t *buffer;
@@ -77,12 +76,6 @@ static void buffered_flush(QEMUFileBuffered *s)
ret = migrate_fd_put_buffer(s->migration_state, s->buffer + offset,
s->buffer_size - offset);
- if (ret == -EAGAIN) {
- DPRINTF("backend not ready, freezing\n");
- s->freeze_output = 1;
- break;
- }
-
if (ret <= 0) {
DPRINTF("error flushing data, %zd\n", ret);
qemu_file_set_error(s->file, ret);
@@ -112,9 +105,6 @@ static int buffered_put_buffer(void *opaque, const uint8_t
*buf, int64_t pos, in
return error;
}
- DPRINTF("unfreezing output\n");
- s->freeze_output = 0;
-
if (size > 0) {
DPRINTF("buffering %d bytes\n", size - offset);
buffered_append(s, buf, size);
@@ -124,7 +114,7 @@ static int buffered_put_buffer(void *opaque, const uint8_t
*buf, int64_t pos, in
if (pos == 0 && size == 0) {
DPRINTF("file is ready\n");
- if (!s->freeze_output && s->bytes_xfer < s->xfer_limit) {
+ if (s->bytes_xfer < s->xfer_limit) {
DPRINTF("notifying client\n");
migrate_fd_put_ready(s->migration_state);
}
@@ -143,8 +133,6 @@ static int buffered_close(void *opaque)
s->xfer_limit = INT_MAX;
while (!qemu_file_get_error(s->file) && s->buffer_size) {
buffered_flush(s);
- if (s->freeze_output)
- migrate_fd_wait_for_unfreeze(s->migration_state);
}
ret = migrate_fd_close(s->migration_state);
@@ -167,8 +155,6 @@ static int buffered_rate_limit(void *opaque)
if (ret) {
return ret;
}
- if (s->freeze_output)
- return 1;
if (s->bytes_xfer > s->xfer_limit)
return 1;
@@ -213,9 +199,6 @@ static void *buffered_file_thread(void *opaque)
if (s->migration_state->complete) {
break;
}
- if (s->freeze_output) {
- continue;
- }
if (current_time >= expire_time) {
s->bytes_xfer = 0;
expire_time = current_time + BUFFER_DELAY;
diff --git a/migration.c b/migration.c
index fe2afd0..da0f192 100644
--- a/migration.c
+++ b/migration.c
@@ -390,28 +390,6 @@ static void migrate_fd_cancel(MigrationState *s)
migrate_fd_cleanup(s);
}
-void migrate_fd_wait_for_unfreeze(MigrationState *s)
-{
- int ret;
-
- DPRINTF("wait for unfreeze\n");
- if (s->state != MIG_STATE_ACTIVE)
- return;
-
- do {
- fd_set wfds;
-
- FD_ZERO(&wfds);
- FD_SET(s->fd, &wfds);
-
- ret = select(s->fd + 1, NULL, &wfds, NULL, NULL);
- } while (ret == -1 && (s->get_error(s)) == EINTR);
-
- if (ret == -1) {
- qemu_file_set_error(s->file, -s->get_error(s));
- }
-}
-
int migrate_fd_close(MigrationState *s)
{
return s->close(s);
diff --git a/migration.h b/migration.h
index a05795b..7c7a261 100644
--- a/migration.h
+++ b/migration.h
@@ -79,7 +79,6 @@ void migrate_fd_connect(MigrationState *s);
ssize_t migrate_fd_put_buffer(MigrationState *s, const void *data,
size_t size);
void migrate_fd_put_ready(MigrationState *s);
-void migrate_fd_wait_for_unfreeze(MigrationState *s);
int migrate_fd_close(MigrationState *s);
void add_migration_state_change_notifier(Notifier *notify);
--
1.7.10.4
- [Qemu-devel] [PATCH 07/27] ram: Introduce migration_bitmap_test_and_reset_dirty(), (continued)
- [Qemu-devel] [PATCH 07/27] ram: Introduce migration_bitmap_test_and_reset_dirty(), Juan Quintela, 2012/07/24
- [Qemu-devel] [PATCH 11/27] BufferedFile: append, then flush, Juan Quintela, 2012/07/24
- [Qemu-devel] [PATCH 17/27] buffered_file: unfold migrate_fd_put_buffer, Juan Quintela, 2012/07/24
- [Qemu-devel] [PATCH 16/27] buffered_file: unfold migrate_fd_put_buffer, Juan Quintela, 2012/07/24
- [Qemu-devel] [PATCH 13/27] buffered_file: opaque is MigrationState, Juan Quintela, 2012/07/24
- [Qemu-devel] [PATCH 22/27] migration: make writes blocking, Juan Quintela, 2012/07/24
- [Qemu-devel] [PATCH 21/27] migration: stop all cpus correctly, Juan Quintela, 2012/07/24
- [Qemu-devel] [PATCH 20/27] migration: make qemu_fopen_ops_buffered() return void, Juan Quintela, 2012/07/24
- [Qemu-devel] [PATCH 19/27] buffered_file: Move from using a timer to use a thread, Juan Quintela, 2012/07/24
- [Qemu-devel] [PATCH 24/27] migration: take finer locking, Juan Quintela, 2012/07/24
- [Qemu-devel] [PATCH 23/27] migration: remove unfreeze logic,
Juan Quintela <=
- [Qemu-devel] [PATCH 14/27] buffered_file: unfold migrate_fd_put_buffer, Juan Quintela, 2012/07/24
- [Qemu-devel] [PATCH 18/27] buffered_file: We can access directly to bandwidth_limit, Juan Quintela, 2012/07/24
- [Qemu-devel] [PATCH 25/27] buffered_file: Unfold the trick to restart generating migration data, Juan Quintela, 2012/07/24
- [Qemu-devel] [PATCH 15/27] buffered_file: unfold migrate_fd_put_ready, Juan Quintela, 2012/07/24
- [Qemu-devel] [PATCH 27/27] buffered_file: unfold buffered_append in buffered_put_buffer, Juan Quintela, 2012/07/24
- [Qemu-devel] [PATCH 26/27] buffered_file: don't flush on put buffer, Juan Quintela, 2012/07/24
- Re: [Qemu-devel] [RFC 00/27] Migration thread (WIP), Orit Wasserman, 2012/07/25
- Re: [Qemu-devel] [RFC 00/27] Migration thread (WIP), Jan Kiszka, 2012/07/26