Commit 2f940fb9 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Move esi-policy from hash-lookup to req-fsm

parent 010ef993
...@@ -286,7 +286,7 @@ HSH_Insert(struct worker *wrk, const void *digest, struct objcore *oc) ...@@ -286,7 +286,7 @@ HSH_Insert(struct worker *wrk, const void *digest, struct objcore *oc)
*/ */
struct objcore * struct objcore *
HSH_Lookup(struct req *req) HSH_Lookup(struct req *req, int wait_for_busy)
{ {
struct worker *wrk; struct worker *wrk;
struct objhead *oh; struct objhead *oh;
...@@ -309,7 +309,7 @@ HSH_Lookup(struct req *req) ...@@ -309,7 +309,7 @@ HSH_Lookup(struct req *req)
if (req->hash_objhead != NULL) { if (req->hash_objhead != NULL) {
/* /*
* This sess came off the waiting list, and brings a * This req came off the waiting list, and brings an
* oh refcnt with it. * oh refcnt with it.
*/ */
CHECK_OBJ_NOTNULL(req->hash_objhead, OBJHEAD_MAGIC); CHECK_OBJ_NOTNULL(req->hash_objhead, OBJHEAD_MAGIC);
...@@ -409,7 +409,7 @@ HSH_Lookup(struct req *req) ...@@ -409,7 +409,7 @@ HSH_Lookup(struct req *req)
if (busy_found) { if (busy_found) {
/* There are one or more busy objects, wait for them */ /* There are one or more busy objects, wait for them */
if (req->esi_level == 0) { if (wait_for_busy) {
CHECK_OBJ_NOTNULL(wrk->nwaitinglist, CHECK_OBJ_NOTNULL(wrk->nwaitinglist,
WAITINGLIST_MAGIC); WAITINGLIST_MAGIC);
if (oh->waitinglist == NULL) { if (oh->waitinglist == NULL) {
...@@ -418,10 +418,14 @@ HSH_Lookup(struct req *req) ...@@ -418,10 +418,14 @@ HSH_Lookup(struct req *req)
} }
VTAILQ_INSERT_TAIL(&oh->waitinglist->list, VTAILQ_INSERT_TAIL(&oh->waitinglist->list,
req, w_list); req, w_list);
if (DO_DEBUG(DBG_WAITINGLIST))
VSLb(req->vsl, SLT_Debug,
"on waiting list <%p>", oh);
} else {
if (DO_DEBUG(DBG_WAITINGLIST))
VSLb(req->vsl, SLT_Debug,
"hit busy obj <%p>", oh);
} }
if (DO_DEBUG(DBG_WAITINGLIST))
VSLb(req->vsl, SLT_Debug,
"on waiting list <%p>", oh);
wrk->stats.busy_sleep++; wrk->stats.busy_sleep++;
SES_Charge(req->wrk, req); SES_Charge(req->wrk, req);
......
...@@ -751,7 +751,7 @@ cnt_lookup(struct worker *wrk, struct req *req) ...@@ -751,7 +751,7 @@ cnt_lookup(struct worker *wrk, struct req *req)
VRY_Prep(req); VRY_Prep(req);
AZ(req->objcore); AZ(req->objcore);
oc = HSH_Lookup(req); oc = HSH_Lookup(req, req->esi_level == 0 ? 1 : 0);
if (oc == NULL) { if (oc == NULL) {
/* /*
* We lost the session to a busy object, disembark the * We lost the session to a busy object, disembark the
......
...@@ -53,7 +53,7 @@ struct hash_slinger { ...@@ -53,7 +53,7 @@ struct hash_slinger {
/* cache_hash.c */ /* cache_hash.c */
void HSH_Cleanup(struct worker *w); void HSH_Cleanup(struct worker *w);
struct objcore *HSH_Lookup(struct req *); struct objcore *HSH_Lookup(struct req *, int wait_for_busy);
void HSH_Ref(struct objcore *o); void HSH_Ref(struct objcore *o);
void HSH_Drop(struct worker *, struct object **); void HSH_Drop(struct worker *, struct object **);
void HSH_Init(const struct hash_slinger *slinger); void HSH_Init(const struct hash_slinger *slinger);
......
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