qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [Qemu-devel] [PULL 19/20] nbd: Merge nbd_export_bitmap


From: Eric Blake
Subject: Re: [Qemu-block] [Qemu-devel] [PULL 19/20] nbd: Merge nbd_export_bitmap into nbd_export_new
Date: Thu, 7 Feb 2019 13:00:53 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

On 2/7/19 12:40 PM, Peter Maydell wrote:

> 
>>  NBDExport *nbd_export_new(BlockDriverState *bs, off_t dev_offset, off_t 
>> size,
>>                            const char *name, const char *description,
>> -                          uint16_t nbdflags, void (*close)(NBDExport *),
>> -                          bool writethrough, BlockBackend *on_eject_blk,
>> -                          Error **errp)
>> +                          const char *bitmap, uint16_t nbdflags,
>> +                          void (*close)(NBDExport *), bool writethrough,
>> +                          BlockBackend *on_eject_blk, Error **errp)
>>  {
>>      AioContext *ctx;
>>      BlockBackend *blk;
>> @@ -1507,6 +1507,43 @@ NBDExport *nbd_export_new(BlockDriverState *bs, off_t 
>> dev_offset, off_t size,
>>      }
>>      exp->size -= exp->size % BDRV_SECTOR_SIZE;
>>
>> +    if (bitmap) {
>> +        BdrvDirtyBitmap *bm = NULL;
>> +        BlockDriverState *bs = blk_bs(blk);
> 
> lgtm.com points out that this local variable 'bs' shadows
> the 'bs' argument to the function. Is this intentional?

No, I will fix.

> I think that the two can't ever be different, in which case
> you could just delete the variable declaration here, but
> I'm not an expert on the block layer APIs.

Yes, that looks right to me as well, since we just barely called
blk_insert_bs(blk, bs, errp) a few lines above.  (Someday, it would be
nice to turn -Wshadow on, to catch stuff like this sooner)

-- 
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]