fellow_cache: only run the estimate update after the current fcs is full

parent 2a9a7256
......@@ -5258,6 +5258,23 @@ fellow_busy_obj_getspace(struct fellow_busy *fbo, size_t *sz, uint8_t **ptr)
if (*sz + fbo->sz_returned > fbo->fc->tune->objsize_max)
*sz = fbo->fc->tune->objsize_max - fbo->sz_returned;
fcs = fbo->body_seg;
if (fcs != NULL && fcs->state == FCS_BUSY) {
AN(fcs->alloc.size);
if (fcs->u.fcs.len < fcs->alloc.size) {
spc = fcs->alloc.size - fcs->u.fcs.len;
assert(spc > 0);
if (spc < *sz)
*sz = spc;
*ptr = (uint8_t *)fcs->alloc.ptr + fcs->u.fcs.len;
return (FCR_OK(fbo));
}
assert(fcs->u.fcs.len == fcs->alloc.size);
unbusy = fcs;
fcs = NULL;
}
/*
* for content-length, varnish-cache will ask for less and less.
*
......@@ -5285,23 +5302,6 @@ fellow_busy_obj_getspace(struct fellow_busy *fbo, size_t *sz, uint8_t **ptr)
fbo->sz_increment <<= 1;
}
}
fcs = fbo->body_seg;
if (fcs != NULL && fcs->state == FCS_BUSY) {
AN(fcs->alloc.size);
if (fcs->u.fcs.len < fcs->alloc.size) {
spc = fcs->alloc.size - fcs->u.fcs.len;
assert(spc > 0);
if (spc < *sz)
*sz = spc;
*ptr = (uint8_t *)fcs->alloc.ptr + fcs->u.fcs.len;
return (FCR_OK(fbo));
}
assert(fcs->u.fcs.len == fcs->alloc.size);
unbusy = fcs;
fcs = NULL;
}
if (fcs == NULL) {
fcr = fellow_busy_body_seg_next(fbo);
if (fcr.status != fcr_ok)
......
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