Refactor fellow_cache_obj_lru_touch and count touches

parent 4fb3c433
......@@ -626,6 +626,7 @@ struct fellow_cache_obj {
enum fcol_state logstate;
struct fellow_cache_lru *lru;
uint64_t ntouched;
struct buddy_ptr_page fco_mem; // nil == embedded
......@@ -3486,7 +3487,7 @@ fellow_cache_obj_lru_touch(struct fellow_cache_obj *fco)
{
struct fellow_cache_lru *lru;
struct fellow_cache_seg *fcs;
int r;
int r = 0;
CHECK_OBJ_NOTNULL(fco, FELLOW_CACHE_OBJ_MAGIC);
lru = fco->lru;
......@@ -3495,11 +3496,12 @@ fellow_cache_obj_lru_touch(struct fellow_cache_obj *fco)
CHECK_OBJ_NOTNULL(fcs, FELLOW_CACHE_SEG_MAGIC);
if (! fcs->fcs_onlru)
return (0);
goto out;
r = 1;
// mutate should be failing, so it will do the lru move
if (fcs->fco_lru_mutate)
return (1);
goto out;
assert(fellow_cache_shouldlru(fcs->state, fco->oc, fcs->refcnt));
......@@ -3515,7 +3517,12 @@ fellow_cache_obj_lru_touch(struct fellow_cache_obj *fco)
//lint -e{455} flexelint does not grok trylock
AZ(pthread_mutex_unlock(&lru->lru_mtx));
return (1);
r = 1;
out:
// deliberately unlocked, not critical if update is missed
fco->ntouched++;
return (r);
}
// not unter logmtx
......@@ -6168,7 +6175,7 @@ t_cache(const char *fn, unsigned chksum)
// canary so size increase does not happen unnoticed
sz = sizeof(struct fellow_cache_obj);
assert(sz <= 328);
assert(sz <= 352);
AZ(stvfe_tune_init(tune, memsz, dsksz, objsize_hint));
tune->hash_obj = chksum;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment