All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: John Snow <jsnow@redhat.com>,
	qemu-block@nongnu.org, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 4/8] block/backup: hoist bitmap check into QMP interface
Date: Wed, 10 Jul 2019 22:19:41 +0200	[thread overview]
Message-ID: <837ad3c2-efe7-5937-d9ba-c1084f2c7a17@redhat.com> (raw)
In-Reply-To: <4bc49e42-2dfa-8ca9-2cb6-678962f75f0a@redhat.com>


[-- Attachment #1.1: Type: text/plain, Size: 1643 bytes --]

On 10.07.19 19:57, John Snow wrote:
> 
> 
> On 7/10/19 12:11 PM, Max Reitz wrote:
>> On 10.07.19 03:05, John Snow wrote:
>>> This is nicer to do in the unified QMP interface that we have now,
>>> because it lets us use the right terminology back at the user.
>>>
>>> Signed-off-by: John Snow <jsnow@redhat.com>
>>> ---
>>>  block/backup.c | 13 ++++---------
>>>  blockdev.c     | 10 ++++++++++
>>>  2 files changed, 14 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/block/backup.c b/block/backup.c
>>> index e2729cf6fa..a64b768e24 100644
>>> --- a/block/backup.c
>>> +++ b/block/backup.c
>>> @@ -566,6 +566,10 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
>>>      assert(bs);
>>>      assert(target);
>>>  
>>> +    /* QMP interface protects us from these cases */
>>> +    assert(sync_mode != MIRROR_SYNC_MODE_INCREMENTAL);
>>> +    assert(sync_bitmap || sync_mode != MIRROR_SYNC_MODE_BITMAP);
>>
>> Implication would be a nice operator sometimes.
>>
>> ("assert(sync_mode == MIRROR_SYNC_MODE_BITMAP -> sync_bitmap)")
>>
>> (Can you do that in C++?  No, you can’t overload bool’s operators, right?)
>>
>> Reviewed-by: Max Reitz <mreitz@redhat.com>
>>
> 
> Yes, I also find this assertion kind of hard to read personally, but it
> feels somewhat clunky to write:
> 
> if (antecedent) {
>     assert(condition);
> }
> 
> I suppose we can also phrase this as:
> 
> assert(sync_mode == MIRROR_SYNC_MODE_BITMAP ? sync_bitmap : true);
> 
> Which might honestly be pretty good. Mind if I change it to this?

Looks weird (mostly unfamiliar), but I do not.

Max


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

  reply	other threads:[~2019-07-10 20:20 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-10  1:05 [Qemu-devel] [PATCH 0/8] bitmaps: allow bitmaps to be used with full and top John Snow
2019-07-10  1:05 ` [Qemu-devel] [PATCH 1/8] iotests/257: add Pattern class John Snow
2019-07-10 15:10   ` Max Reitz
2019-07-10 16:26   ` Max Reitz
2019-07-10 17:34     ` John Snow
2019-07-10  1:05 ` [Qemu-devel] [PATCH 2/8] iotests/257: add EmulatedBitmap class John Snow
2019-07-10 15:47   ` Max Reitz
2019-07-10 17:36     ` John Snow
2019-07-10  1:05 ` [Qemu-devel] [PATCH 3/8] iotests/257: Refactor backup helpers John Snow
2019-07-10 16:04   ` Max Reitz
2019-07-10 17:52     ` John Snow
2019-07-10 20:17       ` Max Reitz
2019-07-10  1:05 ` [Qemu-devel] [PATCH 4/8] block/backup: hoist bitmap check into QMP interface John Snow
2019-07-10 16:11   ` Max Reitz
2019-07-10 17:57     ` John Snow
2019-07-10 20:19       ` Max Reitz [this message]
2019-07-10  1:05 ` [Qemu-devel] [PATCH 5/8] iotests/257: test API failures John Snow
2019-07-10 16:22   ` Max Reitz
2019-07-10 18:00     ` John Snow
2019-07-10  1:05 ` [Qemu-devel] [PATCH 6/8] block/backup: issue progress updates for skipped regions John Snow
2019-07-10 16:36   ` Max Reitz
2019-07-10 18:20     ` John Snow
2019-07-10 20:30       ` Max Reitz
2019-07-10 20:47         ` John Snow
2019-07-10 20:53           ` Max Reitz
2019-07-10  1:05 ` [Qemu-devel] [PATCH 7/8] block/backup: support bitmap sync modes for non-bitmap backups John Snow
2019-07-10 16:48   ` Max Reitz
2019-07-10 18:32     ` John Snow
2019-07-10 20:39       ` Max Reitz
2019-07-10  1:05 ` [Qemu-devel] [PATCH 8/8] iotests/257: test traditional sync modes John Snow
2019-07-10 17:14   ` Max Reitz
2019-07-10 19:00     ` John Snow
2019-07-10 20:46       ` Max Reitz
     [not found]         ` <2f221513-f173-8d9f-a3b2-d790ef6f6f51@redhat.com>
2019-07-11 12:37           ` Max Reitz
2019-07-11 17:58             ` John Snow

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=837ad3c2-efe7-5937-d9ba-c1084f2c7a17@redhat.com \
    --to=mreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.