From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZV8mW-0001GM-Pn for qemu-devel@nongnu.org; Thu, 27 Aug 2015 21:48:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZV8mT-0006rZ-H3 for qemu-devel@nongnu.org; Thu, 27 Aug 2015 21:48:40 -0400 Received: from mail-ig0-x232.google.com ([2607:f8b0:4001:c05::232]:37984) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZV8mT-0006qm-Ba for qemu-devel@nongnu.org; Thu, 27 Aug 2015 21:48:37 -0400 Received: by igyq3 with SMTP id q3so3307569igy.1 for ; Thu, 27 Aug 2015 18:48:36 -0700 (PDT) Date: Fri, 28 Aug 2015 09:47:45 +0800 From: Liu Yuan Message-ID: <20150828014745.GA12847@ubuntu-trusty> References: <1440644041-10600-1-git-send-email-namei.unix@gmail.com> <20150827190032.GL11016@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150827190032.GL11016@localhost.localdomain> Subject: Re: [Qemu-devel] [PATCH v2] sheepdog: add reopen support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jeff Cody Cc: Kevin Wolf , sheepdog-ng@googlegroups.com, Stefan Hajnoczi , qemu-devel@nongnu.org On Thu, Aug 27, 2015 at 03:00:32PM -0400, Jeff Cody wrote: > On Thu, Aug 27, 2015 at 10:54:01AM +0800, Liu Yuan wrote: > > From: Liu Yuan > > > > With reopen supported, block-commit (and offline commit) is now supported for > > image files whose base image uses the Sheepdog protocol driver. > > > > Cc: qemu-devel@nongnu.org > > Cc: Jeff Cody > > Cc: Kevin Wolf > > Cc: Stefan Hajnoczi > > Signed-off-by: Liu Yuan > > --- > > v2: > > - free AioHandler [Jeff Cody] > > > > block/sheepdog.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 75 insertions(+) > > > > diff --git a/block/sheepdog.c b/block/sheepdog.c > > index 9585beb..e54add4 100644 > > --- a/block/sheepdog.c > > +++ b/block/sheepdog.c > > @@ -377,6 +377,11 @@ typedef struct BDRVSheepdogState { > > QLIST_HEAD(inflight_aiocb_head, SheepdogAIOCB) inflight_aiocb_head; > > } BDRVSheepdogState; > > > > +typedef struct BDRVSheepdogReopenState { > > + int fd; > > + int cache_flags; > > +} BDRVSheepdogReopenState; > > + > > static const char * sd_strerror(int err) > > { > > int i; > > @@ -1486,6 +1491,67 @@ out: > > return ret; > > } > > > > +static int sd_reopen_prepare(BDRVReopenState *state, BlockReopenQueue *queue, > > + Error **errp) > > +{ > > + BDRVSheepdogState *s = state->bs->opaque; > > + BDRVSheepdogReopenState *re_s; > > + int ret = 0; > > + > > + re_s = state->opaque = g_new0(BDRVSheepdogReopenState, 1); > > + > > + if (state->flags & BDRV_O_NOCACHE) { > > + re_s->cache_flags = SD_FLAG_CMD_DIRECT; > > + } > > In sd_open(), the s->cache_flag is set to SD_FLAG_CMD_CACHE by > default, and then overwritten if BDRV_O_NOCACHE is set. Do we want > that same behavior here? > > (Sorry I didn't ask this the first time around) As far as I understood, sd_open() was called before sd_reopen, so I thought s->cache_flags = SD_FLAG_CMD_CACHE was duplicated in sd_reopen. But for a second thought, if the reopen indicates a complete flags reparsing, I'd agree with you. I'll prepare the third version of the patch. Thanks, Yuan