From patchwork Thu Jan 8 17:34:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 426792 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 23B27140119 for ; Fri, 9 Jan 2015 05:13:28 +1100 (AEDT) Received: from localhost ([::1]:47470 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9HaH-0005wc-VQ for incoming@patchwork.ozlabs.org; Thu, 08 Jan 2015 13:13:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9H0X-00058R-Vd for qemu-devel@nongnu.org; Thu, 08 Jan 2015 12:36:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y9H06-0006xz-9I for qemu-devel@nongnu.org; Thu, 08 Jan 2015 12:36:29 -0500 Received: from e33.co.us.ibm.com ([32.97.110.151]:38348) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9H05-0006xf-VO for qemu-devel@nongnu.org; Thu, 08 Jan 2015 12:36:02 -0500 Received: from /spool/local by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Jan 2015 10:36:01 -0700 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Jan 2015 10:35:59 -0700 Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 0A3491FF001F; Thu, 8 Jan 2015 10:24:43 -0700 (MST) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t08HZxXI47513738; Thu, 8 Jan 2015 10:35:59 -0700 Received: from d03av01.boulder.ibm.com (localhost [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t08HZwjR030105; Thu, 8 Jan 2015 10:35:58 -0700 Received: from localhost (morrigu.austin.ibm.com [9.41.105.45]) by d03av01.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t08HZv7M030076; Thu, 8 Jan 2015 10:35:57 -0700 From: Michael Roth To: qemu-devel@nongnu.org Date: Thu, 8 Jan 2015 11:34:23 -0600 Message-Id: <1420738472-23267-80-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1420738472-23267-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1420738472-23267-1-git-send-email-mdroth@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15010817-0009-0000-0000-000007CEBDFB X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 32.97.110.151 Cc: qemu-stable@nongnu.org Subject: [Qemu-devel] [PATCH 79/88] block migration: fix return value X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Gary R Hook Modify block_save_iterate() to return positive/zero/negative (success/not done/failure) return status. The computation of the blocks transferred (an int64_t) exceeds the size of an int return value. Signed-off-by: Gary R Hook Reviewed-by: ChenLiang Reviewed-by: Stefan Hajnoczi Message-id: 1416958202-15913-1-git-send-email-gary.hook@nimboxx.com Signed-off-by: Stefan Hajnoczi (cherry picked from commit ebd9fbd7e102c533143c2c8372312b75c2b2678a) Signed-off-by: Michael Roth --- block-migration.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/block-migration.c b/block-migration.c index 73cdd07..2bb98d8 100644 --- a/block-migration.c +++ b/block-migration.c @@ -652,6 +652,7 @@ static int block_save_iterate(QEMUFile *f, void *opaque) { int ret; int64_t last_ftell = qemu_ftell(f); + int64_t delta_ftell; DPRINTF("Enter save live iterate submitted %d transferred %d\n", block_mig_state.submitted, block_mig_state.transferred); @@ -701,7 +702,14 @@ static int block_save_iterate(QEMUFile *f, void *opaque) } qemu_put_be64(f, BLK_MIG_FLAG_EOS); - return qemu_ftell(f) - last_ftell; + delta_ftell = qemu_ftell(f) - last_ftell; + if (delta_ftell > 0) { + return 1; + } else if (delta_ftell < 0) { + return -1; + } else { + return 0; + } } /* Called with iothread lock taken. */