[Libguestfs] [PATCH libnbd] copy: Implement destination preferred block size

Laszlo Ersek lersek at redhat.com
Tue Feb 1 07:30:49 UTC 2022


On 01/31/22 13:43, Richard W.M. Jones wrote:

> I think what we can do instead is to save the fragments, indexed by
> destination block number and offset.  It should be relatively easy to
> test when a new fragment arrives if have all of the fragments for a
> particular block, so we can then write out the whole block to the
> destination.

Yes, this is the idea that the priority queue serves so well. It's
basically "insert in the right place, pop the front".

If you know the "subrequest" size (such that all requests that need to
be queued and then coalesced for the actual output block size are a
whole multiple of the subrequest size), then a bitmap is likely the
simplest data structure.

> Particular attention also has to be paid to the final block which
> might be a short block (or can it not be?).  Also if we get to the end
> and discover we have fragments left over then it would seem to
> indicate a bug in the program.

We're not supposed to reach the final block in the queue as long as
there are gaps before it.

> I've not yet implemented any of this.  Given how much other stuff I've
> got to do it seems like RHEL 9.1 material.

I agree.

Thanks
Laszlo




More information about the Libguestfs mailing list