[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [RFC PATCH 03/10] qcow2: Let qcow2_create() handle prot
From: |
Eric Blake |
Subject: |
Re: [Qemu-block] [RFC PATCH 03/10] qcow2: Let qcow2_create() handle protocol layer |
Date: |
Tue, 16 Jan 2018 13:03:55 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 |
On 01/11/2018 01:52 PM, Kevin Wolf wrote:
> Currently, qcow2_create() only parses the QemuOpts and then calls
> qcow2_create2() for the actual image creation, which includes both the
> creation of the actual file on the file system and writing a valid empty
> qcow2 image into that file.
>
> The plan is that qcow2_create2() becomes the function that implements
> the functionality for a future 'blockdev-create' QMP command, which only
> creates the qcow2 layer on an already opened file node.
>
> This is a first step towards that goal: Let's move out anything that
> deals with the protocol layer from qcow2_create2() into qcow2_create().
> This means that qcow2_create2() doesn't need a file name any more.
>
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
> block/qcow2.c | 64
> +++++++++++++++++++++++++++++++++++------------------------
> 1 file changed, 38 insertions(+), 26 deletions(-)
>
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 4348b2c0c5..b02bc39a01 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -2690,7 +2690,7 @@ static uint64_t
> qcow2_opt_get_refcount_bits_del(QemuOpts *opts, int version,
> return refcount_bits;
> }
>
> -static int qcow2_create2(const char *filename, int64_t total_size,
> +static int qcow2_create2(BlockDriverState *bs, int64_t total_size,
Might be worth adding a high-level comment before the two functions to
document the division of labor, rather than just the commit message.
> @@ -2962,12 +2948,38 @@ static int qcow2_create(const char *filename,
> QemuOpts *opts, Error **errp)
>
> refcount_order = ctz32(refcount_bits);
>
> - ret = qcow2_create2(filename, size, backing_file, backing_fmt, flags,
> + /* Create and open the file (protocol layer */
Closing )
With the nit fixed,
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-block] [Qemu-devel] [RFC PATCH 02/10] block/qapi: Add qcow2 create options to schema, (continued)
Re: [Qemu-block] [RFC PATCH 02/10] block/qapi: Add qcow2 create options to schema, Eric Blake, 2018/01/16
Re: [Qemu-block] [RFC PATCH 02/10] block/qapi: Add qcow2 create options to schema, Max Reitz, 2018/01/29
[Qemu-block] [RFC PATCH 03/10] qcow2: Let qcow2_create() handle protocol layer, Kevin Wolf, 2018/01/11
- Re: [Qemu-block] [RFC PATCH 03/10] qcow2: Let qcow2_create() handle protocol layer,
Eric Blake <=
[Qemu-block] [RFC PATCH 04/10] qcow2: Pass BlockdevCreateOptions to qcow2_create2(), Kevin Wolf, 2018/01/11
[Qemu-block] [RFC PATCH 05/10] qcow2: Use BlockdevRef in qcow2_create2(), Kevin Wolf, 2018/01/11
[Qemu-block] [RFC PATCH 06/10] qcow2: Use QCryptoBlockCreateOptions in qcow2_create2(), Kevin Wolf, 2018/01/11