From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43527) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbuV4-0004Yl-3a for qemu-devel@nongnu.org; Thu, 31 Oct 2013 11:49:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VbuUy-0004PA-TL for qemu-devel@nongnu.org; Thu, 31 Oct 2013 11:49:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52176) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbuUy-0004Ox-Jq for qemu-devel@nongnu.org; Thu, 31 Oct 2013 11:49:28 -0400 From: Kevin Wolf Date: Thu, 31 Oct 2013 16:48:35 +0100 Message-Id: <1383234524-372-22-git-send-email-kwolf@redhat.com> In-Reply-To: <1383234524-372-1-git-send-email-kwolf@redhat.com> References: <1383234524-372-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 21/30] sheepdog: handle vdi objects in resend_aio_req List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: MORITA Kazutaka The current resend_aio_req() doesn't work when the request is against vdi objects. This fixes the problem. Signed-off-by: MORITA Kazutaka Tested-by: Liu Yuan Reviewed-by: Liu Yuan Signed-off-by: Kevin Wolf --- block/sheepdog.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/block/sheepdog.c b/block/sheepdog.c index c6e57f0..ddb8bfb 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -1197,11 +1197,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; @@ -1229,8 +1233,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 */ -- 1.8.1.4