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

Liu Yuan namei.unix at gmail.com
Thu Aug 30 14:04:16 CEST 2012


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)

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_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.

Thanks,
Yuan



More information about the sheepdog mailing list