On 05/15/2013 03:17 PM, Daniel P. Berrange wrote:
On Wed, May 15, 2013 at 02:56:03PM +0200, Paolo Bonzini wrote:
> Il 14/05/2013 14:44, Osier Yang ha scritto:
>> QEMU introduced "discard" option for drive since commit a9384aff53,
>>
>> <...>
>> @var{discard} is one of "ignore" (or "off") or
"unmap" (or "on") and
>> controls whether @dfn{discard} (also known as @dfn{trim} or @dfn{unmap})
>> requests are ignored or passed to the filesystem. Some machine types
>> may not support discard requests.
>> </...>
>>
>> This patch exposes the support in libvirt.
>>
>> QEMU supported "discard" for "-drive" since v1.5.0-rc0:
>
> I would prefer to use ignore/unmap instead of off/on in libvirt.
If we think there's any chance QEMU might gain a 3rd possible
value for this setting, then I tend to agree with you that
avoiding off/on would be desirable.
IMHO off/on is a bit more easier to understand, plus it gives us the
opportunity to shrink some of the code in the future (of course none of
this is needed neither a strong reason to use it). ignore/unmap OTOH is
what we map it to in qemu. I'd be ok with having ignore/unmap as a
alias for off/on, but that adds unnecessary code. Adding a third option
would make the off/on option a bit clumsy afterwards, but it could work
as well.
Since we can still change it, is there any other reason why we should
prefer any of those?
I agree that basing it on whether there is a possibility in qemu to add
more options is probably the best way to go.
Martin