From patchwork Thu Jul 28 07:40:36 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frediano Ziglio X-Patchwork-Id: 107194 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 41D91B6F00 for ; Thu, 28 Jul 2011 17:41:31 +1000 (EST) Received: from localhost ([::1]:50915 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QmLDk-0005Vv-39 for incoming@patchwork.ozlabs.org; Thu, 28 Jul 2011 03:41:28 -0400 Received: from eggs.gnu.org ([140.186.70.92]:44478) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QmLD4-0003bX-UA for qemu-devel@nongnu.org; Thu, 28 Jul 2011 03:40:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QmLD3-0004bJ-VQ for qemu-devel@nongnu.org; Thu, 28 Jul 2011 03:40:46 -0400 Received: from mail-fx0-f45.google.com ([209.85.161.45]:32869) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QmLD3-0004Z7-PF for qemu-devel@nongnu.org; Thu, 28 Jul 2011 03:40:45 -0400 Received: by mail-fx0-f45.google.com with SMTP id b27so719180fxb.4 for ; Thu, 28 Jul 2011 00:40:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=eIfjEaxyf4rSKMwD8ei6PpeT2UXO7B98Ya2F86gLBFU=; b=RhJbCVeOkM1q4pAq+wpJnhCHPb3xEVoM3BInVIOGw17epYAwBnJQjvUhuoikUYmWXw W0egEui2FzSS6i2cOs5r2H4lXGAOY7Rm8XhFZv+nDhfxeNTLy01Xyi0rAf9QH28719ja N1QWVmxSkJfr06v5V1IPvhX+vKqlne0hh7bF4= Received: by 10.223.76.71 with SMTP id b7mr178572fak.30.1311838845302; Thu, 28 Jul 2011 00:40:45 -0700 (PDT) Received: from obol602.omnitel.it ([87.236.194.191]) by mx.google.com with ESMTPS id y15sm287187fah.35.2011.07.28.00.40.41 (version=SSLv3 cipher=OTHER); Thu, 28 Jul 2011 00:40:43 -0700 (PDT) From: Frediano Ziglio To: Kevin Wolf Date: Thu, 28 Jul 2011 09:40:36 +0200 Message-Id: <1311838841-4853-4-git-send-email-freddy77@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1311838841-4853-1-git-send-email-freddy77@gmail.com> References: <1311838841-4853-1-git-send-email-freddy77@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.161.45 Cc: qemu-devel@nongnu.org, Frediano Ziglio Subject: [Qemu-devel] [PATCH 3/8] 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 Signed-off-by: Frediano Ziglio --- block/qcow2.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 0cf4465..adf31ce 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -381,7 +381,6 @@ typedef struct QCowAIOCB { uint64_t cluster_offset; uint8_t *cluster_data; QEMUIOVector hd_qiov; - QCowL2Meta l2meta; } QCowAIOCB; /* @@ -514,8 +513,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; } @@ -566,6 +563,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 */ @@ -579,12 +580,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); @@ -618,9 +619,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;