Split seglist allocation heuristic from actual allocation

parent da5131fb
......@@ -2212,35 +2212,26 @@ fellow_busy_region_free(struct fellow_busy *fbo, struct buddy_off_extent *fdr)
static uint16_t XXX_LIMIT_LDSEGS = 0;
#endif
static struct fellow_cache_res
fellow_disk_seglist_alloc(struct fellow_busy *fbo,
struct fellow_cache_seglist *ofcsl, uint16_t ldsegs, uint8_t fht);
static struct fellow_cache_res
fellow_busy_body_seglist_alloc(struct fellow_busy *fbo,
struct fellow_cache_seglist *ofcsl)
{
struct fellow_disk_seglist *ofdsl, *fdsl;
struct fellow_cache_seglist *fcsl;
struct fellow_cache *fc;
struct buddy_off_extent *fdr;
struct buddy_ptr_extent fdsl_mem, fcsl_mem;
struct buddy_reqs *reqs;
unsigned chunk_exponent, u;
unsigned chunk_exponent;
uint16_t ldsegs;
size_t sz;
CHECK_OBJ_NOTNULL(fbo, FELLOW_BUSY_MAGIC);
CHECK_OBJ_NOTNULL(ofcsl, FELLOW_CACHE_SEGLIST_MAGIC);
AZ(ofcsl->next);
ofdsl = ofcsl->fdsl;
AZ(ofdsl->next.off);
AZ(ofdsl->next.size);
fc = fbo->fc;
CHECK_OBJ_NOTNULL(fc, FELLOW_CACHE_MAGIC);
CHECK_OBJ_NOTNULL(fc->tune, STVFE_TUNE_MAGIC);
chunk_exponent = fc->tune->chunk_exponent;
assert(fbo->sz_estimate > fbo->sz_returned);
if (fbo->grown) {
......@@ -2259,6 +2250,32 @@ fellow_busy_body_seglist_alloc(struct fellow_busy *fbo,
ldsegs = XXX_LIMIT_LDSEGS;
#endif
return (
fellow_disk_seglist_alloc(fbo, ofcsl,
ldsegs, fc->tune->hash_obj));
}
static struct fellow_cache_res
fellow_disk_seglist_alloc(struct fellow_busy *fbo,
struct fellow_cache_seglist *ofcsl, uint16_t ldsegs, uint8_t fht)
{
struct fellow_cache_seglist *fcsl;
struct fellow_disk_seglist *ofdsl, *fdsl;
struct buddy_off_extent *fdr;
struct buddy_ptr_extent fdsl_mem, fcsl_mem;
struct buddy_reqs *reqs;
unsigned u;
size_t sz;
CHECK_OBJ_NOTNULL(fbo, FELLOW_BUSY_MAGIC);
CHECK_OBJ_NOTNULL(ofcsl, FELLOW_CACHE_SEGLIST_MAGIC);
AZ(ofcsl->next);
ofdsl = ofcsl->fdsl;
AZ(ofdsl->next.off);
AZ(ofdsl->next.size);
sz = fellow_disk_seglist_size(fdsl, ldsegs);
fdr = fellow_busy_region_alloc(fbo, sz, 0);
......@@ -2293,7 +2310,7 @@ fellow_busy_body_seglist_alloc(struct fellow_busy *fbo,
fdsl = fdsl_mem.ptr;
AN(fdsl);
assert(fdsl_mem.size == fdr->size);
fellow_disk_seglist_init(fdsl, ldsegs, fc->tune->hash_obj);
fellow_disk_seglist_init(fdsl, ldsegs, fht);
fcsl = fcsl_mem.ptr;
AN(fcsl);
......
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