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

Re: [Nbd] write_zeroes/trim on the whole disk



On 24.09.2016 19:44, Vladimir Sementsov-Ogievskiy wrote:
On 24.09.2016 19:35, Alex Bligh wrote:
On 24 Sep 2016, at 17:20, Vladimir Sementsov-Ogievskiy <vsementsov@...2319...> 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).

hmm, no, sorry, that is not needed.

--
Best regards,
Vladimir




Reply to: