From: Orit Wasserman <owasserm@redhat.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, aliguori@us.ibm.com,
quintela@redhat.com, stefanha@gmail.com,
mdroth@linux.vnet.ibm.com, blauwirbel@gmail.com,
Orit Wasserman <owasserm@redhat.com>,
chegu_vinod@hp.com, avi@redhat.com, pbonzini@redhat.com,
eblake@redhat.com
Subject: [Qemu-devel] [PATCH v15 5/9] Change ram_save_block to return -1 if there are no more changes
Date: Thu, 5 Jul 2012 15:51:45 +0300 [thread overview]
Message-ID: <1341492709-13897-6-git-send-email-owasserm@redhat.com> (raw)
In-Reply-To: <1341492709-13897-1-git-send-email-owasserm@redhat.com>
It will return 0 if the page is unmodifed.
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
---
arch_init.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index 9fd6346..e36899e 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -188,7 +188,7 @@ static int ram_save_block(QEMUFile *f)
{
RAMBlock *block = last_block;
ram_addr_t offset = last_offset;
- int bytes_sent = 0;
+ int bytes_sent = -1;
MemoryRegion *mr;
if (!block)
@@ -349,8 +349,11 @@ int ram_save_live(QEMUFile *f, int stage, void *opaque)
int bytes_sent;
bytes_sent = ram_save_block(f);
- bytes_transferred += bytes_sent;
- if (bytes_sent == 0) { /* no more blocks */
+ /* bytes_sent 0 represent unchanged page,
+ bytes_sent -1 represent no more blocks*/
+ if (bytes_sent > 0) {
+ bytes_transferred += bytes_sent;
+ } else if (bytes_sent == -1) { /* no more blocks */
break;
}
/* we want to check in the 1st loop, just in case it was the 1st time
@@ -387,7 +390,7 @@ int ram_save_live(QEMUFile *f, int stage, void *opaque)
int bytes_sent;
/* flush all remaining blocks regardless of rate limiting */
- while ((bytes_sent = ram_save_block(f)) != 0) {
+ while ((bytes_sent = ram_save_block(f)) != -1) {
bytes_transferred += bytes_sent;
}
migration_end();
--
1.7.7.6
next prev parent reply other threads:[~2012-07-05 12:53 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-05 12:51 [Qemu-devel] [PATCH v15 0/9] XBZRLE delta for live migration of large memory app Orit Wasserman
2012-07-05 12:51 ` [Qemu-devel] [PATCH v15 1/9] Add migration capabilities Orit Wasserman
2012-07-05 12:51 ` [Qemu-devel] [PATCH v15 2/9] Add XBZRLE documentation Orit Wasserman
2012-07-05 13:24 ` Eric Blake
2012-07-05 17:22 ` Orit Wasserman
2012-07-05 12:51 ` [Qemu-devel] [PATCH v15 3/9] Add cache handling functions Orit Wasserman
2012-07-05 12:51 ` [Qemu-devel] [PATCH v15 4/9] Add uleb encoding/decoding functions Orit Wasserman
2012-07-05 12:51 ` Orit Wasserman [this message]
2012-07-05 12:51 ` [Qemu-devel] [PATCH v15 6/9] Add xbzrle_encode_buffer and xbzrle_decode_buffer functions Orit Wasserman
2012-07-05 13:55 ` Eric Blake
2012-07-05 18:01 ` Orit Wasserman
2012-07-05 12:51 ` [Qemu-devel] [PATCH v15 7/9] Add XBZRLE to ram_save_block and ram_save_live Orit Wasserman
2012-07-05 14:04 ` Eric Blake
2012-07-06 5:23 ` Orit Wasserman
2012-07-05 12:51 ` [Qemu-devel] [PATCH v15 8/9] Add set_cachesize command Orit Wasserman
2012-07-05 14:14 ` Eric Blake
2012-07-06 5:24 ` Orit Wasserman
2012-07-05 12:51 ` [Qemu-devel] [PATCH v15 9/9] Add XBZRLE statistics Orit Wasserman
2012-07-05 14:20 ` Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1341492709-13897-6-git-send-email-owasserm@redhat.com \
--to=owasserm@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=chegu_vinod@hp.com \
--cc=eblake@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).