diff options
author | Juan Quintela <quintela@redhat.com> | 2012-07-23 06:24:03 +0200 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2012-12-20 23:09:25 +0100 |
commit | 188a428559f0cd0bde884d28b42e449abd744c2f (patch) | |
tree | 40ffc738d7b85ed5f1d1617552d06b24f59dfd20 | |
parent | dd217b8732b93d97c22fa70dc15a72d92a2b2380 (diff) |
migration: remove unfreeze logic
Now that we have a thread, and blocking writes, we don't need it.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | buffered_file.c | 24 | ||||
-rw-r--r-- | include/migration/migration.h | 1 | ||||
-rw-r--r-- | migration.c | 23 |
3 files changed, 1 insertions, 47 deletions
diff --git a/buffered_file.c b/buffered_file.c index d61892b9e8..14e3a6fb73 100644 --- a/buffered_file.c +++ b/buffered_file.c @@ -25,7 +25,6 @@ typedef struct QEMUFileBuffered { MigrationState *migration_state; QEMUFile *file; - int freeze_output; size_t bytes_xfer; size_t xfer_limit; uint8_t *buffer; @@ -69,13 +68,6 @@ static ssize_t buffered_flush(QEMUFileBuffered *s) size_t to_send = MIN(s->buffer_size - offset, s->xfer_limit - s->bytes_xfer); ret = migrate_fd_put_buffer(s->migration_state, s->buffer + offset, to_send); - if (ret == -EAGAIN) { - DPRINTF("backend not ready, freezing\n"); - ret = 0; - s->freeze_output = 1; - break; - } - if (ret <= 0) { DPRINTF("error flushing data, %zd\n", ret); break; @@ -109,9 +101,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); @@ -125,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); } @@ -148,12 +137,6 @@ static int buffered_close(void *opaque) if (ret < 0) { break; } - if (s->freeze_output) { - ret = migrate_fd_wait_for_unfreeze(s->migration_state); - if (ret < 0) { - break; - } - } } ret2 = migrate_fd_close(s->migration_state); @@ -187,8 +170,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; @@ -233,9 +214,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/include/migration/migration.h b/include/migration/migration.h index 0ce3720112..92190f2afd 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -82,7 +82,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); -int migrate_fd_wait_for_unfreeze(MigrationState *s); int migrate_fd_close(MigrationState *s); void add_migration_state_change_notifier(Notifier *notify); diff --git a/migration.c b/migration.c index 207c754e52..032c9c254f 100644 --- a/migration.c +++ b/migration.c @@ -382,29 +382,6 @@ static void migrate_fd_cancel(MigrationState *s) migrate_fd_cleanup(s); } -int migrate_fd_wait_for_unfreeze(MigrationState *s) -{ - int ret; - - DPRINTF("wait for unfreeze\n"); - if (s->state != MIG_STATE_ACTIVE) - return -EINVAL; - - 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) { - return -s->get_error(s); - } - return 0; -} - int migrate_fd_close(MigrationState *s) { int rc = 0; |