qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] write_zeroes/trim on the whole disk


From: Alex Bligh
Subject: Re: [Qemu-devel] write_zeroes/trim on the whole disk
Date: Sat, 24 Sep 2016 17:35:21 +0100

> On 24 Sep 2016, at 17:20, Vladimir Sementsov-Ogievskiy <address@hidden> wrote:
> 
> Also, accordingly to documentation, NBD_CMD_TRIM is not appropriate for disk 
> clearing:
> 
>  * `NBD_CMD_TRIM` (4)
> 
>      A hint to the server that the data defined by len and offset is no
>      longer needed. A server MAY discard len bytes starting at offset, but
>      is not required to.
> 
>      After issuing this command, a client MUST NOT make any assumptions
>      about the contents of the export affected by this command, until
>      overwriting it again with `NBD_CMD_WRITE`.
> 
> - it may do nothing.. So, what to do with this? add flag FORCE_TRIM for this 
> command? Or add FORCE_HOLES flag to WRITE_ZEROES?

You cannot force a hole, because NBD the is not guaranteed to support holes.

Use NBD_CMD_WRITE_ZEROES without NBD_CMD_FLAG_NO_HOLE and you can pretty much 
assume that a server that supports holes will write holes. A server that does 
not support holes will write zeroes. If you don't care whether the resultant 
data is zero, just use NBD_CMD_TRIM. But as you do care (see above) you must be 
prepared for a 'thick' write of zeroes on servers that don't support it.

-- 
Alex Bligh







reply via email to

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