[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/27] migration: Clean up signed vs. unsigned XBZRLE cache-size
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PULL 10/27] migration: Clean up signed vs. unsigned XBZRLE cache-size |
Date: |
Mon, 8 Feb 2021 11:29:01 +0000 |
From: Markus Armbruster <armbru@redhat.com>
73af8dd8d7 "migration: Make xbzrle_cache_size a migration
parameter" (v2.11.0) made the new parameter unsigned (QAPI type
'size', uint64_t in C). It neglected to update existing code, which
continues to use int64_t.
migrate_xbzrle_cache_size() returns the new parameter. Adjust its
return type.
QMP query-migrate-cache-size returns migrate_xbzrle_cache_size().
Adjust its return type.
migrate-set-parameters passes the new parameter to
xbzrle_cache_resize(). Adjust its parameter type.
xbzrle_cache_resize() passes it on to cache_init(). Adjust its
parameter type.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20210202141734.2488076-3-armbru@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/migration.c | 4 ++--
migration/migration.h | 2 +-
migration/page_cache.c | 2 +-
migration/page_cache.h | 2 +-
migration/ram.c | 2 +-
migration/ram.h | 2 +-
qapi/migration.json | 4 ++--
7 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index ecb4115d68..77b0c39b50 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2308,7 +2308,7 @@ void qmp_migrate_set_cache_size(int64_t value, Error
**errp)
qmp_migrate_set_parameters(&p, errp);
}
-int64_t qmp_query_migrate_cache_size(Error **errp)
+uint64_t qmp_query_migrate_cache_size(Error **errp)
{
return migrate_xbzrle_cache_size();
}
@@ -2538,7 +2538,7 @@ int migrate_use_xbzrle(void)
return s->enabled_capabilities[MIGRATION_CAPABILITY_XBZRLE];
}
-int64_t migrate_xbzrle_cache_size(void)
+uint64_t migrate_xbzrle_cache_size(void)
{
MigrationState *s;
diff --git a/migration/migration.h b/migration/migration.h
index 0723955cd7..db6708326b 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -327,7 +327,7 @@ int migrate_multifd_zlib_level(void);
int migrate_multifd_zstd_level(void);
int migrate_use_xbzrle(void);
-int64_t migrate_xbzrle_cache_size(void);
+uint64_t migrate_xbzrle_cache_size(void);
bool migrate_colo_enabled(void);
bool migrate_use_block(void);
diff --git a/migration/page_cache.c b/migration/page_cache.c
index 098b436223..b384f265fb 100644
--- a/migration/page_cache.c
+++ b/migration/page_cache.c
@@ -38,7 +38,7 @@ struct PageCache {
size_t num_items;
};
-PageCache *cache_init(int64_t new_size, size_t page_size, Error **errp)
+PageCache *cache_init(uint64_t new_size, size_t page_size, Error **errp)
{
int64_t i;
size_t num_pages = new_size / page_size;
diff --git a/migration/page_cache.h b/migration/page_cache.h
index 0cb94498a0..8733b4df6e 100644
--- a/migration/page_cache.h
+++ b/migration/page_cache.h
@@ -28,7 +28,7 @@ typedef struct PageCache PageCache;
* @page_size: cache page size
* @errp: set *errp if the check failed, with reason
*/
-PageCache *cache_init(int64_t cache_size, size_t page_size, Error **errp);
+PageCache *cache_init(uint64_t cache_size, size_t page_size, Error **errp);
/**
* cache_fini: free all cache resources
* @cache pointer to the PageCache struct
diff --git a/migration/ram.c b/migration/ram.c
index 26adb55aa9..46e9d4d145 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -131,7 +131,7 @@ static void XBZRLE_cache_unlock(void)
* @new_size: new cache size
* @errp: set *errp if the check failed, with reason
*/
-int xbzrle_cache_resize(int64_t new_size, Error **errp)
+int xbzrle_cache_resize(uint64_t new_size, Error **errp)
{
PageCache *new_cache;
int64_t ret = 0;
diff --git a/migration/ram.h b/migration/ram.h
index c25540cb93..6378bb3ebc 100644
--- a/migration/ram.h
+++ b/migration/ram.h
@@ -47,7 +47,7 @@ bool ramblock_is_ignored(RAMBlock *block);
INTERNAL_RAMBLOCK_FOREACH(block) \
if (!qemu_ram_is_migratable(block)) {} else
-int xbzrle_cache_resize(int64_t new_size, Error **errp);
+int xbzrle_cache_resize(uint64_t new_size, Error **errp);
uint64_t ram_bytes_remaining(void);
uint64_t ram_bytes_total(void);
diff --git a/qapi/migration.json b/qapi/migration.json
index 37026643ab..797f9edbc2 100644
--- a/qapi/migration.json
+++ b/qapi/migration.json
@@ -78,7 +78,7 @@
# Since: 1.2
##
{ 'struct': 'XBZRLECacheStats',
- 'data': {'cache-size': 'int', 'bytes': 'int', 'pages': 'int',
+ 'data': {'cache-size': 'size', 'bytes': 'int', 'pages': 'int',
'cache-miss': 'int', 'cache-miss-rate': 'number',
'encoding-rate': 'number', 'overflow': 'int' } }
@@ -1470,7 +1470,7 @@
# <- { "return": 67108864 }
#
##
-{ 'command': 'query-migrate-cache-size', 'returns': 'int',
+{ 'command': 'query-migrate-cache-size', 'returns': 'size',
'features': [ 'deprecated' ] }
##
--
2.29.2
- Re: [PULL 00/27] migration queue, (continued)
- Re: [PULL 00/27] migration queue, Peter Maydell, 2021/02/04
- [PULL 00/27] migration queue, Dr. David Alan Gilbert (git), 2021/02/08
- [PULL 01/27] spapr_pci: Fix memory leak of vmstate_spapr_pci, Dr. David Alan Gilbert (git), 2021/02/08
- [PULL 04/27] migration: introduce 'background-snapshot' migration capability, Dr. David Alan Gilbert (git), 2021/02/08
- [PULL 02/27] savevm: Fix memory leak of vmstate_configuration, Dr. David Alan Gilbert (git), 2021/02/08
- [PULL 06/27] migration: support UFFD write fault processing in ram_save_iterate(), Dr. David Alan Gilbert (git), 2021/02/08
- [PULL 03/27] migration/qemu-file: Fix maybe uninitialized on qemu_get_buffer_in_place(), Dr. David Alan Gilbert (git), 2021/02/08
- [PULL 05/27] migration: introduce UFFD-WP low-level interface helpers, Dr. David Alan Gilbert (git), 2021/02/08
- [PULL 10/27] migration: Clean up signed vs. unsigned XBZRLE cache-size,
Dr. David Alan Gilbert (git) <=
- [PULL 07/27] migration: implementation of background snapshot thread, Dr. David Alan Gilbert (git), 2021/02/08
- [PULL 11/27] migration: Fix cache_init()'s "Failed to allocate" error messages, Dr. David Alan Gilbert (git), 2021/02/08
- [PULL 09/27] migration: Fix migrate-set-parameters argument validation, Dr. David Alan Gilbert (git), 2021/02/08
- [PULL 08/27] migration: introduce 'userfaultfd-wrlat.py' script, Dr. David Alan Gilbert (git), 2021/02/08
- [PULL 12/27] migration: Fix a few absurdly defective error messages, Dr. David Alan Gilbert (git), 2021/02/08
- [PULL 13/27] migration: Add blocker information, Dr. David Alan Gilbert (git), 2021/02/08
- [PULL 17/27] migration: stop returning errno from load_snapshot(), Dr. David Alan Gilbert (git), 2021/02/08
- [PULL 14/27] migration: Display the migration blockers, Dr. David Alan Gilbert (git), 2021/02/08
- [PULL 20/27] block: rename and alter bdrv_all_find_snapshot semantics, Dr. David Alan Gilbert (git), 2021/02/08
- [PULL 16/27] migration: Make save_snapshot() return bool, not 0/-1, Dr. David Alan Gilbert (git), 2021/02/08