fellow_cache: use buddy_returns in fellow_cache_obj_get

parent 8a3f2a50
...@@ -5389,6 +5389,8 @@ struct objcore **ocp, uintptr_t priv2, unsigned crit) ...@@ -5389,6 +5389,8 @@ struct objcore **ocp, uintptr_t priv2, unsigned crit)
CHECK_OBJ_NOTNULL(fc, FELLOW_CACHE_MAGIC); CHECK_OBJ_NOTNULL(fc, FELLOW_CACHE_MAGIC);
fdba.fdb = priv2; fdba.fdb = priv2;
struct buddy_returns *rets = BUDDY_RETURNS_STK(fc->membuddy, 2);
/* /*
* init a new object, then insert it atomically * init a new object, then insert it atomically
* *
...@@ -5539,7 +5541,7 @@ struct objcore **ocp, uintptr_t priv2, unsigned crit) ...@@ -5539,7 +5541,7 @@ struct objcore **ocp, uintptr_t priv2, unsigned crit)
memcpy(ptr, fdo, sz); memcpy(ptr, fdo, sz);
fdo = fcs->u.fco_fdo = (void *)ptr; fdo = fcs->u.fco_fdo = (void *)ptr;
buddy_return1_ptr_extent(fc->membuddy, &fcs->alloc); AN(buddy_return_ptr_extent(rets, &fcs->alloc));
} }
else else
fdo = fellow_disk_obj_trim(fc, fcs); fdo = fellow_disk_obj_trim(fc, fcs);
...@@ -5583,8 +5585,9 @@ struct objcore **ocp, uintptr_t priv2, unsigned crit) ...@@ -5583,8 +5585,9 @@ struct objcore **ocp, uintptr_t priv2, unsigned crit)
AZ(pthread_mutex_unlock(&fco->mtx)); AZ(pthread_mutex_unlock(&fco->mtx));
if (dowry.bits) if (dowry.bits)
buddy_return1_ptr_page(fc->membuddy, &dowry); AN(buddy_return_ptr_page(rets, &dowry));
fellow_cache_obj_trim(fc, fco); fellow_cache_obj_trim(fc, fco);
buddy_return(rets);
return (FCR_OK(fco)); return (FCR_OK(fco));
err: err:
if (ocp) { if (ocp) {
...@@ -5600,12 +5603,13 @@ struct objcore **ocp, uintptr_t priv2, unsigned crit) ...@@ -5600,12 +5603,13 @@ struct objcore **ocp, uintptr_t priv2, unsigned crit)
fellow_cache_obj_deref(fc, fco); fellow_cache_obj_deref(fc, fco);
if (fcsl_mem.ptr) if (fcsl_mem.ptr)
buddy_return1_ptr_extent(fc->membuddy, &fcsl_mem); AN(buddy_return_ptr_extent(rets, &fcsl_mem));
if (strstr(err, "alloc")) if (strstr(err, "alloc"))
fcr = FCR_ALLOCERR(err); fcr = FCR_ALLOCERR(err);
else else
fcr = FCR_IOERR(err); fcr = FCR_IOERR(err);
fellow_cache_res_check(fc, fcr); fellow_cache_res_check(fc, fcr);
buddy_return(rets);
return (fcr); return (fcr);
} }
......
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