[Libguestfs] [PATCH nbdkit 2/6] checkwrite: Simplify trim/zero using nbdkit_extents_full.

Eric Blake eblake at redhat.com
Wed Feb 3 20:50:43 UTC 2021


On 1/26/21 3:51 PM, Richard W.M. Jones wrote:
> ---
>  filters/checkwrite/checkwrite.c | 96 +++++++++++++--------------------
>  1 file changed, 38 insertions(+), 58 deletions(-)
> 
> diff --git a/filters/checkwrite/checkwrite.c b/filters/checkwrite/checkwrite.c
> index 68c57c37..2792d4d8 100644
> --- a/filters/checkwrite/checkwrite.c
> +++ b/filters/checkwrite/checkwrite.c
> @@ -150,67 +150,47 @@ checkwrite_trim_zero (struct nbdkit_next_ops *next_ops, void *nxdata,
>  {
>    /* If the plugin supports extents, speed this up by using them. */
>    if (next_ops->can_extents (nxdata)) {

> +    size_t i, n;
> +    CLEANUP_EXTENTS_FREE struct nbdkit_extents *exts =
> +      nbdkit_extents_full (next_ops, nxdata, count, offset, 0, err);
> +    if (exts == NULL)
> +      return -1;

Should we instead behave like the entire region is data, instead of
reflecting back the error?

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




More information about the Libguestfs mailing list