fellow_busy: Redo ..._body_seg_alloc in preparation for async allocations

parent 7f273f0d
......@@ -2458,7 +2458,8 @@ fellow_busy_body_seg_alloc(struct fellow_busy *fbo,
struct fellow_disk_seg *fds, size_t want)
{
struct fellow_body_region *fbr;
struct buddy_off_extent *fdr;
struct buddy_off_extent reg, *fdr;
struct buddy_reqs *reqs;
struct fellow_cache *fc;
struct szc szc;
size_t spc;
......@@ -2475,15 +2476,32 @@ fellow_busy_body_seg_alloc(struct fellow_busy *fbo,
fdr = fbr->reg;
if (fdr == NULL || fbr->len == fdr->size) {
if (FC_INJ)
return (0);
memset(fbr, 0, sizeof *fbr);
assert(fbo->sz_estimate > fbo->sz_dskalloc);
szc = fellow_busy_body_size_strategy(fbo, fbo->sz_dskalloc);
reqs = &fbo->bbrr.reqs;
reg = buddy_off_extent_nil;
fdr = fellow_busy_region_alloc(fbo, szc.sz, szc.cram);
if (fdr == NULL)
return (0);
wait_dskalloc:
if (buddy_alloc_wait(reqs)) {
reg = buddy_get_next_off_extent(reqs);
buddy_alloc_wait_done(reqs);
assert(reg.off >= 0);
}
if (reg.off < 0) {
assert(fbo->sz_estimate > fbo->sz_dskalloc);
szc = fellow_busy_body_size_strategy(fbo,
fbo->sz_dskalloc);
AN(buddy_req_extent(reqs, szc.sz, szc.cram));
goto wait_dskalloc;
}
// Can only fail if reg.off < 0, which can't happen
fdr = fellow_busy_region_commit(fbo, reg);
AN(fdr);
fbr->reg = fdr;
AZ(fbr->len);
......
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