[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 22/30] sheepdog: reload inode outside of resend_aiore
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 22/30] sheepdog: reload inode outside of resend_aioreq |
Date: |
Thu, 31 Oct 2013 16:48:36 +0100 |
From: MORITA Kazutaka <address@hidden>
This prepares for using resend_aioreq() after reconnecting to the
sheepdog server.
Signed-off-by: MORITA Kazutaka <address@hidden>
Tested-by: Liu Yuan <address@hidden>
Reviewed-by: Liu Yuan <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/sheepdog.c | 33 +++++++++++++++++++--------------
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/block/sheepdog.c b/block/sheepdog.c
index ddb8bfb..5311fb1 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -227,6 +227,11 @@ static inline uint64_t data_oid_to_idx(uint64_t oid)
return oid & (MAX_DATA_OBJS - 1);
}
+static inline uint32_t oid_to_vid(uint64_t oid)
+{
+ return (oid & ~VDI_BIT) >> VDI_SPACE_SHIFT;
+}
+
static inline uint64_t vid_to_vdi_oid(uint32_t vid)
{
return VDI_BIT | ((uint64_t)vid << VDI_SPACE_SHIFT);
@@ -605,7 +610,7 @@ static int coroutine_fn add_aio_request(BDRVSheepdogState
*s, AIOReq *aio_req,
struct iovec *iov, int niov, bool create,
enum AIOCBState aiocb_type);
static int coroutine_fn resend_aioreq(BDRVSheepdogState *s, AIOReq *aio_req);
-
+static int reload_inode(BDRVSheepdogState *s, uint32_t snapid, const char
*tag);
static AIOReq *find_pending_req(BDRVSheepdogState *s, uint64_t oid)
{
@@ -753,6 +758,19 @@ static void coroutine_fn aio_read_response(void *opaque)
case SD_RES_SUCCESS:
break;
case SD_RES_READONLY:
+ if (s->inode.vdi_id == oid_to_vid(aio_req->oid)) {
+ ret = reload_inode(s, 0, "");
+ if (ret < 0) {
+ goto out;
+ }
+ }
+
+ 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);
+ }
ret = resend_aioreq(s, aio_req);
if (ret == SD_RES_SUCCESS) {
goto out;
@@ -1190,19 +1208,6 @@ static int coroutine_fn resend_aioreq(BDRVSheepdogState
*s, AIOReq *aio_req)
{
SheepdogAIOCB *acb = aio_req->aiocb;
bool create = false;
- int ret;
-
- ret = reload_inode(s, 0, "");
- if (ret < 0) {
- return ret;
- }
-
- 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 && is_data_obj(aio_req->oid)) {
--
1.8.1.4
- [Qemu-devel] [PULL 12/30] sheepdog: explicitly set copies as type uint8_t, (continued)
- [Qemu-devel] [PULL 12/30] sheepdog: explicitly set copies as type uint8_t, Kevin Wolf, 2013/10/31
- [Qemu-devel] [PULL 14/30] ahci: fix win7 hang on boot, Kevin Wolf, 2013/10/31
- [Qemu-devel] [PULL 13/30] sheepdog: pass copy_policy in the request, Kevin Wolf, 2013/10/31
- [Qemu-devel] [PULL 15/30] block: Disable BDRV_O_COPY_ON_READ for the backing file, Kevin Wolf, 2013/10/31
- [Qemu-devel] [PULL 16/30] block: Avoid unecessary drv->bdrv_getlength() calls, Kevin Wolf, 2013/10/31
- [Qemu-devel] [PULL 17/30] qemu-iotests: Fix 051 reference output, Kevin Wolf, 2013/10/31
- [Qemu-devel] [PULL 18/30] qemu-iotests: drop duplicated "create_image", Kevin Wolf, 2013/10/31
- [Qemu-devel] [PULL 19/30] qemu-iotests: Test case for backing file deletion, Kevin Wolf, 2013/10/31
- [Qemu-devel] [PULL 20/30] sheepdog: check return values of qemu_co_recv/send correctly, Kevin Wolf, 2013/10/31
- [Qemu-devel] [PULL 21/30] sheepdog: handle vdi objects in resend_aio_req, Kevin Wolf, 2013/10/31
- [Qemu-devel] [PULL 22/30] sheepdog: reload inode outside of resend_aioreq,
Kevin Wolf <=
- [Qemu-devel] [PULL 23/30] coroutine: add co_aio_sleep_ns() to allow sleep in block drivers, Kevin Wolf, 2013/10/31
- [Qemu-devel] [PULL 24/30] sheepdog: try to reconnect to sheepdog after network error, Kevin Wolf, 2013/10/31
- [Qemu-devel] [PULL 25/30] sheepdog: make add_aio_request and send_aioreq void functions, Kevin Wolf, 2013/10/31
- [Qemu-devel] [PULL 27/30] sheepdog: check simultaneous create in resend_aioreq, Kevin Wolf, 2013/10/31
- [Qemu-devel] [PULL 26/30] sheepdog: cancel aio requests if possible, Kevin Wolf, 2013/10/31
- [Qemu-devel] [PULL 28/30] qemu-iotests: prefill some data to test image, Kevin Wolf, 2013/10/31
- [Qemu-devel] [PULL 29/30] qapi: Add optional field 'compressed' to ImageInfo, Kevin Wolf, 2013/10/31
- [Qemu-devel] [PULL 30/30] vmdk: Implment bdrv_get_specific_info, Kevin Wolf, 2013/10/31