On Sun, Mar 06, 2022 at 10:27:29PM +0200, Nir Soffer wrote:
> This safety feature is not needed since we handle pread errors, and even
> if we did not, we use initialized buffers. Testing shows 10% speedup
> when copying a real image.
> 

> +++ b/examples/copy-libev.c
> @@ -647,20 +647,26 @@ main (int argc, char *argv[])
>  
>      size = nbd_get_size (src.nbd);
>  
>      if (size > nbd_get_size (dst.nbd))
>          FAIL ("Destinatio is not large enough\n");
>  
>      /* Check destination server capabilities. */
>  
>      dst.can_zero = nbd_can_zero (dst.nbd) > 0;
>  
> +    /* Disable pread buffer initialization. This is not needed since we
> +     * handle pread errors, and even if we fail to handle errors, we use
> +     * initialized buffers. */
> +
> +    nbd_set_pread_initialize (src.nbd, false);

As an example program, we should probably demonstrate checking whether
this function call failed (even though such failure is unlikely).

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
_______________________________________________
Libguestfs mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/libguestfs

Reply via email to