New flush policy from getblks

parent 0968c091
...@@ -802,7 +802,7 @@ struct fellow_log_prep { ...@@ -802,7 +802,7 @@ struct fellow_log_prep {
}; };
// fwd decl // fwd decl
static void fellow_logwatcher_check(struct fellow_fd *); static void fellow_logwatcher_kick_locked(struct fellow_fd *);
static void static void
fellow_privatelog_submit(struct fellow_fd *ffd, struct fellow_logbuffer *lbuf, fellow_privatelog_submit(struct fellow_fd *ffd, struct fellow_logbuffer *lbuf,
struct fellow_dle *entry, unsigned n); struct fellow_dle *entry, unsigned n);
...@@ -816,7 +816,7 @@ enum flw_need_e { ...@@ -816,7 +816,7 @@ enum flw_need_e {
FLW_NEED_REWRITE, FLW_NEED_REWRITE,
FLW_NEED_LIM FLW_NEED_LIM
}; };
#ifdef DEBUG #ifdef DEBUG_DONTNEED
//lint -e773 //lint -e773
static const char * const flw_need_s[FLW_NEED_LIM] = { static const char * const flw_need_s[FLW_NEED_LIM] = {
#define N(x) [x] = #x #define N(x) [x] = #x
...@@ -3072,18 +3072,24 @@ logbuffer_addblks(struct fellow_fd *ffd, ...@@ -3072,18 +3072,24 @@ logbuffer_addblks(struct fellow_fd *ffd,
/* if we need memory, just flush blocks /* if we need memory, just flush blocks
*/ */
if (canflush && if (canflush && lbuf->space > 0) {
lbuf->space > 0 && lbuf->n == lbuf->space) if (lbuf->n == lbuf->space)
can |= LBUF_CAN_FLUSH; can |= LBUF_CAN_FLUSH;
else if (lbuf->n * 2 > lbuf->space)
fellow_logwatcher_kick_locked(ffd);
}
/* if we run short of disk blocks, we want to /* if we run short of disk blocks (25%), we want to
* ref in order to apply frees * ref in order to apply frees
* *
* unless avail increases, this flushes for every half * unless avail increases, this flushes for every half
*/ */
if (canflush && if (canflush && lbuf->n > 0) {
lbuf->n > 0 && lbuf->n * 2 >= avail) if (lbuf->n * 4 >= avail * 3)
can |= LBUF_CAN_REF; can |= LBUF_CAN_REF;
else if (!can && lbuf->n * 2 >= avail)
fellow_logwatcher_kick_locked(ffd);
}
/* /*
* flush if logbuffer is full or not enough blocks * flush if logbuffer is full or not enough blocks
...@@ -5754,19 +5760,10 @@ fellow_logwatcher_thread(void *priv) ...@@ -5754,19 +5760,10 @@ fellow_logwatcher_thread(void *priv)
} }
static void static void
fellow_logwatcher_check(struct fellow_fd *ffd) fellow_logwatcher_kick_locked(struct fellow_fd *ffd)
{ {
enum flw_need_e need;
need = fellow_logwatcher_need(ffd, NULL);
if (need == FLW_NEED_NONE || need == FLW_MAYFLUSH)
return;
DBG("need %s", flw_need_s[need]);
AZ(pthread_mutex_lock(&ffd->logmtx));
if (ffd->phase == FP_OPEN && ffd->watcher_running) if (ffd->phase == FP_OPEN && ffd->watcher_running)
AZ(pthread_cond_broadcast(&ffd->watcher_cond)); AZ(pthread_cond_broadcast(&ffd->watcher_cond));
AZ(pthread_mutex_unlock(&ffd->logmtx));
} }
// not unter logmtx // not unter logmtx
...@@ -6321,9 +6318,6 @@ fellow_log_dle_submit(struct fellow_fd *ffd, ...@@ -6321,9 +6318,6 @@ fellow_log_dle_submit(struct fellow_fd *ffd,
if (prealloc != NULL) if (prealloc != NULL)
regionlist_free(&prealloc, ffd->dskbuddy); regionlist_free(&prealloc, ffd->dskbuddy);
AZ(prealloc); AZ(prealloc);
if (ffd->phase == FP_OPEN && ffd->logbuf->ff.inuse == 0)
fellow_logwatcher_check(ffd);
} }
/* emergency flush, called from nuke when we need-a-space /* emergency flush, called from nuke when we need-a-space
......
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