qemu-block
[Top][All Lists]
Advanced

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

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


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [Qemu-block] write_zeroes/trim on the whole disk
Date: Sat, 24 Sep 2016 19:44:28 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

On 24.09.2016 19:35, Alex Bligh wrote:
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.


No, holes are critical. Concreate case: incremental backup to delta file. If we write zeroes instead of holes, we will lose underlying data (from previous incremental).

--
Best regards,
Vladimir




reply via email to

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