When logbuffer mempool is running low ...

kick the logwatcher first before potentially running into a synchronous
flush.
parent 2416a535
......@@ -883,7 +883,7 @@ struct flw_need_why {
char s[256];
};
static enum flw_need_e
fellow_logwatcher_need(const struct fellow_fd *, struct flw_need_why *);
fellow_logwatcher_need(struct fellow_fd *, struct flw_need_why *);
#include "fellow_log_dle_chg.h"
......@@ -3229,6 +3229,11 @@ logbuffer_addblks(struct fellow_fd *ffd,
else if (lbuf->n * 2 > lbuf->space)
kick = 1;
}
/* low water in mempool?
*/
if (canflush &&
lbuf_mempool_avail(lbuf->mempool) < LBUF_MEMPOOL_SIZE)
kick = 1;
/* if we run short of disk blocks (25%), we want to
* ref in order to apply frees
......@@ -5721,9 +5726,9 @@ fellow_logwatcher_need_openlog(const struct fellow_logbuffer *lbuf,
}
static enum flw_need_e
fellow_logwatcher_need(const struct fellow_fd *ffd, struct flw_need_why *why)
fellow_logwatcher_need(struct fellow_fd *ffd, struct flw_need_why *why)
{
const struct fellow_logbuffer *lbuf;
struct fellow_logbuffer *lbuf;
const struct stvfe_tune *tune;
enum flw_need_e need;
// XXX config?
......@@ -5748,14 +5753,16 @@ fellow_logwatcher_need(const struct fellow_fd *ffd, struct flw_need_why *why)
return (need);
}
if (lbuf->space != 0 &&
lbuf->space - lbuf->n <= thr_logbuffer_minfree)
if (lbuf->space == 0 || lbuf->n == 0)
return (FLW_NEED_NONE);
if (lbuf_mempool_avail(lbuf->mempool) < LBUF_MEMPOOL_SIZE)
return (FLW_NEED_FLUSH);
if (lbuf->space != 0 && lbuf->n != 0)
return (FLW_MAYFLUSH);
if (lbuf->space - lbuf->n <= thr_logbuffer_minfree)
return (FLW_NEED_FLUSH);
return (FLW_NEED_NONE);
return (FLW_MAYFLUSH);
}
/*
......
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