[sheepdog] [PATCH 1/3] sheep: use qemu cache option to use writeback/writethrough mode

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Thu Aug 30 16:42:18 CEST 2012


At Thu, 30 Aug 2012 20:04:16 +0800,
Liu Yuan wrote:
> 
> On 08/30/2012 05:02 PM, MORITA Kazutaka wrote:
> > When writeback is enabled, SD_FLAG_CMD_CACHE flag is set to I/O
> > requests.  This patch uses it for write mode.
> > 
> > Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
> > ---
> >  sheep/object_cache.c |   83 ++++++++++++-------------------------------------
> >  sheep/request.c      |    2 +-
> >  sheep/sheep.c        |   13 +------
> >  sheep/sheep_priv.h   |    1 -
> >  4 files changed, 24 insertions(+), 75 deletions(-)
> > 
> > diff --git a/sheep/object_cache.c b/sheep/object_cache.c
> > index a722259..431fe26 100644
> > --- a/sheep/object_cache.c
> > +++ b/sheep/object_cache.c
> > @@ -75,9 +75,6 @@ struct object_cache {
> >  	struct rb_root object_tree;
> >  
> >  	pthread_rwlock_t lock;
> > -
> > -	int (*read)(struct object_cache_entry *, void *, size_t, off_t);
> > -	int (*write)(struct object_cache_entry *, void *, size_t, off_t, int);
> >  };
> 
> So object cache was enabled unconditionally? I guess this will cause trouble for people
> don't want to enable any cache at sheepdog side at all. (object cache will take up local disk
> space)

If we don't add a '-w' option, object cache will be disabled.  Doesn't
it enough?

> 
> I am considering to change the qemu flag semantics for cache control:
> 
>  BDRV_O_NOCACHE (cache=off or none, directsync) --> no cache at all

BDRV_O_NOCACHE doesn't mean disabling a disk cache.  Note that
cache=none means (BDRV_O_NOCACHE | BDRV_O_CACHE_WB).  There is no
option to disable a disk cache in QEMU.

I agree with the option is confusing, but it looks more confusing to
use a different rule for Sheepdog to me.

>  BDRV_O_CACHE_WB (cache=writeback) --> use writeback cache (Leave user to decide object cache
> or other writeback cache in sheepdog)
>  no NOCACHE or CACHE_WB flag (default as writetrhough) --> use writethrough cache (even for writethrough
> cache, I think user should have an option to set cache size for cache reclaim)
> 
> Besides, user can have option to disable cache on sheepdog.

I wonder if there is a situation where some users want to enable a
disk cache of Sheepdog, but the others don't want to.

Thanks,

Kazutaka



More information about the sheepdog mailing list