fellow_busy: Use dowry

parent e4ad1336
...@@ -2519,20 +2519,29 @@ fellow_busy_body_seg_alloc(struct fellow_busy *fbo, ...@@ -2519,20 +2519,29 @@ fellow_busy_body_seg_alloc(struct fellow_busy *fbo,
memset(fbr, 0, sizeof *fbr); memset(fbr, 0, sizeof *fbr);
reqs = &fbo->bbrr.reqs; reqs = &fbo->bbrr.reqs;
reg = buddy_off_extent_nil; reg = fbo->segdskdowry;
fbo->segdskdowry = buddy_off_extent_nil;
wait_dskalloc: wait_dskalloc:
if (buddy_alloc_wait(reqs)) { if (reg.off < 0 && buddy_alloc_async_wait(reqs)) {
reg = buddy_get_next_off_extent(reqs); reg = buddy_get_next_off_extent(reqs);
buddy_alloc_wait_done(reqs);
assert(reg.off >= 0); assert(reg.off >= 0);
} }
if (reg.off < 0) { buddy_alloc_wait_done(reqs);
szc = fellow_busy_body_size_strategy(fbo);
// must return a size, or sz_estimate is wrong // must return a size, or sz_estimate is wrong
AN(szc.sz); szc = fellow_busy_body_size_strategy(fbo);
AN(szc.sz);
// return and realloc if one power of two too big
if (reg.off < 0 ||
(log2up(reg.size) > MIN_FELLOW_BITS &&
log2up(reg.size) > log2up(szc.sz))) {
AN(buddy_req_extent(reqs, szc.sz, szc.cram)); AN(buddy_req_extent(reqs, szc.sz, szc.cram));
(void) buddy_alloc_async(reqs);
if (reg.off >= 0)
buddy_return1_off_extent(reqs->buddy, &reg);
goto wait_dskalloc; goto wait_dskalloc;
} }
...@@ -2546,8 +2555,10 @@ fellow_busy_body_seg_alloc(struct fellow_busy *fbo, ...@@ -2546,8 +2555,10 @@ fellow_busy_body_seg_alloc(struct fellow_busy *fbo,
// async allocation for remaining known size // async allocation for remaining known size
szc = fellow_busy_body_size_strategy(fbo); szc = fellow_busy_body_size_strategy(fbo);
if (szc.sz) if (szc.sz) {
AN(buddy_req_extent(reqs, szc.sz, szc.cram)); AN(buddy_req_extent(reqs, szc.sz, szc.cram));
(void) buddy_alloc_async(reqs);
}
} }
assert(fbr->len < fdr->size); assert(fbr->len < fdr->size);
......
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