fellow_log: fix logbuffer flush threshold

It does not make sense to have it larger than the logbuffer itself.

Because the logbuffer can be larger than the threshold, we need to flush
also for n >= thr.

Fixes 7e986ecc
parent 6774bcf8
......@@ -2201,8 +2201,8 @@ logbuffer_init(struct fellow_fd *ffd, struct fellow_logbuffer *lbuf,
// sane upper limit to not eat up all of the membuddy
b = buddy_size(ffd->membuddy) / 8;
b >>= MIN_FELLOW_BITS;
if (b > UINT_MAX)
b = UINT_MAX;
if (b > lbuf->space)
b = lbuf->space;
lbuf->thr = (unsigned)b;
BUDDY_POOL_INIT(lbuf->ffpool, lbuf->membuddy, FEP_MEM_LOG,
......@@ -3260,7 +3260,7 @@ logbuffer_addblks(struct fellow_fd *ffd,
/* if we need memory, just flush blocks
*/
if (canflush && lbuf->space > 0) {
if (lbuf->n == lbuf->thr)
if (lbuf->n >= lbuf->thr)
can |= LBUF_CAN_FLUSH;
else if (lbuf->n * 2 > lbuf->thr)
kick = 1;
......
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