[Libguestfs] [libnbd PATCH v3 3/5] python: Accept all buffer-like objects in aio_p{read, write}

Eric Blake eblake at redhat.com
Thu Jun 9 16:31:39 UTC 2022


On Thu, Jun 09, 2022 at 03:31:02PM +0100, Richard W.M. Jones wrote:
> On Thu, Jun 09, 2022 at 08:34:45AM -0500, Eric Blake wrote:
> > After the work in the previous patches, it is now a trivial feature
> > addition to support any buffer-like object as the argument to
> > h.aio_{pread,pwrite}, and matching how h.pwrite already did that.  For
> > example, you can do h.aio_pwrite(b'123', 0), instead of having to copy
> > into nbd.Buffer first.  More importantly, whereas
> > nbd.Buffer.to_bytearray() currently copies out and
> > nbd.Buffer.from_bytearray(buffer) copies in, using native types means
> > you can reduce that copy overhead.
> > 
> > For a demonstration of the speedups possible, compare two scripts that
> > utilize a new buffer for every I/O (important if you are going to do
> > parallel operations - even though this demo is serialized), one using
> > nbd.Buffer, the other using native python types, with timing on my
> > machine:
> > 
> > $ export script1='

> > 
> > $ nbdkit -U - --filter=checkwrite pattern 10G \
> >   --run 'nbdsh -u "$uri" -c "h.set_pread_initialize(True)" -c "script1"'
> 
> Should that be "$script1" ?  (and same below)

Yep. Serves me right for copy-pasting the wrong line.

> 
> Acked-by: Richard W.M. Jones <rjones at redhat.com>

Thanks for looking at this series; I can see from the difference
between Acked-by and Reviewed-by that it gets pretty technical ;)

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


More information about the Libguestfs mailing list