[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v22 07/25] change block layer to support both Qe
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v22 07/25] change block layer to support both QemuOpts and QEMUOptionParamter |
Date: |
Mon, 10 Mar 2014 22:34:48 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 |
On 03/10/2014 01:31 AM, Chunyan Liu wrote:
> Change block layer to support both QemuOpts and QEMUOptionParameter.
> After this patch, it will change backend drivers one by one. At the end,
> QEMUOptionParameter will be removed and only QemuOpts is kept.
>
> Signed-off-by: Dong Xu Wang <address@hidden>
> Signed-off-by: Chunyan Liu <address@hidden>
> ---
> @@ -420,7 +421,11 @@ static void coroutine_fn bdrv_create_co_entry(void
> *opaque)
> CreateCo *cco = opaque;
> assert(cco->drv);
>
> - ret = cco->drv->bdrv_create(cco->filename, cco->options, &local_err);
> + if (cco->drv->bdrv_create2) {
> + ret = cco->drv->bdrv_create2(cco->filename, cco->opts, &local_err);
Is it worth assert(!cco->options) here,
> + } else {
> + ret = cco->drv->bdrv_create(cco->filename, cco->options, &local_err);
and assert(!cco->opts) here, to ensure that we aren't ignoring options
from the other style of create? Then again, it gets cleaned up in later
patches.
> @@ -5248,28 +5266,31 @@ void bdrv_img_create(const char *filename, const char
> *fmt,
> return;
> }
>
> - create_options = append_option_parameters(create_options,
> - drv->create_options);
> - create_options = append_option_parameters(create_options,
> - proto_drv->create_options);
> + if (drv->bdrv_create2) {
> + create_opts = qemu_opts_append(create_opts, drv->create_opts);
> + create_opts = qemu_opts_append(create_opts, proto_drv->create_opts);
Memory leak. As implemented earlier in the series, qemu_opts_append()
creates a new object, but as you are overwriting create_opts with the
second result without hanging onto the pointer returned by the first
call, you have just leaked the first instance.
I ran out of time to review further today, but this series still needs
more work, and I am starting to doubt that it will make 2.0.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH v22 05/25] add some QemuOpts functions for replace work, (continued)
- [Qemu-devel] [PATCH v22 04/25] improve assertion in qemu_opt_get functions, Chunyan Liu, 2014/03/10
- [Qemu-devel] [PATCH v22 06/25] add convert functions between QEMUOptionParameter to QemuOpts, Chunyan Liu, 2014/03/10
- [Qemu-devel] [PATCH v22 08/25] cow.c: replace QEMUOptionParameter with QemuOpts, Chunyan Liu, 2014/03/10
- [Qemu-devel] [PATCH v22 07/25] change block layer to support both QemuOpts and QEMUOptionParamter, Chunyan Liu, 2014/03/10
- [Qemu-devel] [PATCH v22 09/25] gluster.c: replace QEMUOptionParameter with QemuOpts, Chunyan Liu, 2014/03/10
- [Qemu-devel] [PATCH v22 10/25] iscsi.c: replace QEMUOptionParameter with QemuOpts, Chunyan Liu, 2014/03/10
- [Qemu-devel] [PATCH v22 11/25] qcow.c: replace QEMUOptionParameter with QemuOpts, Chunyan Liu, 2014/03/10