qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-block@nongnu.org, pkrempa@redhat.com, eblake@redhat.com,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC PATCH 04/10] qcow2: Pass BlockdevCreateOptions to qcow2_create2()
Date: Mon, 29 Jan 2018 19:11:36 +0100	[thread overview]
Message-ID: <38a47c05-5e24-f9e6-30fc-8b446e431588@redhat.com> (raw)
In-Reply-To: <20180129181046.GQ6141@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 2538 bytes --]

On 2018-01-29 19:10, Kevin Wolf wrote:
> Am 29.01.2018 um 18:12 hat Max Reitz geschrieben:
>> On 2018-01-11 20:52, Kevin Wolf wrote:
>>> All of the simple options are now passed to qcow2_create2() in a
>>> BlockdevCreateOptions object. Still missing: node-name and the
>>> encryption options.
>>>
>>> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
>>> ---
>>>  block/qcow2.c | 186 ++++++++++++++++++++++++++++++++++++++++++++++------------
>>>  1 file changed, 148 insertions(+), 38 deletions(-)
>>>
>>> diff --git a/block/qcow2.c b/block/qcow2.c
>>> index b02bc39a01..09e567324d 100644
>>> --- a/block/qcow2.c
>>> +++ b/block/qcow2.c
>>
>> [...]
>>
>>> @@ -2690,12 +2697,11 @@ static uint64_t qcow2_opt_get_refcount_bits_del(QemuOpts *opts, int version,
>>>      return refcount_bits;
>>>  }
>>>  
>>> -static int qcow2_create2(BlockDriverState *bs, int64_t total_size,
>>> -                         const char *backing_file, const char *backing_format,
>>> -                         int flags, size_t cluster_size, PreallocMode prealloc,
>>> -                         QemuOpts *opts, int version, int refcount_order,
>>> -                         const char *encryptfmt, Error **errp)
>>> +static int qcow2_create2(BlockDriverState *bs,
>>> +                         BlockdevCreateOptions *create_options,
>>
>> I'd personally really prefer this to be const...
>>
>>> +                         QemuOpts *opts, const char *encryptfmt, Error **errp)
>>>  {
>>> +    BlockdevCreateOptionsQcow2 *qcow2_opts;
>>>      QDict *options;
>>>  
>>>      /*
>>> @@ -2712,10 +2718,88 @@ static int qcow2_create2(BlockDriverState *bs, int64_t total_size,
>>
>> [...]
>>
>>> +
>>> +    if (!qcow2_opts->has_preallocation) {
>>> +        qcow2_opts->preallocation = PREALLOC_MODE_OFF;
>>> +    }
>>> +    if (qcow2_opts->backing_file &&
>>> +        qcow2_opts->preallocation != PREALLOC_MODE_OFF)
>>> +    {
>>> +        error_setg(errp, "Backing file and preallocation cannot be used at "
>>> +                   "the same time");
>>> +        return -EINVAL;
>>> +    }
>>> +
>>> +    if (!qcow2_opts->has_lazy_refcounts) {
>>> +        qcow2_opts->lazy_refcounts = false;
>>
>> ...because modifying some ideally QMP-provided objects just looks wrong.
> 
> Isn't this pretty standard, though? Most commands don't use boxed
> options, so there they only modify stack variables, but if you look at
> boxed ones like do_blockdev_backup() or qmp_drive_mirror(), they do the
> same.

:C


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 512 bytes --]

  reply	other threads:[~2018-01-29 18:11 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-11 19:52 [Qemu-devel] [RFC PATCH 00/10] x-blockdev-create for qcow2 Kevin Wolf
2018-01-11 19:52 ` [Qemu-devel] [RFC PATCH 01/10] block/qapi: Introduce BlockdevCreateOptions Kevin Wolf
2018-01-16 18:54   ` Eric Blake
2018-01-16 19:58     ` Kevin Wolf
2018-01-11 19:52 ` [Qemu-devel] [RFC PATCH 02/10] block/qapi: Add qcow2 create options to schema Kevin Wolf
2018-01-12 10:53   ` Daniel P. Berrange
2018-01-15 13:38     ` Kevin Wolf
2018-01-15 13:51       ` Daniel P. Berrange
2018-01-15 14:07         ` Kevin Wolf
2018-01-15 14:11           ` Daniel P. Berrange
2018-01-16 18:59   ` Eric Blake
2018-01-16 20:11     ` Kevin Wolf
2018-01-16 20:27       ` Eric Blake
2018-01-29 16:57   ` Max Reitz
2018-01-29 18:06     ` Kevin Wolf
2018-01-29 18:06       ` Max Reitz
2018-01-11 19:52 ` [Qemu-devel] [RFC PATCH 03/10] qcow2: Let qcow2_create() handle protocol layer Kevin Wolf
2018-01-16 19:03   ` Eric Blake
2018-01-11 19:52 ` [Qemu-devel] [RFC PATCH 04/10] qcow2: Pass BlockdevCreateOptions to qcow2_create2() Kevin Wolf
2018-01-16 19:21   ` Eric Blake
2018-01-29 17:12   ` Max Reitz
2018-01-29 18:10     ` Kevin Wolf
2018-01-29 18:11       ` Max Reitz [this message]
2018-01-11 19:52 ` [Qemu-devel] [RFC PATCH 05/10] qcow2: Use BlockdevRef in qcow2_create2() Kevin Wolf
2018-01-16 19:35   ` Eric Blake
2018-01-29 17:30   ` Max Reitz
2018-01-29 18:14     ` Kevin Wolf
2018-01-11 19:52 ` [Qemu-devel] [RFC PATCH 06/10] qcow2: Use QCryptoBlockCreateOptions " Kevin Wolf
2018-01-16 19:37   ` Eric Blake
2018-01-11 19:52 ` [Qemu-devel] [RFC PATCH 07/10] qcow2: Handle full/falloc preallocation " Kevin Wolf
2018-01-16 19:40   ` Eric Blake
2018-01-11 19:52 ` [Qemu-devel] [RFC PATCH 08/10] util: Add qemu_opts_to_qdict_filtered() Kevin Wolf
2018-01-16 19:45   ` Eric Blake
2018-01-11 19:52 ` [Qemu-devel] [RFC PATCH 09/10] qcow2: Use visitor for options in qcow2_create() Kevin Wolf
2018-01-16 19:59   ` Eric Blake
2018-01-11 19:52 ` [Qemu-devel] [RFC PATCH 10/10] block: x-blockdev-create QMP command Kevin Wolf
2018-01-16 20:06   ` Eric Blake
2018-01-17 17:50   ` Kevin Wolf
2018-01-11 20:40 ` [Qemu-devel] [RFC PATCH 00/10] x-blockdev-create for qcow2 no-reply
2018-01-11 20:40 ` no-reply
2018-01-16 10:23 ` Kevin Wolf
2018-01-29 18:23 ` Max Reitz

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=38a47c05-5e24-f9e6-30fc-8b446e431588@redhat.com \
    --to=mreitz@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pkrempa@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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).