Refactor region reserve

parent 4222b099
......@@ -598,6 +598,8 @@ struct fellow_busy {
struct fellow_body_region body_region;
#define FCO_MAX_REGIONS ((FELLOW_DISK_LOG_BLOCK_ENTRIES - 1) * DLE_REG_NREGION)
// for fdsl and busy region last chance
#define FCO_REGIONS_RESERVE 3
struct buddy_off_extent region[FCO_MAX_REGIONS];
unsigned nregion;
uint8_t grown;
......@@ -1839,8 +1841,8 @@ fellow_busy_region_alloc(struct fellow_busy *fbo, size_t size, int8_t cram)
fc = fbo->fc;
CHECK_OBJ_NOTNULL(fc, FELLOW_CACHE_MAGIC);
/* stop cramming if we used half the regions already */
if (fbo->nregion < FCO_MAX_REGIONS / 2)
/* stop cramming if we run out of regions */
if (fbo->nregion < FCO_MAX_REGIONS - FCO_REGIONS_RESERVE)
cram = 0;
assert(fbo->nregion < FCO_MAX_REGIONS);
......
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