Sizes should use QAPI type 'size' (uint64_t). XBZRLECacheStats member @bytes is 'int' (int64_t). save_xbzrle_page() computes the byte count increment in size_t, implicitly converts it to int, then adds that to @bytes.
Change the XBZRLECacheStats member to 'size' and clean up save_xbzrle_page(). query-migrate now reports transferred sizes above 2^63-1 correctly instead of their (negative) two's complement. HMP's "info migrate" already reported them correctly, because it printed the signed integer with PRIu64. Signed-off-by: Markus Armbruster <arm...@redhat.com> --- migration/ram.c | 3 ++- qapi-schema.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index ce38be4..5c247f8 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -461,7 +461,8 @@ static int save_xbzrle_page(RAMState *rs, uint8_t **current_data, ram_addr_t current_addr, RAMBlock *block, ram_addr_t offset, bool last_stage) { - int encoded_len = 0, bytes_xbzrle; + int encoded_len; + size_t bytes_xbzrle; uint8_t *prev_cached_page; if (!cache_is_cached(XBZRLE.cache, current_addr, diff --git a/qapi-schema.json b/qapi-schema.json index ecabff6..4a3d07e 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -646,7 +646,7 @@ # Since: 1.2 ## { 'struct': 'XBZRLECacheStats', - 'data': {'cache-size': 'size', 'bytes': 'int', 'pages': 'int', + 'data': {'cache-size': 'size', 'bytes': 'size', 'pages': 'int', 'cache-miss': 'int', 'cache-miss-rate': 'number', 'overflow': 'int' } } -- 2.7.5