From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, hbrock@redhat.com, rjones@redhat.com,
imain@redhat.com, stefanha@redhat.com, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [RFC PATCH v3 1/2] block: parse "backing" option to reference existing BDS
Date: Fri, 18 Oct 2013 18:04:54 +0800 [thread overview]
Message-ID: <20131018100454.GA7257@T430s.nay.redhat.com> (raw)
In-Reply-To: <1381988203-28576-2-git-send-email-famz@redhat.com>
On Thu, 10/17 13:36, Fam Zheng wrote:
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
> block.c | 27 ++++++++++++++++++++++-----
> 1 file changed, 22 insertions(+), 5 deletions(-)
>
> diff --git a/block.c b/block.c
> index fd05a80..38b3e80 100644
> --- a/block.c
> +++ b/block.c
> @@ -1158,11 +1158,28 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options,
> /* If there is a backing file, use it */
> if ((flags & BDRV_O_NO_BACKING) == 0) {
> QDict *backing_options;
> -
> - qdict_extract_subqdict(options, &backing_options, "backing.");
> - ret = bdrv_open_backing_file(bs, backing_options, &local_err);
> - if (ret < 0) {
> - goto close_and_fail;
> + const char *backing_bs;
> +
> + backing_bs = qdict_get_try_str(options, "backing");
> + if (backing_bs) {
> + bs->backing_hd = bdrv_find(backing_bs);
> + bdrv_ref(bs->backing_hd);
This should be moved down into if.
Fam
> + qdict_del(options, "backing");
> + if (bs->backing_hd) {
> + pstrcpy(bs->backing_file, sizeof(bs->backing_file),
> + bs->backing_hd->filename);
> + pstrcpy(bs->backing_format, sizeof(bs->backing_format),
> + bs->backing_hd->drv->format_name);
> + } else {
> + error_setg(errp, "Backing device not found: %s", backing_bs);
> + goto close_and_fail;
> + }
> + } else {
> + qdict_extract_subqdict(options, &backing_options, "backing.");
> + ret = bdrv_open_backing_file(bs, backing_options, &local_err);
> + if (ret < 0) {
> + goto close_and_fail;
> + }
> }
> }
>
> --
> 1.8.3.1
>
>
next prev parent reply other threads:[~2013-10-18 10:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-17 5:36 [Qemu-devel] [RFC PATCH v3 0/2] Point-in-time snapshot exporting over NBD Fam Zheng
2013-10-17 5:36 ` [Qemu-devel] [RFC PATCH v3 1/2] block: parse "backing" option to reference existing BDS Fam Zheng
2013-10-18 10:04 ` Fam Zheng [this message]
2013-10-17 5:36 ` [Qemu-devel] [RFC PATCH v3 2/2] qmp: add command 'blockdev-backup' Fam Zheng
2013-10-18 9:54 ` Paolo Bonzini
2013-11-20 2:32 ` [Qemu-devel] [RFC PATCH v3 0/2] Point-in-time snapshot exporting over NBD Ian Main
2013-11-22 5:47 ` Fam Zheng
2013-11-22 20:11 ` Ian Main
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=20131018100454.GA7257@T430s.nay.redhat.com \
--to=famz@redhat.com \
--cc=hbrock@redhat.com \
--cc=imain@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rjones@redhat.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).