[sheepdog] [PATCH] disk cache: drop O_DSYNC only when O_DIRECT is set

Liu Yuan namei.unix at gmail.com
Tue Oct 30 12:26:59 CET 2012


On 10/30/2012 07:16 PM, MORITA Kazutaka wrote:
>> > On 10/30/2012 08:49 AM, MORITA Kazutaka wrote:
>>> > > At Thu, 25 Oct 2012 13:52:01 +0900,
>>> > > MORITA Kazutaka wrote:
>>>> > >>
>>>> > >> To make sure that data is not cached by the host os, we cannot drop
>>>> > >> O_DSYNC when O_DIRECT is not set.
>>>> > >>
>> > 
>> > Why data are cached in page cache a problem? We do sync(2) it afterwards.
> For users who run VMs on storage nodes, more memory should be used for
> guest OSes.  It's inefficient to cache data in both host and guest
> page caches.
> 

Generally speaking, I think it is okay to let kernel decide. When VM
gets started, it will get fixed memory. This guest memory is virtual
memory on host, which is allocated on demand. Once the mapping is
created, VM will *never* release those memory page frame. So I think we
can make best of memory without O_DIRECT, though sometimes we might
duplicate data both in host memory and guest memory.

As for sheepdog, currently we always use O_DIRECT with data objects, so
we don't have this kind of duplicate problem at all.As you mentioned, we
only drop O_DIRECT for inode object, which never have a chance to be
cached in Guest memory. No?

Thanks,
Yuan



More information about the sheepdog mailing list