From patchwork Mon Aug 29 14:53:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 112094 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4FBB9B6F7F for ; Tue, 30 Aug 2011 01:46:51 +1000 (EST) Received: from localhost ([::1]:49779 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qy3CA-0001zV-La for incoming@patchwork.ozlabs.org; Mon, 29 Aug 2011 10:52:14 -0400 Received: from eggs.gnu.org ([140.186.70.92]:50423) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qy3B8-000088-MN for qemu-devel@nongnu.org; Mon, 29 Aug 2011 10:51:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qy3B6-0000bM-00 for qemu-devel@nongnu.org; Mon, 29 Aug 2011 10:51:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1053) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qy3B5-0000ay-Ab for qemu-devel@nongnu.org; Mon, 29 Aug 2011 10:51:07 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7TEp5mk005225 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 29 Aug 2011 10:51:05 -0400 Received: from dhcp-5-188.str.redhat.com (dhcp-5-175.str.redhat.com [10.32.5.175]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p7TEoecv021975; Mon, 29 Aug 2011 10:51:04 -0400 From: Kevin Wolf To: anthony@codemonkey.ws Date: Mon, 29 Aug 2011 16:53:27 +0200 Message-Id: <1314629618-8308-20-git-send-email-kwolf@redhat.com> In-Reply-To: <1314629618-8308-1-git-send-email-kwolf@redhat.com> References: <1314629618-8308-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 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 19/30] qcow2: remove l2meta from QCowAIOCB 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: Frediano Ziglio Signed-off-by: Frediano Ziglio Signed-off-by: Kevin Wolf --- block/qcow2.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index cc5f409..3068a58 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -385,7 +385,6 @@ typedef struct QCowAIOCB { uint64_t cluster_offset; uint8_t *cluster_data; QEMUIOVector hd_qiov; - QCowL2Meta l2meta; } QCowAIOCB; /* @@ -518,8 +517,6 @@ static QCowAIOCB *qcow2_aio_setup(BlockDriverState *bs, int64_t sector_num, acb->bytes_done = 0; acb->remaining_sectors = nb_sectors; acb->cluster_offset = 0; - acb->l2meta.nb_clusters = 0; - qemu_co_queue_init(&acb->l2meta.dependent_requests); return acb; } @@ -570,6 +567,10 @@ static int qcow2_aio_write_cb(QCowAIOCB *acb) int n_end; int ret; int cur_nr_sectors; /* number of sectors in current iteration */ + QCowL2Meta l2meta; + + l2meta.nb_clusters = 0; + qemu_co_queue_init(&l2meta.dependent_requests); if (acb->remaining_sectors == 0) { /* request completed */ @@ -583,12 +584,12 @@ static int qcow2_aio_write_cb(QCowAIOCB *acb) n_end = QCOW_MAX_CRYPT_CLUSTERS * s->cluster_sectors; ret = qcow2_alloc_cluster_offset(bs, acb->sector_num << 9, - index_in_cluster, n_end, &cur_nr_sectors, &acb->l2meta); + index_in_cluster, n_end, &cur_nr_sectors, &l2meta); if (ret < 0) { return ret; } - acb->cluster_offset = acb->l2meta.cluster_offset; + acb->cluster_offset = l2meta.cluster_offset; assert((acb->cluster_offset & 511) == 0); qemu_iovec_reset(&acb->hd_qiov); @@ -622,9 +623,9 @@ static int qcow2_aio_write_cb(QCowAIOCB *acb) return ret; } - ret = qcow2_alloc_cluster_link_l2(bs, &acb->l2meta); + ret = qcow2_alloc_cluster_link_l2(bs, &l2meta); - run_dependent_requests(s, &acb->l2meta); + run_dependent_requests(s, &l2meta); if (ret < 0) { return ret;