aboutsummaryrefslogtreecommitdiff
path: root/migration.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2012-12-19 10:40:48 +0100
committerJuan Quintela <quintela@redhat.com>2012-12-20 23:09:39 +0100
commit5b4e1eb769eee892b44d3f6b2369b05196442f59 (patch)
treefcce19b65a6ef7ab70bf00f6151d0e2031e1504c /migration.c
parent0d82d0e8b98cf0ea03a45f8542d835ebd3a84cd3 (diff)
downloadqemu-5b4e1eb769eee892b44d3f6b2369b05196442f59.zip
qemu-5b4e1eb769eee892b44d3f6b2369b05196442f59.tar.gz
qemu-5b4e1eb769eee892b44d3f6b2369b05196442f59.tar.bz2
migration: add XFER_LIMIT_RATIO
The "magic" divisions by 10 are there because of the value of BUFFER_DELAY. Introduce a constant to explain them better. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration.c')
-rw-r--r--migration.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/migration.c b/migration.c
index 2937c87..15f22ea 100644
--- a/migration.c
+++ b/migration.c
@@ -44,6 +44,11 @@ enum {
#define MAX_THROTTLE (32 << 20) /* Migration speed throttling */
+/* Amount of time to allocate to each "chunk" of bandwidth-throttled
+ * data. */
+#define BUFFER_DELAY 100
+#define XFER_LIMIT_RATIO (1000 / BUFFER_DELAY)
+
/* Migration XBZRLE default cache size */
#define DEFAULT_MIGRATE_CACHE_SIZE (64 * 1024 * 1024)
@@ -743,9 +748,6 @@ static int64_t buffered_get_rate_limit(void *opaque)
return s->xfer_limit;
}
-/* 100ms xfer_limit is the limit that we should write each 100ms */
-#define BUFFER_DELAY 100
-
static void *buffered_file_thread(void *opaque)
{
QEMUFileBuffered *s = opaque;
@@ -808,7 +810,7 @@ void qemu_fopen_ops_buffered(MigrationState *migration_state)
s = g_malloc0(sizeof(*s));
s->migration_state = migration_state;
- s->xfer_limit = migration_state->bandwidth_limit / 10;
+ s->xfer_limit = s->migration_state->bandwidth_limit / XFER_LIMIT_RATIO;
s->migration_state->complete = false;
s->file = qemu_fopen_ops(s, &buffered_file_ops);