diff mbox

[3/4] arch_init: calculate transferred bytes at ram_load().

Message ID 1275549747-18061-4-git-send-email-tamura.yoshiaki@lab.ntt.co.jp
State New
Headers show

Commit Message

Yoshiaki Tamura June 3, 2010, 7:22 a.m. UTC
Currently incoming side of migration doesn't know how many bytes are
transferred.  To print "info migrate" on incoming side, we need to
calculate transferred bytes at ram_load().

Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
---
 arch_init.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/arch_init.c b/arch_init.c
index 8e849a8..1bdfa58 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -246,7 +246,7 @@  int ram_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
 int ram_load(QEMUFile *f, void *opaque, int version_id)
 {
     ram_addr_t addr;
-    int flags;
+    int flags, bytes_sent;
 
     if (version_id != 3) {
         return -EINVAL;
@@ -274,12 +274,16 @@  int ram_load(QEMUFile *f, void *opaque, int version_id)
                         MADV_DONTNEED);
             }
 #endif
+            bytes_sent = 1;
         } else if (flags & RAM_SAVE_FLAG_PAGE) {
             qemu_get_buffer(f, qemu_get_ram_ptr(addr), TARGET_PAGE_SIZE);
+            bytes_sent = TARGET_PAGE_SIZE;
         }
         if (qemu_file_has_error(f)) {
             return -EIO;
         }
+
+        bytes_transferred += bytes_sent;
     } while (!(flags & RAM_SAVE_FLAG_EOS));
 
     return 0;