Patchwork [v2] sheepdog: pass vdi_id to sheep daemon for sd_close()

login
register
mail settings
Submitter namei.unix@gmail.com
Date Jan. 29, 2013, 9:14 a.m.
Message ID <1359450857-29964-1-git-send-email-namei.unix@gmail.com>
Download mbox | patch
Permalink /patch/216472/
State New
Headers show

Comments

namei.unix@gmail.com - Jan. 29, 2013, 9:14 a.m.
From: Liu Yuan <tailai.ly@taobao.com>

Sheep daemon needs vdi_id to identify which vdi is closed to release resources
such as object cache.

Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
---
 v2: rename base_vdi_id as vdi_id to exclude confusion.

 block/sheepdog.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
MORITA Kazutaka - Jan. 29, 2013, 9:36 a.m.
At Tue, 29 Jan 2013 17:14:16 +0800,
Liu Yuan wrote:
> 
> From: Liu Yuan <tailai.ly@taobao.com>
> 
> Sheep daemon needs vdi_id to identify which vdi is closed to release resources
> such as object cache.
> 
> Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
> Cc: Kevin Wolf <kwolf@redhat.com>
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
> Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
> ---
>  v2: rename base_vdi_id as vdi_id to exclude confusion.
> 
>  block/sheepdog.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Looks good to me.

Reviewed-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Stefan Hajnoczi - Jan. 30, 2013, 9:03 a.m.
On Tue, Jan 29, 2013 at 05:14:16PM +0800, Liu Yuan wrote:
> From: Liu Yuan <tailai.ly@taobao.com>
> 
> Sheep daemon needs vdi_id to identify which vdi is closed to release resources
> such as object cache.
> 
> Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
> Cc: Kevin Wolf <kwolf@redhat.com>
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
> Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
> ---
>  v2: rename base_vdi_id as vdi_id to exclude confusion.
> 
>  block/sheepdog.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

Patch

diff --git a/block/sheepdog.c b/block/sheepdog.c
index 3e49bb8..d466b23 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -145,7 +145,7 @@  typedef struct SheepdogVdiReq {
     uint32_t id;
     uint32_t data_length;
     uint64_t vdi_size;
-    uint32_t base_vdi_id;
+    uint32_t vdi_id;
     uint32_t copies;
     uint32_t snapid;
     uint32_t pad[3];
@@ -1201,7 +1201,7 @@  static int do_sd_create(char *filename, int64_t vdi_size,
 
     memset(&hdr, 0, sizeof(hdr));
     hdr.opcode = SD_OP_NEW_VDI;
-    hdr.base_vdi_id = base_vid;
+    hdr.vdi_id = base_vid;
 
     wlen = SD_MAX_VDI_LEN;
 
@@ -1384,6 +1384,7 @@  static void sd_close(BlockDriverState *bs)
     memset(&hdr, 0, sizeof(hdr));
 
     hdr.opcode = SD_OP_RELEASE_VDI;
+    hdr.vdi_id = s->inode.vdi_id;
     wlen = strlen(s->name) + 1;
     hdr.data_length = wlen;
     hdr.flags = SD_FLAG_CMD_WRITE;