qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] migration: Fix the minus value for compressed_size
@ 2022-10-10  9:34 Zhenzhong Duan
  2022-10-10 10:34 ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 3+ messages in thread
From: Zhenzhong Duan @ 2022-10-10  9:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: quintela, dgilbert

When update_compress_thread_counts() is called first time, there is
no data stream yet. We see compression_counters.compressed_size
becomes minus value shortly.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
 migration/ram.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/migration/ram.c b/migration/ram.c
index dc1de9ddbc68..510db95cdc36 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1443,6 +1443,10 @@ static bool do_compress_ram_page(QEMUFile *f, z_stream *stream, RAMBlock *block,
 static void
 update_compress_thread_counts(const CompressParam *param, int bytes_xmit)
 {
+    if (bytes_xmit <= 0) {
+        return;
+    }
+
     ram_transferred_add(bytes_xmit);
 
     if (param->zero_page) {
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-10 11:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-10  9:34 [PATCH] migration: Fix the minus value for compressed_size Zhenzhong Duan
2022-10-10 10:34 ` Dr. David Alan Gilbert
2022-10-10 10:58   ` Duan, Zhenzhong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).