<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Fri, Mar 9, 2018 at 4:25 PM Richard W.M. Jones <<a href="mailto:rjones@redhat.com">rjones@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It has to be said it would be really convenient to have a 'zero'<br>
and/or 'trim' method of some sort.<br></blockquote><div><br></div><div>'trim' means discard?</div><div><br></div><div>Currently we cannot support discard on block storage since ovirt may need to wipe</div><div>lvs when deleting a disk, and discarding may leave unwiped user data. This may</div><div>change in 4.3 if we switch to wipe on creation instead of wipe after delete.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
qemu-img tries hard to trim the whole disk before using it.<br>
Unfortunately it does this in different ways across RHEL 7 and<br>
upstream.  With upstream I managed a workaround based on ignoring any<br>
zero requests which arrive before the first write.  However it's not<br>
so easy to do this for RHEL 7's qemu which is issuing mixed writes and<br>
zeroes in different orders.<br>
<br>
How hard would it be to implement a special https request in imageio<br>
for zeroing (better still, either zeroing or trimming) a range of<br>
bytes?<br></blockquote><div><br></div><div>Supporting efficient zero makes sense. We plan to support it via a special</div><div>sparse format, see:</div><div><a href="https://gerrit.ovirt.org/#/c/85413/">https://gerrit.ovirt.org/#/c/85413/</a><br></div><div><br></div><div>We have a demo here:</div><div><a href="https://gerrit.ovirt.org/#/c/85468/">https://gerrit.ovirt.org/#/c/85468/</a><br></div><div><br></div><div>This will not help you use case when you want to mix read/write/zero requests,</div><div>but we can use the same infrastructure. We plan to use fallocate for file based</div><div>storage:</div><div><a href="https://gerrit.ovirt.org/#/c/85512/">https://gerrit.ovirt.org/#/c/85512/</a><br></div><div>and BLKZEROOUT for block storage:</div><div><a href="https://gerrit.ovirt.org/#/c/85537/">https://gerrit.ovirt.org/#/c/85537/</a><br></div><div>and some dumb zero loop if these options are not available.</div><div><br></div><div>So we need to map the zero operation to http - how about:</div><div><br></div><div>POST /images/ticket-id ...</div><div>...</div><div>{</div><div>    "op": "zero",</div><div>    "offset": X,</div><div>    "size": Y</div><div>}</div><div><br></div><div>I would like to support only aligned offset and size - do you think it should work</div><div>for qemu-img?</div><div><br></div><div>Adding this with dumb zero loop can be done quickly. We can make it more</div><div>efficient later.</div><div><br></div><div>Nir</div></div></div>