noop refactor: fcs eviction with/without lru

parent d52435a7
...@@ -2504,18 +2504,27 @@ fellow_cache_async_thread(void *priv) ...@@ -2504,18 +2504,27 @@ fellow_cache_async_thread(void *priv)
// XXX better way // XXX better way
#ifndef TEST_DRIVER #ifndef TEST_DRIVER
static inline void static inline void
fellow_cache_seg_evict_locked(struct fellow_cache *fc, fellow_cache_seg_evict_locked(
struct fellow_cache_seg *fcs, struct buddy_ptr_extent *alloc) struct fellow_cache_seg *fcs, struct buddy_ptr_extent *alloc)
{ {
AZ(fcs->refcnt); AZ(fcs->refcnt);
AN(fcs->fcs_onlru); AZ(fcs->fcs_onlru);
assert(fcs->state == FCS_INCORE); assert(fcs->state == FCS_INCORE);
*alloc = fcs->alloc; *alloc = fcs->alloc;
fcs->alloc = buddy_ptr_extent_nil; fcs->alloc = buddy_ptr_extent_nil;
fcs->len = 0; fcs->len = 0;
fcs->state = FCS_DISK; fcs->state = FCS_DISK;
}
static inline void
fellow_cache_lru_seg_evict_locked(
struct fellow_cache_seg *fcs, struct buddy_ptr_extent *alloc,
struct fellow_cache *fc)
{
AN(fcs->fcs_onlru);
fcs->fcs_onlru = 0; fcs->fcs_onlru = 0;
VTAILQ_REMOVE(&fc->lru_head, fcs, lru_list); VTAILQ_REMOVE(&fc->lru_head, fcs, lru_list);
fellow_cache_seg_evict_locked(fcs, alloc);
} }
static int static int
...@@ -2546,8 +2555,8 @@ fellow_cache_lru_work(struct worker *wrk, struct fellow_cache *fc) ...@@ -2546,8 +2555,8 @@ fellow_cache_lru_work(struct worker *wrk, struct fellow_cache *fc)
continue; continue;
} }
if (fcs->state == FCS_INCORE) { if (fcs->state == FCS_INCORE) {
fellow_cache_seg_evict_locked(fc, fcs, fellow_cache_lru_seg_evict_locked(fcs,
&alloc); &alloc, fc);
AZ(pthread_mutex_unlock(&fco->mtx)); AZ(pthread_mutex_unlock(&fco->mtx));
fco = NULL; fco = NULL;
break; break;
...@@ -2648,7 +2657,7 @@ fellow_cache_lru_thread(struct worker *wrk, void *priv) ...@@ -2648,7 +2657,7 @@ fellow_cache_lru_thread(struct worker *wrk, void *priv)
buddy = fc->membuddy; buddy = fc->membuddy;
CHECK_OBJ(buddy, BUDDY_MAGIC); CHECK_OBJ(buddy, BUDDY_MAGIC);
// fellow_cache_seg_evict_locked() // fellow_cache_lru_seg_evict_locked()
assert_fcos_transition(FCS_INCORE, FCS_DISK); assert_fcos_transition(FCS_INCORE, FCS_DISK);
reqs = BUDDY_REQS_STK(buddy, BUDDY_REQS_MAX); reqs = BUDDY_REQS_STK(buddy, BUDDY_REQS_MAX);
......
...@@ -381,6 +381,13 @@ sfemem_objslim(struct worker *wrk, struct objcore *memoc) ...@@ -381,6 +381,13 @@ sfemem_objslim(struct worker *wrk, struct objcore *memoc)
mutate_to_sfeexp(memoc, xid); mutate_to_sfeexp(memoc, xid);
return; return;
} }
/*
* for calls from HSH_Cancel, we could write a new disk object with no
* body. For now, just free any body segments cached in memory
*/
} }
static void v_matchproto_(objfree_f) static void v_matchproto_(objfree_f)
......
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