qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 08/10] qcow2: Allow updating no refcounts


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH 08/10] qcow2: Allow updating no refcounts
Date: Wed, 20 Jan 2010 10:55:54 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091209 Fedora/3.0-4.fc12 Thunderbird/3.0

Am 19.01.2010 19:53, schrieb Christoph Hellwig:
>>  #endif
>> -    if (length <= 0)
>> +    if (length < 0) {
>>          return -EINVAL;
>> +    }
>> +
>>      start = offset & ~(s->cluster_size - 1);
>>      last = (offset + length - 1) & ~(s->cluster_size - 1);
>>      for(cluster_offset = start; cluster_offset <= last;
> 
> So for legnth = 0, last will equal start and we'll never go through
> the loop.  But should we really bother with all the other work in the
> function or just return 0 early on?

I'm not a big fan of special-casing for no real reason ("all the other
work" basically is calculating start and last and skipping two ifs - and
length = 0 is an unusual case anyway), but if you really mind we can
change it.

Kevin




reply via email to

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