From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47362) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XtRqM-0005as-9p for qemu-devel@nongnu.org; Tue, 25 Nov 2014 20:56:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XtRqH-0007J8-J4 for qemu-devel@nongnu.org; Tue, 25 Nov 2014 20:56:34 -0500 Received: from szxga01-in.huawei.com ([119.145.14.64]:5299) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XtRqG-0007Hr-VU for qemu-devel@nongnu.org; Tue, 25 Nov 2014 20:56:29 -0500 Message-ID: <5475332B.8090206@huawei.com> Date: Wed, 26 Nov 2014 09:55:55 +0800 From: ChenLiang MIME-Version: 1.0 References: <1416958202-15913-1-git-send-email-gary.hook@nimboxx.com> In-Reply-To: <1416958202-15913-1-git-send-email-gary.hook@nimboxx.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] Block migration: fix return value List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: grhookatwork@gmail.com Cc: Kevin Wolf , Gonglei , Gary R Hook , qemu-devel@nongnu.org, Stefan Hajnoczi On 2014/11/26 7:30, grhookatwork@gmail.com wrote: > 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 > > --- > block-migration.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/block-migration.c b/block-migration.c > index 08db01a..74d9eb1 100644 > --- a/block-migration.c > +++ b/block-migration.c > @@ -653,6 +653,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); > @@ -702,7 +703,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. */ Reviewed-by: ChenLiang