Commit b78280f4 authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Decrement the n_waitinglist counter when freeing waitinglists.

parent b8d4eb8a
......@@ -935,7 +935,7 @@ cnt_fetchbody(struct sess *sp, struct worker *wrk, struct req *req)
AN(req->obj->objcore);
AN(req->obj->objcore->ban);
AZ(req->obj->ws_o->overflow);
HSH_Unbusy(req->obj->objcore);
HSH_Unbusy(&wrk->stats, req->obj->objcore);
}
VBO_DerefBusyObj(wrk, &req->busyobj);
wrk->acct_tmp.fetch++;
......
......@@ -125,6 +125,7 @@ HSH_Cleanup(struct worker *wrk)
if (wrk->nwaitinglist != NULL) {
FREE_OBJ(wrk->nwaitinglist);
wrk->nwaitinglist = NULL;
wrk->stats.n_waitinglist--;
}
if (wrk->nhashpriv != NULL) {
/* XXX: If needed, add slinger method for this */
......@@ -468,7 +469,7 @@ HSH_Lookup(struct sess *sp, struct objhead **poh)
*/
static void
hsh_rush(struct objhead *oh)
hsh_rush(struct dstat *ds, struct objhead *oh)
{
unsigned u;
struct sess *sp;
......@@ -497,6 +498,7 @@ hsh_rush(struct objhead *oh)
if (VTAILQ_EMPTY(&wl->list)) {
oh->waitinglist = NULL;
FREE_OBJ(wl);
ds->n_waitinglist--;
}
}
......@@ -576,12 +578,12 @@ HSH_Drop(struct worker *wrk, struct object **oo)
AssertObjCorePassOrBusy((*oo)->objcore);
(*oo)->exp.ttl = -1.;
if ((*oo)->objcore != NULL) /* Pass has no objcore */
HSH_Unbusy((*oo)->objcore);
HSH_Unbusy(&wrk->stats, (*oo)->objcore);
(void)HSH_Deref(&wrk->stats, NULL, oo);
}
void
HSH_Unbusy(struct objcore *oc)
HSH_Unbusy(struct dstat *ds, struct objcore *oc)
{
struct objhead *oh;
......@@ -603,7 +605,7 @@ HSH_Unbusy(struct objcore *oc)
oc->flags &= ~OC_F_BUSY;
oc->busyobj = NULL;
if (oh->waitinglist != NULL)
hsh_rush(oh);
hsh_rush(ds, oh);
AN(oc->ban);
Lck_Unlock(&oh->mtx);
}
......@@ -680,7 +682,7 @@ HSH_Deref(struct dstat *ds, struct objcore *oc, struct object **oo)
AN(oc->methods);
}
if (oh->waitinglist != NULL)
hsh_rush(oh);
hsh_rush(ds, oh);
Lck_Unlock(&oh->mtx);
if (r != 0)
return (r);
......
......@@ -53,7 +53,6 @@ struct hash_slinger {
/* cache_hash.c */
void HSH_Cleanup(struct worker *w);
struct objcore *HSH_Lookup(struct sess *sp, struct objhead **poh);
void HSH_Unbusy(struct objcore *);
void HSH_Ref(struct objcore *o);
void HSH_Drop(struct worker *, struct object **);
void HSH_Init(const struct hash_slinger *slinger);
......@@ -94,6 +93,7 @@ struct objhead {
#define hoh_head _u.n.u_n_hoh_head
};
void HSH_Unbusy(struct dstat *, struct objcore *);
void HSH_DeleteObjHead(struct dstat *, struct objhead *oh);
int HSH_Deref(struct dstat *, struct objcore *oc, struct object **o);
#endif /* VARNISH_CACHE_CHILD */
......
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