From patchwork Wed Jul 24 07:56:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: MORITA Kazutaka X-Patchwork-Id: 261328 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 7D2482C0084 for ; Wed, 24 Jul 2013 18:04:30 +1000 (EST) Received: from localhost ([::1]:51797 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1u3g-0000aD-M2 for incoming@patchwork.ozlabs.org; Wed, 24 Jul 2013 04:04:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35991) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1ty0-0000LX-7t for qemu-devel@nongnu.org; Wed, 24 Jul 2013 03:58:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1txz-0000d7-9h for qemu-devel@nongnu.org; Wed, 24 Jul 2013 03:58:36 -0400 Received: from sh.osrg.net ([192.16.179.4]:38787) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1txy-0000cQ-OT for qemu-devel@nongnu.org; Wed, 24 Jul 2013 03:58:35 -0400 Received: from fs.osrg.net (localns.osrg.net [10.0.0.11]) by sh.osrg.net (8.14.4/8.14.4/OSRG-NET) with ESMTP id r6O7wPpX014934; Wed, 24 Jul 2013 16:58:25 +0900 Received: from localhost (unknown [10.32.32.72]) by fs.osrg.net (Postfix) with ESMTP id 20CCDF94B; Wed, 24 Jul 2013 16:58:25 +0900 (JST) From: MORITA Kazutaka To: Kevin Wolf , Stefan Hajnoczi , Paolo Bonzini , qemu-devel@nongnu.org Date: Wed, 24 Jul 2013 16:56:28 +0900 Message-Id: <1374652593-7242-5-git-send-email-morita.kazutaka@lab.ntt.co.jp> X-Mailer: git-send-email 1.8.1.3.566.gaa39828 In-Reply-To: <1374652593-7242-1-git-send-email-morita.kazutaka@lab.ntt.co.jp> References: <1374652593-7242-1-git-send-email-morita.kazutaka@lab.ntt.co.jp> X-Dispatcher: imput version 20100215(IM150) Lines: 52 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.9 (sh.osrg.net [192.16.179.4]); Wed, 24 Jul 2013 16:58:26 +0900 (JST) X-Virus-Scanned: clamav-milter 0.97.8 at sh X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 192.16.179.4 Cc: sheepdog@lists.wpkg.org Subject: [Qemu-devel] [PATCH v2 4/9] sheepdog: handle vdi objects in resend_aio_req 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 The current resend_aio_req() doesn't work when the request is against vdi objects. This fixes the problem. Signed-off-by: MORITA Kazutaka --- block/sheepdog.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/block/sheepdog.c b/block/sheepdog.c index bca5730..f25c7df 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -1209,11 +1209,15 @@ static int coroutine_fn resend_aioreq(BDRVSheepdogState *s, AIOReq *aio_req) return ret; } - aio_req->oid = vid_to_data_oid(s->inode.vdi_id, - data_oid_to_idx(aio_req->oid)); + if (is_data_obj(aio_req->oid)) { + aio_req->oid = vid_to_data_oid(s->inode.vdi_id, + data_oid_to_idx(aio_req->oid)); + } else { + aio_req->oid = vid_to_vdi_oid(s->inode.vdi_id); + } /* check whether this request becomes a CoW one */ - if (acb->aiocb_type == AIOCB_WRITE_UDATA) { + if (acb->aiocb_type == AIOCB_WRITE_UDATA && is_data_obj(aio_req->oid)) { int idx = data_oid_to_idx(aio_req->oid); AIOReq *areq; @@ -1241,8 +1245,15 @@ static int coroutine_fn resend_aioreq(BDRVSheepdogState *s, AIOReq *aio_req) create = true; } out: - return add_aio_request(s, aio_req, acb->qiov->iov, acb->qiov->niov, - create, acb->aiocb_type); + if (is_data_obj(aio_req->oid)) { + return add_aio_request(s, aio_req, acb->qiov->iov, acb->qiov->niov, + create, acb->aiocb_type); + } else { + struct iovec iov; + iov.iov_base = &s->inode; + iov.iov_len = sizeof(s->inode); + return add_aio_request(s, aio_req, &iov, 1, false, AIOCB_WRITE_UDATA); + } } /* TODO Convert to fine grained options */