migration: fix xbzrle encoding rate calculation
PATCH 1/1 migration: fix xbzrle encoding rate calculation
It's reported an error of implicit conversion from "unsigned long" to "double" when compiling with Clang 10. Simply make the encoding rate 0 when the encoded_size is 0.
--- migration/ram.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
migration/ram.c +1 -3
@@ -913,10 +913,8 @@ static void migration_update_rates(RAMState *rs, int64_t end_time) unencoded_size = (xbzrle_counters.pages - rs->xbzrle_pages_prev) *TARGET_PAGE_SIZE ; encoded_size = xbzrle_counters.bytes - rs->xbzrle_bytes_prev; -if (xbzrle_counters.pages == rs->xbzrle_pages_prev) { +if (xbzrle_counters.pages == rs->xbzrle_pages_prev || !encoded_size) { xbzrle_counters.encoding_rate =0 ; - }else if (!encoded_size) { - xbzrle_counters.encoding_rate =UINT64_MAX ; }else { xbzrle_counters.encoding_rate = unencoded_size / encoded_size; }
Signature · 1 line
2.7.4
Quoted 10 lines · Wei Wang
It's reported an error of implicit conversion from "unsigned long" to "double" when compiling with Clang 10. Simply make the encoding rate 0 when the
encoded_sizeis 0.Fixes e460a4b1a4Reported-by Richard Henderson <[email protected]>Signed-off-by Wei Wang <[email protected]>--- migration/ram.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
r~
Quoted 10 lines · Wei Wang
It's reported an error of implicit conversion from "unsigned long" to "double" when compiling with Clang 10. Simply make the encoding rate 0 when the
encoded_sizeis 0.Fixes e460a4b1a4Reported-by Richard Henderson <[email protected]>Signed-off-by Wei Wang <[email protected]>--- migration/ram.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
Queuing to a clang 10 fixes branch.
r~
Dr. David Alan Gilbert
Reviewed-byQuoted 5 lines · * Richard Henderson ([email protected]) wrote:
Quoted 4 lines · Wei Wang
It's reported an error of implicit conversion from "unsigned long" to "double" when compiling with Clang 10. Simply make the encoding rate 0 when the
encoded_sizeis 0.
Quoted 8 lines
Quoted 6 lines
Fixes e460a4b1a4Reported-by Richard Henderson <[email protected]>Signed-off-by Wei Wang <[email protected]>--- migration/ram.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)Queuing to a clang 10 fixes branch.
Thanks
Dave
Quoted 4 lines
r~
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK