From: Stefan Hajnoczi <stefanha@gmail.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org, hch@lst.de
Subject: Re: [Qemu-devel] [RFC PATCH 4/5] block: Open the underlying image file in generic code
Date: Thu, 15 Apr 2010 09:48:22 +0100 [thread overview]
Message-ID: <t2sfbd9d3991004150148s3dfac97cocb8b2bdcbde3ada2@mail.gmail.com> (raw)
In-Reply-To: <1271260214-27443-5-git-send-email-kwolf@redhat.com>
On Wed, Apr 14, 2010 at 4:50 PM, Kevin Wolf <kwolf@redhat.com> wrote:
> diff --git a/block/qcow.c b/block/qcow.c
> index c619984..01b1692 100644
> --- a/block/qcow.c
> +++ b/block/qcow.c
[..]
> @@ -169,7 +166,7 @@ static int qcow_open(BlockDriverState *bs, const char *filename, int flags)
> qemu_free(s->l2_cache);
> qemu_free(s->cluster_cache);
> qemu_free(s->cluster_data);
> - bdrv_delete(s->hd);
> + bdrv_delete(bs->file);
> return -1;
> }
qcow.c does not need to delete bs->file anymore because block.c does
that when BlockDriver->bdrv_open() fails. Also since we're not
setting bs->file to NULL after bdrv_delete() here, block.c will double
delete it.
> @@ -739,7 +737,7 @@ static void qcow_close(BlockDriverState *bs)
> qemu_free(s->l2_cache);
> qemu_free(s->cluster_cache);
> qemu_free(s->cluster_data);
> - bdrv_delete(s->hd);
> + bdrv_delete(bs->file);
> }
>
> static int qcow_create(const char *filename, QEMUOptionParameter *options)
block.c will bdrv_close(bs->file) for us, so I think this is not
needed. Double delete.
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 11ce8d1..4949d77 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
[...]
> @@ -254,7 +250,7 @@ static int qcow_open(BlockDriverState *bs, const char *filename, int flags)
> qemu_free(s->l2_cache);
> qemu_free(s->cluster_cache);
> qemu_free(s->cluster_data);
> - bdrv_delete(s->hd);
> + bdrv_delete(bs->file);
> return -1;
> }
Same as above.
> diff --git a/block/vdi.c b/block/vdi.c
> index c91961a..8b85339 100644
> --- a/block/vdi.c
> +++ b/block/vdi.c
[...]
> @@ -452,7 +446,7 @@ static int vdi_open(BlockDriverState *bs, const char *filename, int flags)
> qemu_free(s->bmap);
>
> fail:
> - bdrv_delete(s->hd);
> + bdrv_delete(bs->file);
> return -1;
> }
Same as above.
> diff --git a/block/vpc.c b/block/vpc.c
> index 950ad58..1d1ae09 100644
> --- a/block/vpc.c
> +++ b/block/vpc.c
[...]
> @@ -228,7 +224,7 @@ static int vpc_open(BlockDriverState *bs, const char *filename, int flags)
>
> return 0;
> fail:
> - bdrv_delete(s->hd);
> + bdrv_delete(bs->file);
> return -1;
> }
Same as above.
> @@ -590,7 +584,7 @@ static void vpc_close(BlockDriverState *bs)
> #ifdef CACHE
> qemu_free(s->pageentry_u8);
> #endif
> - bdrv_delete(s->hd);
> + bdrv_delete(bs->file);
> }
>
> static QEMUOptionParameter vpc_create_options[] = {
Same as above.
Stefan
next prev parent reply other threads:[~2010-04-15 8:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-14 15:50 [Qemu-devel] [RFC PATCH 0/5] block: Format/protocol split Kevin Wolf
2010-04-14 15:50 ` [Qemu-devel] [RFC PATCH 1/5] block: separate raw images from the file protocol Kevin Wolf
2010-04-14 18:36 ` Stefan Hajnoczi
2010-04-14 15:50 ` [Qemu-devel] [RFC PATCH 2/5] block: Split bdrv_open Kevin Wolf
2010-04-14 15:50 ` [Qemu-devel] [RFC PATCH 3/5] block: Avoid forward declaration of bdrv_open_common Kevin Wolf
2010-04-14 15:50 ` [Qemu-devel] [RFC PATCH 4/5] block: Open the underlying image file in generic code Kevin Wolf
2010-04-15 8:48 ` Stefan Hajnoczi [this message]
2010-04-14 15:50 ` [Qemu-devel] [RFC PATCH 5/5] block: bdrv_has_zero_init Kevin Wolf
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=t2sfbd9d3991004150148s3dfac97cocb8b2bdcbde3ada2@mail.gmail.com \
--to=stefanha@gmail.com \
--cc=hch@lst.de \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).