[Libguestfs] [PATCH libnbd v3 2/3] copy: Use preferred block size for copying

Laszlo Ersek lersek at redhat.com
Fri Jul 1 09:01:22 UTC 2022


On 06/30/22 18:34, Richard W.M. Jones wrote:
> On Thu, Jun 30, 2022 at 05:38:14PM +0200, Laszlo Ersek wrote:
>>> +static bool
>>> +only_zeroes (const extent_list exts, size_t *i,
> [...]
>>> +
>>> +    if (start >= offset + len)
>>> +      break;
>>> +
>>
>> (13) I think we can insert a micro-optimization here:
>>
>>     *i = j;
> [...]
>> The loop at the start of the function is correct, but here we can save
>> some work for its next execution (in the next invocation of this function).
> 
> Just a note that I didn't do this optimization.
> 
> The reason is that it breaks the ability (which we don't use) of
> calling only_zeroes twice on the same offset.  I just feel that it
> might cause unexpected results if someone hoisted out the only_zeroes
> call into a debug printf or similar.
> 
> I made the rest of the suggested changes, except for splitting out the
> test into another commit - we surely want to keep the test with the
> change that is being tested.

Sounds good, thank you.
Laszlo


More information about the Libguestfs mailing list