qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/6] block: split write_zeroes always


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 2/6] block: split write_zeroes always
Date: Mon, 16 May 2016 10:13:09 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 05/14/2016 06:01 AM, Denis V. Lunev wrote:
> We should split requests even if they are less than write_zeroes_alignment.
> For example we can have the following request:
>   offset 62k
>   size   4k
>   write_zeroes_alignment 64k
> Original code will send 1 request covering 2 qcow2 clusters. One cluster
> could be zeroed as a whole, another could not be. In this case we will have
> both 2 clusters allocated.
> 
> After the patch 2 requests to qcow2 layer will be sent and thus only one
> cluster will be allocated.

Grammar suggestion:

The original code sent 1 request covering 2 qcow2 clusters, and resulted
in both clusters being allocated. But by splitting the request, we can
cater to the case where one of the two clusters can be zeroed as a
whole, for only 1 cluster allocated after the operation.

> 
> Signed-off-by: Denis V. Lunev <address@hidden>
> CC: Kevin Wolf <address@hidden>
> ---
>  block/io.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 

>                  num -= sector_num % bs->bl.write_zeroes_alignment;
> -            } else if ((sector_num + num) % bs->bl.write_zeroes_alignment != 
> 0) {
> +            } else if (num > bs->bl.write_zeroes_alignment &&
> +                    (sector_num + num) % bs->bl.write_zeroes_alignment != 0) 
> {

Alignment looks off. Also, if it were me, I'd write 'a % b' rather than
'a % b != 0'.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]