qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Liu Yuan <namei.unix@gmail.com>
To: Jeff Cody <jcody@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	sheepdog-ng@googlegroups.com,
	Stefan Hajnoczi <stefanha@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] sheepdog: add reopen support
Date: Fri, 28 Aug 2015 09:47:45 +0800	[thread overview]
Message-ID: <20150828014745.GA12847@ubuntu-trusty> (raw)
In-Reply-To: <20150827190032.GL11016@localhost.localdomain>

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 <liuyuan@cmss.chinamobile.com>
> > 
> > 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 <jcody@redhat.com>
> > Cc: Kevin Wolf <kwolf@redhat.com>
> > Cc: Stefan Hajnoczi <stefanha@redhat.com>
> > Signed-off-by: Liu Yuan <liuyuan@cmss.chinamobile.com>
> > ---
> > 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

      reply	other threads:[~2015-08-28  1:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-27  2:54 [Qemu-devel] [PATCH v2] sheepdog: add reopen support Liu Yuan
2015-08-27 19:00 ` Jeff Cody
2015-08-28  1:47   ` Liu Yuan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150828014745.GA12847@ubuntu-trusty \
    --to=namei.unix@gmail.com \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sheepdog-ng@googlegroups.com \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).