[sheepdog] [PATCH v2 0/9] object cache reclaim

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Thu Jul 26 02:29:38 CEST 2012


At Wed, 25 Jul 2012 20:15:16 +0800,
levin li wrote:
> 
> From: levin li <xingke.lwp at taobao.com>
> 
> v1 ----> v2:
> 1. Merge the object tree and the dirty tree to make them share the cached entries.
> 2. remove check_cache_object_sanity()
> 3. remove the dirty flags using the bmap instead to check whether the entry is dirty.
> 
> This patchset is to reclaim the cached object when the cache size reaches
> to max size specified by use in command line, the usage is like:
> 
> #sheep/sheep -w -W 100 -d /home/levin/store/0 -p 7000 -z 0
> 
> As the example above, we specified the max cache size to 100M.
> 
> I add a object tree for each VDI to store all the cached entries, which are
> shared with the dirty tree, and a lru list implemented by rculist for cache
> scheduling, when a cached object is accessed(read or write), it's moved to
> the head of the list, and when the cache size reaches the max cache size, we
> start to reclaim the cached object and the relative cache entry to 80% of the
> max size.
> 
> Every time we create a new cached object, we create a new cache entry at the same
> time, so next time we check whether the cache is exist, we don't just goto disk
> using open(), but we find in the cached object tree to find whether the object
> is being cached.
> 
> We didn't do reclaim work in the following case:
> 1. There's already an existing reclaim work.
> 2. The object to be reclaimed is being accessed.
> 3. The cache is flushing.
> 
> levin li (9):
>   configure: add micro _LGPL_SOURCE to make sheep use liburcu
>   sheep: add cmd argument -W to specify a max cache size
>   object cache: add object cache tree for every VDI
>   object cache: merge active and inactive dirt_tree/list
>   object cache: use rwlock to replace mutex lock for per-vdi cache
>   object cache: schedule the object cache in a lru list
>   object cache: reclaim cached objects when cache reaches the max size
>   object cache: refactor object_cache_remove()
>   object cache: add a object_list for cache entry for cache deleting
> 
>  configure.ac             |    2 +-
>  include/sheepdog_proto.h |    1 +
>  sheep/object_cache.c     |  766 ++++++++++++++++++++++++++++++++++++----------
>  sheep/sheep.c            |   19 +-
>  sheep/sheep_priv.h       |    3 +
>  sheep/store.c            |    8 +
>  6 files changed, 642 insertions(+), 157 deletions(-)

Applied the first one since it is not relevant to object cache
reclaiming.  The other patches seem to need more reivews, I think.

Thanks,

Kazutaka



More information about the sheepdog mailing list