[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH v2 5/6] nbd: Merge nbd_export_bitmap into nbd_ex

From: Eric Blake
Subject: Re: [Qemu-block] [PATCH v2 5/6] nbd: Merge nbd_export_bitmap into nbd_export_new
Date: Thu, 10 Jan 2019 08:48:21 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1

On 1/10/19 6:25 AM, Vladimir Sementsov-Ogievskiy wrote:
> 10.01.2019 10:13, Eric Blake wrote:
>> We only have one caller that wants to export a bitmap name,
>> which it does right after creation of the export. But there is
>> still a brief window of time where an NBD client could see the
>> export but not the dirty bitmap, which a robust client would
>> have to interpret as meaning the entire image should be treated
>> as dirty.  Better is to eliminate the window entirely, by
>> inlining nbd_export_bitmap() into nbd_export_new(), and refusing
>> to create the bitmap in the first place if the requested bitmap
>> can't be located.
>> We also no longer need logic for setting a different bitmap
>> name compared to the bitmap being exported.

>> +++ b/blockdev-nbd.c
>> @@ -175,7 +175,7 @@ void qmp_nbd_server_add(const char *device, bool 
>> has_name, const char *name,
>>           writable = false;
>>       }
>> -    exp = nbd_export_new(bs, 0, -1, name, NULL,
>> +    exp = nbd_export_new(bs, 0, -1, name, NULL, bitmap,
> bitmap is guaranteed to be NULL if has_bitmap is false? Or should we do 
> has_bitmap ? bitmap : NULL?

We fixed our QAPI generators to guarantee that has_foo = false implies
foo == NULL, several years ago.  If you populate a QAPI struct by hand
instead of via the generated visitors, you should use g_malloc0() to
match the same guarantees.  So I don't need the ?:.

> if yes or with fixed:
> Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>

Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]