[Libguestfs] [PATCH nbdkit] file: Implement cache=none and fadvise=normal|random|sequential.

Eric Blake eblake at redhat.com
Fri Aug 7 13:59:48 UTC 2020


On 8/7/20 8:43 AM, Nir Soffer wrote:

>>>
>>> It's also possible to avoid polluting the page cache by using
>>> O_DIRECT, but that comes with harder guarantees (aligned access
>>> through aligned buffers), so we may add it as another mode later on.
>>> But in the meantime, cache=none is fairly nice while still avoiding
>>> O_DIRECT.
>>
>> I'm not sure if or even how we could ever do a robust O_DIRECT
>>
> 
> We can let the plugin an filter deal with that. The simplest solution is to
> drop it on the user and require aligned requests.
> 
> Maybe a filter can handle alignment?

The blocksize filter seems like a good fit.  Also, I'm trying to add 
support for NBD_INFO_BLOCK_SIZE (qemu already supports it), so that we 
can advertise minimum granularity across to the client to avoid the need 
for read-modify-write in the blocksize filter.

> 
> implementation, but my idea was that it might be an alternate
>> implementation of cache=none.  But if we thought we might use O_DIRECT
>> as a separate mode, then maybe we should rename cache=none.
>> cache=advise?  cache=dontneed?  I can't think of a good name!
>>
> 
> Yes, don't call it none if you use the cache.
> 
> How about advise=?
> 
> I would keep cache semantics similar to qemu.

qemu-img has cache=, but it affects O_DIRECT rather than posix_fadvise. 
Yeah, naming is hard, and I don't know if I have better ideas.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




More information about the Libguestfs mailing list