|
From: | Alberto Garcia |
Subject: | Re: [Qemu-block] [PATCH v4 03/15] block: introduce BDRV_REQ_ALLOCATE flag |
Date: | Tue, 29 Aug 2017 14:47:53 +0200 |
User-agent: | Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) |
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 <address@hidden> Reviewed-by: Alberto Garcia <address@hidden> > + /* 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
[Prev in Thread] | Current Thread | [Next in Thread] |