On 13.10.2016 18:48, Vladimir Sementsov-Ogievskiy wrote:
> On 07.10.2016 22:24, Max Reitz wrote:
>> On 30.09.2016 12:53, Vladimir Sementsov-Ogievskiy wrote:
>>> Realize block bitmap stroing interface, to allow qcow2 images store
> 
> [snip]
> 
>>> +        uint64_t end = MIN(bm_size, sector + dsc);
>>> +        uint64_t write_size =
>>> +            bdrv_dirty_bitmap_serialization_size(bitmap, sector, end
>>> - sector);
>>> +
>>> +        int64_t off = qcow2_alloc_clusters(bs, cl_size);
>>> +        if (off < 0) {
>>> +            ret = off;
>>> +            goto finish;
>>> +        }
>>> +        bitmap_table[cluster] = off;
>>> +
>>> +        bdrv_dirty_bitmap_serialize_part(bitmap, buf, sector, end);
>> s/end/end - sector/?
> 
> o_0 terrible mistake, thank you.
> 
>>
>>> +        if (write_size < cl_size) {
>>> +            memset(buf + write_size, 0, cl_size - write_size);
>>> +        }
>>> +
>> I guess there should be a metadata overlap check here.
> 
> What is the general rule of checking it? Should I check it before all my
> extension related writes?

The general rule is supposed to be "One check before every write to
bs->file".

Max

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to