On 15 Apr 2016, at 15:10, Eric Blake <ebl...@redhat.com> wrote:

> You completely ignore NBD_CMD_FLAG_NO_HOLE; you could obey that flag
> (when set, do the calloc() here; when cleared, call into the trim code
> if you can guarantee that you'll read zero after trims).

Sadly you cannot guarantee that you will read zeroes after
exptrim is called. Exceptions include:

1. F_COPYONWRITE being set (trim is ignored)

2. The initial and final blocks if F_TREEFILES is set if either of
   the start and end of the read is not aligned to TREEPAGESIZE

3. Any underlying filesystems which don't support fallocate
   with PUNCH_HOLE (we don't check the error return)

4. Probably something on Windows (!)


> However, the client MAY set the command flag NBD_CMD_FLAG_NO_HOLEto 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.

So I could do this:

>  But if nothing
> else, you have a bug for not permitting the NBD_CMD_FLAG_NO_HOLE (even
> if you intend to ignore it by ALWAYS operating in no-hole mode, as was
> done here).

Or I could do the physical write of zeroes and then call trim afterwards
if NBD_CMD_FLAG_NO_HOLE is *not* set and trim is supported.

As fallocate() and friends are cheap, I think I will do that.

Someone should really do this properly (which is non-trivial); I was
really getting a baseline code example for the extension branch
demonstration.

--
Alex Bligh




Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Nbd-general mailing list
Nbd-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nbd-general

Reply via email to