[Libguestfs] [libnbd PATCH] api: Speed up nbd_pread_structured when reading holes
Eric Blake
eblake at redhat.com
Tue May 31 11:38:55 UTC 2022
On Sat, May 28, 2022 at 06:18:27PM +0100, Richard W.M. Jones wrote:
> On Fri, May 27, 2022 at 05:25:43PM -0500, Eric Blake wrote:
> > Commit c7fbc71d missed an optimization: when we guarantee that a pread
> > buffer is pre-zeroed, we don't need to waste time memset()ing it when
> > the server sends a hole. But the next commit e0953cb7 lets the user
> > skip pre-zeroing, at which point the memset is required to avoid data
> > corruption. Thankfully, we are not leaking bogus bytes when a server
> > sends a hole, but we CAN speed up the case where we have pre-zeroed
> > the buffer to avoid a second memset(). Because the user can change
> > the state of pread_initialize on the fly (including while a pread is
> > still in flight), we must track the state per-command as it was before
> > we send the request to the server.
> > ---
>
> Reviewed-by: Richard W.M. Jones <rjones at redhat.com>
Thanks; now in as 56d083b885
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
More information about the Libguestfs
mailing list