diff options
author | Liang Li <liang.z.li@intel.com> | 2015-03-23 16:32:27 +0800 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2015-05-07 18:31:53 +0200 |
commit | 43c60a81ba15ea040709be5809a279a4ca59b26b (patch) | |
tree | 5d25cdadd81a1fa4988ba9fcb40d6c21e95453c6 /migration | |
parent | dde4e694ae576462990b2ce711e62565e085c261 (diff) | |
download | qemu-43c60a81ba15ea040709be5809a279a4ca59b26b.zip |
migration: Use an array instead of 3 parameters
Put the three parameters related to multiple thread (de)compression
into an int array, and use an enum type to index the parameter.
Signed-off-by: Liang Li <liang.z.li@intel.com>
Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r-- | migration/migration.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/migration/migration.c b/migration/migration.c index dc7db8751d..533717c681 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -60,9 +60,12 @@ MigrationState *migrate_get_current(void) .bandwidth_limit = MAX_THROTTLE, .xbzrle_cache_size = DEFAULT_MIGRATE_CACHE_SIZE, .mbps = -1, - .compress_thread_count = DEFAULT_MIGRATE_COMPRESS_THREAD_COUNT, - .decompress_thread_count = DEFAULT_MIGRATE_DECOMPRESS_THREAD_COUNT, - .compress_level = DEFAULT_MIGRATE_COMPRESS_LEVEL, + .parameters[MIGRATION_PARAMETER_COMPRESS_LEVEL] = + DEFAULT_MIGRATE_COMPRESS_LEVEL, + .parameters[MIGRATION_PARAMETER_COMPRESS_THREADS] = + DEFAULT_MIGRATE_COMPRESS_THREAD_COUNT, + .parameters[MIGRATION_PARAMETER_DECOMPRESS_THREADS] = + DEFAULT_MIGRATE_DECOMPRESS_THREAD_COUNT, }; return ¤t_migration; @@ -406,9 +409,11 @@ static MigrationState *migrate_init(const MigrationParams *params) int64_t bandwidth_limit = s->bandwidth_limit; bool enabled_capabilities[MIGRATION_CAPABILITY_MAX]; int64_t xbzrle_cache_size = s->xbzrle_cache_size; - int compress_level = s->compress_level; - int compress_thread_count = s->compress_thread_count; - int decompress_thread_count = s->decompress_thread_count; + int compress_level = s->parameters[MIGRATION_PARAMETER_COMPRESS_LEVEL]; + int compress_thread_count = + s->parameters[MIGRATION_PARAMETER_COMPRESS_THREADS]; + int decompress_thread_count = + s->parameters[MIGRATION_PARAMETER_DECOMPRESS_THREADS]; memcpy(enabled_capabilities, s->enabled_capabilities, sizeof(enabled_capabilities)); @@ -419,9 +424,11 @@ static MigrationState *migrate_init(const MigrationParams *params) sizeof(enabled_capabilities)); s->xbzrle_cache_size = xbzrle_cache_size; - s->compress_level = compress_level; - s->compress_thread_count = compress_thread_count; - s->decompress_thread_count = decompress_thread_count; + s->parameters[MIGRATION_PARAMETER_COMPRESS_LEVEL] = compress_level; + s->parameters[MIGRATION_PARAMETER_COMPRESS_THREADS] = + compress_thread_count; + s->parameters[MIGRATION_PARAMETER_DECOMPRESS_THREADS] = + decompress_thread_count; s->bandwidth_limit = bandwidth_limit; s->state = MIGRATION_STATUS_SETUP; trace_migrate_set_state(MIGRATION_STATUS_SETUP); @@ -624,7 +631,7 @@ int migrate_compress_level(void) s = migrate_get_current(); - return s->compress_level; + return s->parameters[MIGRATION_PARAMETER_COMPRESS_LEVEL]; } int migrate_compress_threads(void) @@ -633,7 +640,7 @@ int migrate_compress_threads(void) s = migrate_get_current(); - return s->compress_thread_count; + return s->parameters[MIGRATION_PARAMETER_COMPRESS_THREADS]; } int migrate_decompress_threads(void) @@ -642,7 +649,7 @@ int migrate_decompress_threads(void) s = migrate_get_current(); - return s->decompress_thread_count; + return s->parameters[MIGRATION_PARAMETER_DECOMPRESS_THREADS]; } int migrate_use_xbzrle(void) |