22 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_STOB 38 so_cache_linkage, so_cache_magic,
47 .sc_idle_size = idle_size,
49 .sc_eviction_cb = eviction_cb,
56 stob_cache_tlist_init(&
cache->sc_busy);
57 stob_cache_tlist_init(&
cache->sc_idle);
75 stob_cache_tlist_fini(&
cache->sc_idle);
76 stob_cache_tlist_fini(&
cache->sc_busy);
86 cache->sc_idle_used));
94 ++
cache->sc_evictions;
102 stob_cache_tlink_del_fini(
stob);
103 --
cache->sc_idle_used;
111 stob_cache_tlist_move(&
cache->sc_idle,
stob);
112 ++
cache->sc_idle_used;
113 if (
cache->sc_idle_used >
cache->sc_idle_size) {
114 evicted = stob_cache_tlist_tail(&
cache->sc_idle);
126 stob_cache_tlink_init_at(
stob, &
cache->sc_busy);
138 const struct m0_fid *stob_fid)
146 ++
cache->sc_busy_hits;
153 ++
cache->sc_idle_hits;
155 stob_cache_tlink_init_at(
stob, &
cache->sc_busy);
173 stob = stob_cache_tlist_tail(&
cache->sc_idle);
175 prev = stob_cache_tlist_prev(&
cache->sc_idle,
stob);
207 #define LEVEL M0_DEBUG 212 "sc_busy_hits = %" PRIu64 ", sc_idle_hits = %" PRIu64 ", " 217 "sc_idle_size = %" PRIu64 ", sc_idle_used = %" PRIu64 ", ",
220 "sc_busy length = %zu, sc_idle length = %zu",
cache,
221 stob_cache_tlist_length(&
cache->sc_busy),
222 stob_cache_tlist_length(&
cache->sc_idle));
245 #undef M0_TRACE_SUBSYSTEM
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
static void stob_cache_idle_moveto(struct m0_stob_cache *cache, struct m0_stob *stob)
M0_INTERNAL void m0_stob_cache_add(struct m0_stob_cache *cache, struct m0_stob *stob)
#define M0_LOG(level,...)
M0_INTERNAL bool m0_mutex_is_not_locked(const struct m0_mutex *mutex)
M0_INTERNAL const struct m0_fid * m0_stob_fid_get(struct m0_stob *stob)
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
M0_INTERNAL int m0_fid_cmp(const struct m0_fid *fid0, const struct m0_fid *fid1)
M0_INTERNAL int m0_stob_cache_init(struct m0_stob_cache *cache, uint64_t idle_size, m0_stob_cache_eviction_cb_t eviction_cb)
#define M0_CHECK_EX(cond)
M0_TL_DEFINE(m0_conf_cache, M0_INTERNAL, struct m0_conf_obj)
static struct m0_stob * stob
M0_INTERNAL bool m0_mutex_is_locked(const struct m0_mutex *mutex)
M0_INTERNAL void m0_stob_cache_lock(struct m0_stob_cache *cache)
M0_TL_DESCR_DEFINE(m0_conf_cache, "registered m0_conf_obj-s",, struct m0_conf_obj, co_cache_link, co_gen_magic, M0_CONF_OBJ_MAGIC, M0_CONF_CACHE_MAGIC)
M0_INTERNAL void m0_stob_cache_fini(struct m0_stob_cache *cache)
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
M0_INTERNAL void m0_stob_cache_unlock(struct m0_stob_cache *cache)
M0_INTERNAL void m0_stob_cache_purge(struct m0_stob_cache *cache, int nr)
M0_INTERNAL bool m0_stob_cache_is_locked(const struct m0_stob_cache *cache)
M0_INTERNAL bool m0_stob_cache__invariant(const struct m0_stob_cache *cache)
static void stob_cache_idle_del(struct m0_stob_cache *cache, struct m0_stob *stob)
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
static void stob_cache_evict(struct m0_stob_cache *cache, struct m0_stob *stob)
void(* m0_stob_cache_eviction_cb_t)(struct m0_stob_cache *cache, struct m0_stob *stob)
M0_INTERNAL bool m0_stob_cache_is_not_locked(const struct m0_stob_cache *cache)
M0_INTERNAL void m0_stob_cache__print(struct m0_stob_cache *cache)
M0_INTERNAL struct m0_stob * m0_stob_cache_lookup(struct m0_stob_cache *cache, const struct m0_fid *stob_fid)
#define m0_tl_for(name, head, obj)
M0_INTERNAL void m0_stob_cache_idle(struct m0_stob_cache *cache, struct m0_stob *stob)