qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/2] block: Enable BDRV_O_SNAPSHOT with driver-specific options
Date: Thu, 21 Nov 2013 15:33:09 +0100	[thread overview]
Message-ID: <20131121143309.GA17336@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1384875448-13115-2-git-send-email-kwolf@redhat.com>

On Tue, Nov 19, 2013 at 04:37:27PM +0100, Kevin Wolf wrote:
> @@ -1114,6 +1093,24 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options,
>              goto fail;
>          }
>  
> +        /* Prepare a new options QDict for the temporary file, where user
> +         * options refer to the backing file */
> +        if (!options) {
> +            options = qdict_new();
> +        }

You can drop this because options is never NULL:

  options = qdict_clone_shallow(options);

  /* For snapshot=on, create a temporary qcow2 overlay */
  if (flags & BDRV_O_SNAPSHOT) {
      ...

> +        if (filename) {
> +            qdict_put(options, "file.filename", qstring_from_str(filename));
> +        }
> +        if (drv) {
> +            qdict_put(options, "driver", qstring_from_str(drv->format_name));
> +        }
> +
> +        snapshot_options = qdict_new();
> +        qdict_put(snapshot_options, "backing", options);
> +        qdict_flatten(snapshot_options);
> +
> +        options = snapshot_options;

One thing I'm not sure about after these operations have been performed:

  bs->options = options;
  ...
  if (flags & BDRV_O_SNAPSHOT) {
      ...

So bs->options does not reflect what we ended up with in the
BDRV_O_SNAPSHOT case.

But git grep -- '->options' shows no users of this field.  Therefore it
won't cause a problem yet.  But can you explain what's going on here?
Either we should keep bs->options up-to-date or we should drop the
field.

Stefan

  parent reply	other threads:[~2013-11-21 14:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-19 15:37 [Qemu-devel] [PATCH 0/2] block: Enable BDRV_O_SNAPSHOT with driver-specific options Kevin Wolf
2013-11-19 15:37 ` [Qemu-devel] [PATCH 1/2] " Kevin Wolf
2013-11-19 15:52   ` Eric Blake
2013-11-21 14:33   ` Stefan Hajnoczi [this message]
2013-11-21 15:05     ` Kevin Wolf
2013-11-19 15:37 ` [Qemu-devel] [PATCH 2/2] qemu-iotests: Test snapshot mode Kevin Wolf
2013-11-19 15:54   ` Eric Blake

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=20131121143309.GA17336@stefanha-thinkpad.redhat.com \
    --to=stefanha@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --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).