[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 08/14] migration: move begining stage to the migrati
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 08/14] migration: move begining stage to the migration thread |
Date: |
Tue, 15 Jan 2013 12:18:16 +0100 |
Signed-off-by: Juan Quintela <address@hidden>
---
include/migration/migration.h | 1 -
migration.c | 28 +++++++++++++++-------------
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/include/migration/migration.h b/include/migration/migration.h
index 95261c1..a8c9639 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -54,7 +54,6 @@ struct MigrationState
bool enabled_capabilities[MIGRATION_CAPABILITY_MAX];
int64_t xbzrle_cache_size;
bool complete;
- bool first_time;
};
void process_incoming_migration(QEMUFile *f);
diff --git a/migration.c b/migration.c
index 380f3cb..7ae1d93 100644
--- a/migration.c
+++ b/migration.c
@@ -674,17 +674,6 @@ static bool migrate_fd_put_ready(MigrationState *s,
uint64_t max_size)
qemu_mutex_unlock_iothread();
return false;
}
- if (s->first_time) {
- s->first_time = false;
- DPRINTF("beginning savevm\n");
- ret = qemu_savevm_state_begin(s->file, &s->params);
- if (ret < 0) {
- DPRINTF("failed, %d\n", ret);
- migrate_fd_error(s);
- qemu_mutex_unlock_iothread();
- return false;
- }
- }
DPRINTF("iterate\n");
pending_size = qemu_savevm_state_pending(s->file, max_size);
@@ -733,6 +722,17 @@ static void *buffered_file_thread(void *opaque)
int64_t initial_time = qemu_get_clock_ms(rt_clock);
int64_t max_size = 0;
bool last_round = false;
+ int ret;
+
+ qemu_mutex_lock_iothread();
+ DPRINTF("beginning savevm\n");
+ ret = qemu_savevm_state_begin(s->file, &s->params);
+ if (ret < 0) {
+ DPRINTF("failed, %d\n", ret);
+ qemu_mutex_unlock_iothread();
+ goto out;
+ }
+ qemu_mutex_unlock_iothread();
while (true) {
int64_t current_time = qemu_get_clock_ms(rt_clock);
@@ -768,6 +768,10 @@ static void *buffered_file_thread(void *opaque)
}
}
+out:
+ if (ret < 0) {
+ migrate_fd_error(s);
+ }
g_free(s->buffer);
return NULL;
}
@@ -789,8 +793,6 @@ void migrate_fd_connect(MigrationState *s)
s->buffer_size = 0;
s->buffer_capacity = 0;
- s->first_time = true;
-
s->xfer_limit = s->bandwidth_limit / XFER_LIMIT_RATIO;
s->complete = false;
--
1.8.1
- [Qemu-devel] [PATCH 00/14] migration queue, Juan Quintela, 2013/01/15
- [Qemu-devel] [PATCH 01/14] Unlock ramlist lock also in error case, Juan Quintela, 2013/01/15
- [Qemu-devel] [PATCH 02/14] Protect migration_bitmap_sync() with the ramlist lock, Juan Quintela, 2013/01/15
- [Qemu-devel] [PATCH 03/14] use XFER_LIMIT_RATIO consistently, Juan Quintela, 2013/01/15
- [Qemu-devel] [PATCH 04/14] migration: make function static, Juan Quintela, 2013/01/15
- [Qemu-devel] [PATCH 05/14] migration: remove double call to migrate_fd_close, Juan Quintela, 2013/01/15
- [Qemu-devel] [PATCH 07/14] qemu-file: Only set last_error if it is not already set, Juan Quintela, 2013/01/15
- [Qemu-devel] [PATCH 06/14] migration: fix off-by-one in buffered_rate_limit, Juan Quintela, 2013/01/15
- [Qemu-devel] [PATCH 09/14] migration: Add buffered_flush error handling, Juan Quintela, 2013/01/15
- [Qemu-devel] [PATCH 08/14] migration: move begining stage to the migration thread,
Juan Quintela <=
- [Qemu-devel] [PATCH 10/14] migration: move exit condition to migration thread, Juan Quintela, 2013/01/15
- [Qemu-devel] [PATCH 12/14] migration: Only go to the iterate stage if there is anything to send, Juan Quintela, 2013/01/15
- [Qemu-devel] [PATCH 13/14] migration: remove argument to qemu_savevm_state_cancel, Juan Quintela, 2013/01/15
- [Qemu-devel] [PATCH 11/14] migration: unfold rest of migrate_fd_put_ready() into thread, Juan Quintela, 2013/01/15
- [Qemu-devel] [PATCH 14/14] Rename buffered_ to migration_, Juan Quintela, 2013/01/15
- Re: [Qemu-devel] [PATCH 00/14] migration queue, Eric Blake, 2013/01/15
- Re: [Qemu-devel] [PATCH 00/14] migration queue, Anthony Liguori, 2013/01/16