qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Hu Tao <hutao@cn.fujitsu.com>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, Peter Lieven <pl@kamp.de>,
	Markus Armbruster <armbru@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	y-goto@jp.fujitsu.com
Subject: Re: [Qemu-devel] [PATCH v10 4/6] qapi: introduce PreallocMode and a new PreallocMode full.
Date: Sat, 14 Jun 2014 21:17:02 +0200	[thread overview]
Message-ID: <539C9FAE.7050301@redhat.com> (raw)
In-Reply-To: <326b6e2708ff8cf314fa0fe29aeeb1f7f674122d.1402544518.git.hutao@cn.fujitsu.com>

On 12.06.2014 05:54, Hu Tao wrote:
> This patch prepares for the subsequent patches.
>
> Reviewed-by: Fam Zheng <famz@redhat.com>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
> ---
>   block/qcow2.c    |  8 ++++----
>   qapi-schema.json | 14 ++++++++++++++
>   2 files changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 6732e7c..2e0b83c 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -1593,7 +1593,7 @@ static int preallocate(BlockDriverState *bs)
>   
>   static int qcow2_create2(const char *filename, int64_t total_size,
>                            const char *backing_file, const char *backing_format,
> -                         int flags, size_t cluster_size, int prealloc,
> +                         int flags, size_t cluster_size, PreallocMode prealloc,
>                            QEMUOptionParameter *options, int version,
>                            Error **errp)
>   {
> @@ -1770,7 +1770,7 @@ static int qcow2_create(const char *filename, QEMUOptionParameter *options,
>       uint64_t size = 0;
>       int flags = 0;
>       size_t cluster_size = DEFAULT_CLUSTER_SIZE;
> -    int prealloc = 0;
> +    PreallocMode prealloc = PREALLOC_MODE_OFF;
>       int version = 3;
>       Error *local_err = NULL;
>       int ret;
> @@ -1791,9 +1791,9 @@ static int qcow2_create(const char *filename, QEMUOptionParameter *options,
>               }
>           } else if (!strcmp(options->name, BLOCK_OPT_PREALLOC)) {
>               if (!options->value.s || !strcmp(options->value.s, "off")) {
> -                prealloc = 0;
> +                prealloc = PREALLOC_MODE_OFF;
>               } else if (!strcmp(options->value.s, "metadata")) {
> -                prealloc = 1;
> +                prealloc = PREALLOC_MODE_METADATA;
>               } else {
>                   error_setg(errp, "Invalid preallocation mode: '%s'",
>                              options->value.s);
> diff --git a/qapi-schema.json b/qapi-schema.json
> index 14b498b..f5ccb31 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json

As of commit 5db15096 (Benoît's "Extract QAPI block commands" series), 
block-related QAPI definitions should go into qapi/block.json or 
qapi/block-core.json. I think the following definition should now go 
into qapi/block-core.json instead of qapi-schema.json.

Apart from that, this patch looks good.

Max

> @@ -3077,3 +3077,17 @@
>                 'btn'     : 'InputBtnEvent',
>                 'rel'     : 'InputMoveEvent',
>                 'abs'     : 'InputMoveEvent' } }
> +
> +##
> +# @PreallocMode
> +#
> +# Preallocation mode of QEMU image file
> +#
> +# @off: no preallocation
> +# @metadata: preallocate only for metadata
> +# @full: preallocate all data, including metadata
> +#
> +# Since 2.1
> +##
> +{ 'enum': 'PreallocMode',
> +  'data': [ 'off', 'metadata', 'full' ] }

  reply	other threads:[~2014-06-14 19:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-12  3:54 [Qemu-devel] [PATCH v10 0/6] qemu-img: add preallocation=full Hu Tao
2014-06-12  3:54 ` [Qemu-devel] [PATCH v10 1/6] block: round up file size to nearest sector Hu Tao
2014-06-14 18:51   ` Max Reitz
2014-06-12  3:54 ` [Qemu-devel] [PATCH v10 2/6] raw, qcow2: don't convert file size to sector size Hu Tao
2014-06-14 19:00   ` Max Reitz
2014-06-12  3:54 ` [Qemu-devel] [PATCH v10 3/6] rename parse_enum_option to qapi_enum_parse and make it public Hu Tao
2014-06-14 19:07   ` Max Reitz
2014-06-17  2:36     ` Hu Tao
2014-06-12  3:54 ` [Qemu-devel] [PATCH v10 4/6] qapi: introduce PreallocMode and a new PreallocMode full Hu Tao
2014-06-14 19:17   ` Max Reitz [this message]
2014-06-25  5:46     ` Hu Tao
2014-06-12  3:54 ` [Qemu-devel] [PATCH v10 5/6] raw-posix: Add full image preallocation option Hu Tao
2014-06-14 19:38   ` Max Reitz
2014-06-25  6:04     ` Hu Tao
2014-06-12  3:54 ` [Qemu-devel] [PATCH v10 6/6] qcow2: " Hu Tao
2014-06-14 20:37   ` Max Reitz
2014-06-20  8:25     ` Hu Tao
2014-06-20 18:37       ` Max Reitz
2014-06-25  5:41         ` Hu Tao

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=539C9FAE.7050301@redhat.com \
    --to=mreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=hutao@cn.fujitsu.com \
    --cc=kwolf@redhat.com \
    --cc=pl@kamp.de \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=y-goto@jp.fujitsu.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).