Received: from eggs.gnu.org ([2001:4830:134:3::10]:56608) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VORLK-00042B-It for qemu-devel@nongnu.org; Tue, 24 Sep 2013 08:03:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VORLE-0007fb-Cj for qemu-devel@nongnu.org; Tue, 24 Sep 2013 08:03:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24866) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VORLE-0007fS-4c for qemu-devel@nongnu.org; Tue, 24 Sep 2013 08:03:44 -0400 From: Juan Quintela Date: Tue, 24 Sep 2013 14:03:17 +0200 Message-Id: <1380024203-25897-4-git-send-email-quintela@redhat.com> In-Reply-To: <1380024203-25897-1-git-send-email-quintela@redhat.com> References: <1380024203-25897-1-git-send-email-quintela@redhat.com> Subject: [Qemu-devel] [PATCH 3/9] arch_init: right return for ram_save_iterate List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Lei Li , anthony@codemonkey.ws From: Lei Li qemu_file_rate_limit() never return negative value since the refactor by Commit 1964a39, this patch gets rid of the negative check for it, adjust bytes_transferred and return value correspondingly in ram_save_iterate(). Signed-off-by: Lei Li Signed-off-by: Paolo Bonzini Signed-off-by: Juan Quintela --- arch_init.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/arch_init.c b/arch_init.c index e47e139..18cd9a1 100644 --- a/arch_init.c +++ b/arch_init.c @@ -710,15 +710,20 @@ static int ram_save_iterate(QEMUFile *f, void *opaque) */ ram_control_after_iterate(f, RAM_CONTROL_ROUND); + bytes_transferred += total_sent; + + /* + * Do not count these 8 bytes into total_sent, so that we can + * return 0 if no page had been dirtied. + */ + qemu_put_be64(f, RAM_SAVE_FLAG_EOS); + bytes_transferred += 8; + + ret = qemu_file_get_error(f); if (ret < 0) { - bytes_transferred += total_sent; return ret; } - qemu_put_be64(f, RAM_SAVE_FLAG_EOS); - total_sent += 8; - bytes_transferred += total_sent; - return total_sent; } -- 1.8.3.1