fellow_cache: Trim the FCO also after embedding

parent 79422fd9
......@@ -2969,8 +2969,6 @@ fellow_cache_obj_trim(const struct fellow_cache *fc,
CHECK_OBJ_NOTNULL(fco, FELLOW_CACHE_OBJ_MAGIC);
// no trim if fdo is embedded - XXX cleaner way?
if (FCO_FCS(fco)->alloc.ptr == NULL)
return;
assert(FCO_FDO(fco) == FCO_FCS(fco)->alloc.ptr);
fcsl = &fco->fcsl_embed;
......@@ -5383,7 +5381,7 @@ struct objcore **ocp, uintptr_t priv2, unsigned crit)
unsigned oref = 0;
const char *err;
char *ptr;
size_t spc, sz;
size_t spc, sz, nsz;
int r;
CHECK_OBJ_NOTNULL(fc, FELLOW_CACHE_MAGIC);
......@@ -5531,6 +5529,7 @@ struct objcore **ocp, uintptr_t priv2, unsigned crit)
assert(sz <= fco->fco_mem.size);
ptr = (char *)fco + sz;
assert(PAOK(ptr));
nsz = sz;
spc = fco->fco_mem.size - sz;
......@@ -5542,10 +5541,13 @@ struct objcore **ocp, uintptr_t priv2, unsigned crit)
fdo = fcs->u.fco_fdo = (void *)ptr;
AN(buddy_return_ptr_extent(rets, &fcs->alloc));
nsz += sz;
}
else
fdo = fellow_disk_obj_trim(fc, fcs);
buddy_trim1_ptr_extent(fc->membuddy, &fco->fco_mem, nsz);
fdsl = fellow_disk_obj_fdsl(fdo);
assert(PAOK(fdsl));
CHECK_OBJ_NOTNULL(fdsl, FELLOW_DISK_SEGLIST_MAGIC);
......@@ -5586,7 +5588,6 @@ struct objcore **ocp, uintptr_t priv2, unsigned crit)
if (dowry.bits)
AN(buddy_return_ptr_page(rets, &dowry));
fellow_cache_obj_trim(fc, fco);
buddy_return(rets);
return (FCR_OK(fco));
err:
......
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