On Tue 01 Aug 2017 04:19:00 PM CEST, Anton Nefedov wrote:
> The flag is supposed to indicate that the region of the disk image has
> to be sufficiently allocated so it reads as zeroes. The call with the flag
> set has to return -ENOTSUP if allocation cannot be done efficiently
> (i.e. without falling back to writing actual buffers)
>
> Signed-off-by: Anton Nefedov <anton.nefe...@virtuozzo.com>

Reviewed-by: Alberto Garcia <be...@igalia.com>

> +    /* allocation request with qiov provided doesn't make much sense */
> +    assert(!(qiov && flags & BDRV_REQ_ALLOCATE));

> +    assert(!(flags & BDRV_REQ_MAY_UNMAP && flags & BDRV_REQ_ALLOCATE));
> +
> +    if (flags & BDRV_REQ_ALLOCATE &&
> +        !(child->bs->supported_zero_flags & BDRV_REQ_ALLOCATE))

I find it more readable with parentheses like this:

  assert(!(qiov && (flags & BDRV_REQ_ALLOCATE)));
  assert(!((flags & BDRV_REQ_MAY_UNMAP) && (flags & BDRV_REQ_ALLOCATE)));
  if ((flags & BDRV_REQ_ALLOCATE) &&
      !(child->bs->supported_zero_flags & BDRV_REQ_ALLOCATE))

but your code is correct as it is.

Berto

Reply via email to