[Libguestfs] [PATCH libnbd v3 2/3] copy: Use preferred block size for copying
Richard W.M. Jones
rjones at redhat.com
Thu Jun 30 16:34:51 UTC 2022
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.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
More information about the Libguestfs
mailing list