[Sheepdog] [PATCH v2] sheepdog: implement SD_OP_FLUSH_VDI operation

Liu Yuan namei.unix at gmail.com
Sat Mar 31 05:48:07 CEST 2012


On 03/31/2012 12:17 AM, MORITA Kazutaka wrote:

> It might be better to ignore BDRV_O_NOCACHE here because:
> 
>  - When writeback is enabled, we always use a cache.  And when
>    writeback is disabled, we don't use a cache at all.  This means
>    that users cannot specify whether to use a cache.
> 
>  - I think qemu users expect a better performance if cache=none, which
>    means BDRV_O_NOCACHE | BDRV_O_CACHE_WB, is specified
> 


I have to admit that this is my first time understanding that
cache=none, means a cache with DIO mode.

So my question is what is a cache with DIO mode?

I gave a gimps over the code

    /* Use O_DSYNC for write-through caching, no flags for write-back
caching,
     * and O_DIRECT for no caching. */
    if ((bdrv_flags & BDRV_O_NOCACHE))
        s->open_flags |= O_DIRECT;
    if (!(bdrv_flags & BDRV_O_CACHE_WB))
        s->open_flags |= O_DSYNC;

For BDRV_O_NOCACHE, it means no need of kernel's page cache. I don't
think there is any 'writeback' cache existing with cache=none mode, so
'better performance' doesn't make sense if we have extra memory in host
that can be used as page cache.

Further more, so for users, if setting cache=none or cache=off(yes, code
tells me that we can pass 'off' to qemu', means our object cache is
enabled ! Do you ever expect this behaviour as a ordinary user ?

I don't think QEMU's cache mode is well received, especially cache=none
means 'DRV_O_NOCACHE | BDRV_O_CACHE_WB'. what does it mean literally?
Hmm, do not gimme a cache but a writeback cache please?

>  - I guess qemu users expect that if BDRV_O_NOCACHE is set, O_DIRECT
>    is used for file I/Os.
> 
>  - If we ignore BDRV_O_NOCACHE here, we can use qemu-iotests for
>    Sheepdog cache tests with the following command:
> 
>      $ check -sheepdog -nocache
> 
>    where -nocache means BDRV_O_NOCACHE | BDRV_O_CACHE_WB.
> 


I am confused by 'ignoring DRV_O_NOCACHE'. Actually, I don't care qemu's
flags about cache mode. All I want is, a control with binary semantics
that can disable/enable object cache in sheepdog.

Any better scheme?
currently, cache=writeback enables it, and others disables it.

Thanks,
Yuan



More information about the sheepdog mailing list