fellow_busy: Simplity ..._body_size_strategy()

parent a07c842c
...@@ -2404,19 +2404,21 @@ struct szc { ...@@ -2404,19 +2404,21 @@ struct szc {
}; };
/* /*
* Return a size to allocate next for the object body, * Return a size to allocate next for the object body
* given that already bytes are alocated
*/ */
static struct szc static struct szc
fellow_busy_body_size_strategy(const struct fellow_busy *fbo, size_t already) fellow_busy_body_size_strategy(const struct fellow_busy *fbo)
{ {
unsigned chunkbits; unsigned chunkbits;
struct szc szc; struct szc szc = {0,0};
if (fbo->sz_estimate <= fbo->sz_dskalloc)
return (szc);
chunkbits = fbo->fc->tune->chunk_exponent; chunkbits = fbo->fc->tune->chunk_exponent;
szc.cram = fbo->fc->tune->cram; szc.cram = fbo->fc->tune->cram;
assert(fbo->sz_estimate > already); assert(fbo->sz_estimate > fbo->sz_dskalloc);
szc.sz = fbo->sz_estimate - fbo->sz_dskalloc; szc.sz = fbo->sz_estimate - fbo->sz_dskalloc;
// out of regions: no cram // out of regions: no cram
...@@ -2492,9 +2494,9 @@ fellow_busy_body_seg_alloc(struct fellow_busy *fbo, ...@@ -2492,9 +2494,9 @@ fellow_busy_body_seg_alloc(struct fellow_busy *fbo,
} }
if (reg.off < 0) { if (reg.off < 0) {
assert(fbo->sz_estimate > fbo->sz_dskalloc); szc = fellow_busy_body_size_strategy(fbo);
szc = fellow_busy_body_size_strategy(fbo, // must return a size, or sz_estimate is wrong
fbo->sz_dskalloc); AN(szc.sz);
AN(buddy_req_extent(reqs, szc.sz, szc.cram)); AN(buddy_req_extent(reqs, szc.sz, szc.cram));
goto wait_dskalloc; goto wait_dskalloc;
} }
......
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