From patchwork Fri Sep 14 12:39:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 183928 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9D6762C0083 for ; Fri, 14 Sep 2012 23:36:47 +1000 (EST) Received: from localhost ([::1]:32848 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCVBz-0001VP-Jt for incoming@patchwork.ozlabs.org; Fri, 14 Sep 2012 08:40:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:54210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCVBC-0007kK-0z for qemu-devel@nongnu.org; Fri, 14 Sep 2012 08:39:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TCVB0-0004po-LW for qemu-devel@nongnu.org; Fri, 14 Sep 2012 08:39:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:15089) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCVB0-0004pk-D8 for qemu-devel@nongnu.org; Fri, 14 Sep 2012 08:39:18 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8ECdGh3008097 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 14 Sep 2012 08:39:16 -0400 Received: from dhcp-5-188.str.redhat.com (vpn1-6-21.ams2.redhat.com [10.36.6.21]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q8ECdDOb028864; Fri, 14 Sep 2012 08:39:15 -0400 From: Kevin Wolf To: anthony@codemonkey.ws Date: Fri, 14 Sep 2012 14:39:02 +0200 Message-Id: <1347626352-6023-2-git-send-email-kwolf@redhat.com> In-Reply-To: <1347626352-6023-1-git-send-email-kwolf@redhat.com> References: <1347626352-6023-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 01/11] sheepdog: fix savevm and loadvm 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: MORITA Kazutaka This patch sets data to be sent to Sheepdog correctly and fixes savevm and loadvm operations on a Sheepdog image. Signed-off-by: MORITA Kazutaka Signed-off-by: Kevin Wolf --- block/sheepdog.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/block/sheepdog.c b/block/sheepdog.c index df4f441..e0753ee 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -1986,7 +1986,7 @@ static int do_load_save_vmstate(BDRVSheepdogState *s, uint8_t *data, vdi_index = pos / SD_DATA_OBJ_SIZE; offset = pos % SD_DATA_OBJ_SIZE; - data_len = MIN(remaining, SD_DATA_OBJ_SIZE); + data_len = MIN(remaining, SD_DATA_OBJ_SIZE - offset); vmstate_oid = vid_to_vmstate_oid(s->inode.vdi_id, vdi_index); @@ -2007,6 +2007,7 @@ static int do_load_save_vmstate(BDRVSheepdogState *s, uint8_t *data, } pos += data_len; + data += data_len; remaining -= data_len; } ret = size;