[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 2/8] sheepdog: handle vdi objects in resend_aio_r
From: |
MORITA Kazutaka |
Subject: |
[Qemu-devel] [PATCH v5 2/8] sheepdog: handle vdi objects in resend_aio_req |
Date: |
Thu, 24 Oct 2013 16:01:12 +0900 |
The current resend_aio_req() doesn't work when the request is against
vdi objects. This fixes the problem.
Reviewed-by: Liu Yuan <address@hidden>
Signed-off-by: MORITA Kazutaka <address@hidden>
---
block/sheepdog.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/block/sheepdog.c b/block/sheepdog.c
index cb681de..59cad97 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -1192,11 +1192,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;
@@ -1224,8 +1228,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.7.10.4
- [Qemu-devel] [PATCH v5 0/8] sheepdog: reconnect server after connection failure, MORITA Kazutaka, 2013/10/24
- [Qemu-devel] [PATCH v5 5/8] sheepdog: try to reconnect to sheepdog after network error, MORITA Kazutaka, 2013/10/24
- [Qemu-devel] [PATCH v5 3/8] sheepdog: reload inode outside of resend_aioreq, MORITA Kazutaka, 2013/10/24
- [Qemu-devel] [PATCH v5 6/8] sheepdog: make add_aio_request and send_aioreq void functions, MORITA Kazutaka, 2013/10/24
- [Qemu-devel] [PATCH v5 1/8] sheepdog: check return values of qemu_co_recv/send correctly, MORITA Kazutaka, 2013/10/24
- [Qemu-devel] [PATCH v5 7/8] sheepdog: cancel aio requests if possible, MORITA Kazutaka, 2013/10/24
- [Qemu-devel] [PATCH v5 8/8] sheepdog: check simultaneous create in resend_aioreq, MORITA Kazutaka, 2013/10/24
- [Qemu-devel] [PATCH v5 4/8] coroutine: add co_aio_sleep_ns() to allow sleep in block drivers, MORITA Kazutaka, 2013/10/24
- [Qemu-devel] [PATCH v5 2/8] sheepdog: handle vdi objects in resend_aio_req,
MORITA Kazutaka <=
- Re: [Qemu-devel] [PATCH v5 0/8] sheepdog: reconnect server after connection failure, Liu Yuan, 2013/10/28