fellow_logcache: alloc on demand from mempool

parent 858adc2a
......@@ -1157,7 +1157,7 @@ fellow_logcache_fini(struct fellow_logcache *flc)
VTAILQ_FOREACH(fle, &flc->free, list) {
CHECK_OBJ(fle, FELLOW_LOGCACHE_ENTRY_MAGIC);
AZ(fle->incore);
AN(buddy_return_ptr_page(rets, &fle->alloc));
AZ(fle->alloc.ptr);
}
VTAILQ_FOREACH(fle, &flc->used, list) {
CHECK_OBJ(fle, FELLOW_LOGCACHE_ENTRY_MAGIC);
......@@ -1231,8 +1231,6 @@ fellow_logcache_init(struct fellow_logcache *flc, struct fellow_fd *ffd,
u < flc->n;
u++, fle++) {
INIT_OBJ(fle, FELLOW_LOGCACHE_ENTRY_MAGIC);
fle->alloc = buddy_get_next_ptr_page(
flc_mempool_get(flc->mempool, NULL));
VTAILQ_INSERT_TAIL(&flc->free, fle, list);
}
......@@ -1265,6 +1263,7 @@ fellow_logcache_return(struct fellow_logcache *flc,
fle->incore = 0;
fle->off = 0;
fle->error = NULL;
buddy_return1_ptr_page(flc->ffd->membuddy, &fle->alloc);
VTAILQ_REMOVE(&flc->used, fle, list);
VTAILQ_INSERT_HEAD(&flc->free, fle, list);
......@@ -1322,6 +1321,11 @@ fellow_logcache_take(struct fellow_logcache *flc, int direction)
return (fellow_logcache_steal(flc, direction));
VTAILQ_REMOVE(&flc->free, fle, list);
AZ(fle->alloc.ptr);
fle->alloc = buddy_get_next_ptr_page(
flc_mempool_get(flc->mempool, NULL));
return (fle);
}
......
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