From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59014) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VjVJr-0000pf-QY for qemu-devel@nongnu.org; Thu, 21 Nov 2013 09:33:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VjVJh-0006Ze-Fn for qemu-devel@nongnu.org; Thu, 21 Nov 2013 09:33:23 -0500 Received: from mail-wg0-x231.google.com ([2a00:1450:400c:c00::231]:61088) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VjVJh-0006ZR-9t for qemu-devel@nongnu.org; Thu, 21 Nov 2013 09:33:13 -0500 Received: by mail-wg0-f49.google.com with SMTP id x12so820786wgg.28 for ; Thu, 21 Nov 2013 06:33:12 -0800 (PST) Date: Thu, 21 Nov 2013 15:33:09 +0100 From: Stefan Hajnoczi Message-ID: <20131121143309.GA17336@stefanha-thinkpad.redhat.com> References: <1384875448-13115-1-git-send-email-kwolf@redhat.com> <1384875448-13115-2-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1384875448-13115-2-git-send-email-kwolf@redhat.com> Subject: Re: [Qemu-devel] [PATCH 1/2] block: Enable BDRV_O_SNAPSHOT with driver-specific options List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org, stefanha@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