From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59561) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFcbk-0005PO-Kn for qemu-devel@nongnu.org; Fri, 08 Aug 2014 01:20:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XFcbe-0003Ye-LO for qemu-devel@nongnu.org; Fri, 08 Aug 2014 01:20:52 -0400 Received: from mail-pa0-x22f.google.com ([2607:f8b0:400e:c03::22f]:41711) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFcbe-0003Ya-DS for qemu-devel@nongnu.org; Fri, 08 Aug 2014 01:20:46 -0400 Received: by mail-pa0-f47.google.com with SMTP id kx10so6646131pab.20 for ; Thu, 07 Aug 2014 22:20:44 -0700 (PDT) Date: Fri, 8 Aug 2014 13:20:39 +0800 From: Liu Yuan Message-ID: <20140808052038.GD12057@ubuntu-trusty> References: <1407396520-2720-1-git-send-email-mitake.hitoshi@lab.ntt.co.jp> <1407396520-2720-2-git-send-email-mitake.hitoshi@lab.ntt.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1407396520-2720-2-git-send-email-mitake.hitoshi@lab.ntt.co.jp> Subject: Re: [Qemu-devel] [PATCH 1/2] sheepdog: adopting protocol update for VDI locking List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hitoshi Mitake Cc: Kevin Wolf , sheepdog@lists.wpkg.org, mitake.hitoshi@gmail.com, qemu-devel@nongnu.org, Stefan Hajnoczi , MORITA Kazutaka On Thu, Aug 07, 2014 at 04:28:39PM +0900, Hitoshi Mitake wrote: > The update is required for supporting iSCSI multipath. It doesn't > affect behavior of QEMU driver but adding a new field to vdi request > struct is required. > > Cc: Kevin Wolf > Cc: Stefan Hajnoczi > Cc: Liu Yuan > Cc: MORITA Kazutaka > Signed-off-by: Hitoshi Mitake > --- > block/sheepdog.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/block/sheepdog.c b/block/sheepdog.c > index 8d9350c..36f76f0 100644 > --- a/block/sheepdog.c > +++ b/block/sheepdog.c > @@ -103,6 +103,9 @@ > #define SD_INODE_SIZE (sizeof(SheepdogInode)) > #define CURRENT_VDI_ID 0 > > +#define LOCK_TYPE_NORMAL 1 > +#define LOCK_TYPE_SHARED 2 /* for iSCSI multipath */ How about #define LOCK_TYPE_NORMAL 0 #define LOCK_TYPE_SHARED 1 Then we don't need this patch. Since qemu won't make use of multipath for the near future, we should avoid adding stuff related to multipath to qemu driver. Thanks Yuan > + > typedef struct SheepdogReq { > uint8_t proto_ver; > uint8_t opcode; > @@ -166,7 +169,8 @@ typedef struct SheepdogVdiReq { > uint8_t copy_policy; > uint8_t reserved[2]; > uint32_t snapid; > - uint32_t pad[3]; > + uint32_t type; > + uint32_t pad[2]; > } SheepdogVdiReq; > > typedef struct SheepdogVdiRsp { > @@ -1090,6 +1094,7 @@ static int find_vdi_name(BDRVSheepdogState *s, const char *filename, > memset(&hdr, 0, sizeof(hdr)); > if (lock) { > hdr.opcode = SD_OP_LOCK_VDI; > + hdr.type = LOCK_TYPE_NORMAL; > } else { > hdr.opcode = SD_OP_GET_VDI_INFO; > } > @@ -1793,6 +1798,7 @@ static void sd_close(BlockDriverState *bs) > memset(&hdr, 0, sizeof(hdr)); > > hdr.opcode = SD_OP_RELEASE_VDI; > + hdr.type = LOCK_TYPE_NORMAL; > hdr.base_vdi_id = s->inode.vdi_id; > wlen = strlen(s->name) + 1; > hdr.data_length = wlen; > -- > 1.8.3.2 >