[Top][All Lists]

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

Re: [Qemu-devel] [Nbd] [PATCH] doc: Flip bit sense for allowing trim dur

From: Eric Blake
Subject: Re: [Qemu-devel] [Nbd] [PATCH] doc: Flip bit sense for allowing trim during WRITE_ZEROES
Date: Mon, 4 Apr 2016 07:56:16 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1

On 04/01/2016 03:29 PM, Eric Blake wrote:
> Rather than requiring allocation by default and allowing trims
> only on request during WRITE_ZEROES, it seems like a better
> default is to allow server optimizations by default and require
> full allocation by specific request.  Since WRITE_ZEROES is
> experimental and has not yet been implemented, we can flip the
> sense of the command flag so that the default flags of all 0s
> is the most efficient, and flags (whether _FUA or _NO_HOLE) are
> added to make the operation have tighter constraints but
> possibly slower execution.
> The name NO_HOLE is also slightly nicer at expressing the fact
> that there is no dependency on whether NBD_CMD_TRIM is supported.

> -    If the flag `NBD_CMD_FLAG_MAY_TRIM` was set by the client in the command
> -    flags field, the server MAY use trimming to zero out the area, but it
> -    MUST ensure that the data reads back as zero.
> +    By default, the server MAY use trimming to zero out the area, even
> +    if it did not advertise `NBD_FLAG_SEND_TRIM`; but it MUST ensure
> +    that the data reads back as zero.  However, the client MAY set the
> +    command flag `NBD_CMD_FLAG_NO_HOLE` to inform the server that the
> +    area MUST be fully provisioned, ensuring that future writes to the
> +    same area will not cause fragmentation or cause failure due to
> +    insufficient space.

Question - qemu already has the notion of an nbd server that can be
configured to explicitly check for large repetitions of zero during
NBD_CMD_WRITE, and create holes in the corresponding file as a result
(basically because qemu is compensating for NBD_CMD_WRITE_ZEROES not
being part of the protocol yet, so that the destination file can still
be sparse even though lots of zeroes were sent over the wire). Should we
also allow servers to accept NBD_CMD_FLAG_NO_HOLE during NBD_CMD_WRITE
as an explicit request to NOT perform the magic of searching for large
runs of zeroes, but to just write everything as written?

For older qemu clients that are not aware of the new WRITE_ZEROES
command, the client will also not use the NO_HOLE flag for normal
writes, and everything is at the mercy of the server recognizing zeroes.
 But for newer qemu clients, it can be usefully assumed that the client
will always prefer WRITE_ZEROES (without flags) when it is okay to punch
a hole, and therefore that the new client will also send the NO_HOLE
flag to normal WRITE to inform the server that it doesn't need to waste
time searching for large runs of zeroes.

If this sounds reasonable, I'll go ahead and propose a patch.

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]