diff options
author | MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> | 2013-10-24 16:01:12 +0900 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2013-10-30 12:22:01 +0100 |
commit | 2412aec745066495f0c91dfcde9258382d7850e9 (patch) | |
tree | 05701af01a16ac7256d2ca545113c49864fba86b /block/sheepdog.c | |
parent | 80731d9da560461bbdcda5ad4b05f4a8a846fccd (diff) | |
download | qemu-2412aec745066495f0c91dfcde9258382d7850e9.zip qemu-2412aec745066495f0c91dfcde9258382d7850e9.tar.gz qemu-2412aec745066495f0c91dfcde9258382d7850e9.tar.bz2 |
sheepdog: handle vdi objects in resend_aio_req
The current resend_aio_req() doesn't work when the request is against
vdi objects. This fixes the problem.
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Tested-by: Liu Yuan <namei.unix@gmail.com>
Reviewed-by: Liu Yuan <namei.unix@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/sheepdog.c')
-rw-r--r-- | block/sheepdog.c | 21 |
1 files 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 */ |