Am 16.01.2014 um 20:20 hat Jeff Cody geschrieben:
> On Thu, Jan 16, 2014 at 10:39:30AM +0100, Kevin Wolf wrote:
> > Am 14.01.2014 um 20:12 hat Jeff Cody geschrieben:
> > > Having both read-only=on and snapshot=on together does not make sense;
> > > currently, the read-only argument is effectively ignored for the
> > > temporary snapshot.  To prevent confusion, disallow the usage of both
> > > 'snapshot=on' and 'read-only=on'.
> > > 
> > > Signed-off-by: Jeff Cody <jc...@redhat.com>
> > 
> > I believe the reason why this was allowed was so that you can use a
> > read-only file with -snapshot. It might not be necessary any more since
> > I switched -snapshot implementation to modify the options QDict instead
> > of manually doing a second bdrv_open().
> > 
> > Did you test that this still works now?
> 
> Yes, that still works.

Great. :-)

> > The other question is about this code in bdrv_open_flags():
> > 
> >     /*
> >      * Snapshots should be writable.
> >      */
> >     if (bs->is_temporary) {
> >         open_flags |= BDRV_O_RDWR;
> >     }
> > 
> > Is this dead code now because the flag is always already set?
> >
> 
> Yes, that ends up being dead code.  From later in blockdev_init():
> 
>     bdrv_flags |= ro ? 0 : BDRV_O_RDWR;
>     
>     QINCREF(bs_opts);
>     ret = bdrv_open(dinfo->bdrv, file, bs_opts, bdrv_flags, drv, &error);
> 
> 
> And ro is set from the read-only QemuOpts, that we check in this
> patch in conjunction with snapshot.  So if read-only=on is not
> specified, it is opened r/w by default.

Good, that was my impression as well. Can you send a follow-up patch to
remove the dead code?

Kevin

Reply via email to