fellow_busy: Use the mempool

parent 65acc9d4
...@@ -689,7 +689,7 @@ struct fellow_busy_io_seglist { ...@@ -689,7 +689,7 @@ struct fellow_busy_io_seglist {
// pool for segment memory // pool for segment memory
BUDDY_POOL(fbo_segmem, 1); BUDDY_POOL(fbo_segmem, 1);
//BUDDY_POOL_GET_FUNC(fbo_segmem, static) BUDDY_POOL_GET_FUNC(fbo_segmem, static)
//BUDDY_POOL_AVAIL_FUNC(fbo_segmem, static) //BUDDY_POOL_AVAIL_FUNC(fbo_segmem, static)
struct fellow_busy_io { struct fellow_busy_io {
...@@ -4263,10 +4263,12 @@ fellow_busy_body_seg_next(struct fellow_busy *fbo) ...@@ -4263,10 +4263,12 @@ fellow_busy_body_seg_next(struct fellow_busy *fbo)
* *
* used for body and auxattr * used for body and auxattr
*/ */
static size_t fellow_busy_seg_memalloc(const struct fellow_busy *fbo, static size_t fellow_busy_seg_memalloc(struct fellow_busy *fbo,
struct fellow_cache_seg *fcs, int8_t cram) struct fellow_cache_seg *fcs, int8_t cram)
{ {
struct fellow_disk_seg *fds; struct fellow_disk_seg *fds;
struct buddy_ptr_page mem;
size_t sz;
CHECK_OBJ_NOTNULL(fcs, FELLOW_CACHE_SEG_MAGIC); CHECK_OBJ_NOTNULL(fcs, FELLOW_CACHE_SEG_MAGIC);
fds = fcs->disk_seg; fds = fcs->disk_seg;
...@@ -4286,8 +4288,22 @@ static size_t fellow_busy_seg_memalloc(const struct fellow_busy *fbo, ...@@ -4286,8 +4288,22 @@ static size_t fellow_busy_seg_memalloc(const struct fellow_busy *fbo,
cram = buddy_cramlimit_bits(fds->seg.size, cram = buddy_cramlimit_bits(fds->seg.size,
fbo->fc->tune->cram, MIN_FELLOW_BITS); fbo->fc->tune->cram, MIN_FELLOW_BITS);
} }
fcs->alloc = buddy_alloc1_ptr_extent_wait(fbo->fc->membuddy,
FEP_SPC, fds->seg.size, cram); mem = buddy_get_next_ptr_page(
fbo_segmem_get(fbo->segmem, fbo->fc->tune));
AN(mem.ptr);
sz = (size_t)1 << mem.bits;
if (sz >= fds->seg.size) {
fcs->alloc.ptr = mem.ptr;
fcs->alloc.size = sz;
buddy_trim1_ptr_extent(fbo->fc->membuddy, &fcs->alloc,
fds->seg.size);
}
else {
buddy_return1_ptr_page(fbo->fc->membuddy, &mem);
fcs->alloc = buddy_alloc1_ptr_extent_wait(fbo->fc->membuddy,
FEP_SPC, fds->seg.size, cram);
}
if (fcs->alloc.ptr == NULL) if (fcs->alloc.ptr == NULL)
return (0); return (0);
......
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