Commit ed47f83d authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Move the busyobj allocation from cache_hash to cache_req_fsm

Move the predictive vary from the req->ws to busyobj->ws.
parent 5922eb75
...@@ -60,7 +60,6 @@ ...@@ -60,7 +60,6 @@
#include "hash/hash_slinger.h" #include "hash/hash_slinger.h"
#include "vmb.h"
#include "vsha256.h" #include "vsha256.h"
static const struct hash_slinger *hash; static const struct hash_slinger *hash;
...@@ -445,19 +444,6 @@ HSH_Lookup(struct req *req) ...@@ -445,19 +444,6 @@ HSH_Lookup(struct req *req)
VTAILQ_INSERT_TAIL(&oh->objcs, oc, list); VTAILQ_INSERT_TAIL(&oh->objcs, oc, list);
/* NB: do not deref objhead the new object inherits our reference */ /* NB: do not deref objhead the new object inherits our reference */
Lck_Unlock(&oh->mtx); Lck_Unlock(&oh->mtx);
AZ(req->busyobj);
req->busyobj = VBO_GetBusyObj(wrk);
req->busyobj->refcount = 2; /* One for req, one for FetchBody */
VRY_Validate(req->vary_b);
if (req->vary_l != NULL)
req->busyobj->vary = req->vary_b;
else
req->busyobj->vary = NULL;
VMB();
oc->busyobj = req->busyobj;
return (oc); return (oc);
} }
......
...@@ -776,6 +776,7 @@ cnt_lookup(struct worker *wrk, struct req *req) ...@@ -776,6 +776,7 @@ cnt_lookup(struct worker *wrk, struct req *req)
struct objcore *oc; struct objcore *oc;
struct object *o; struct object *o;
struct objhead *oh; struct objhead *oh;
struct busyobj *bo;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
...@@ -792,8 +793,8 @@ cnt_lookup(struct worker *wrk, struct req *req) ...@@ -792,8 +793,8 @@ cnt_lookup(struct worker *wrk, struct req *req)
/* /*
* We lost the session to a busy object, disembark the * We lost the session to a busy object, disembark the
* worker thread. We return to STP_LOOKUP when the busy * worker thread. We return to STP_LOOKUP when the busy
* object has been unbusied, and still have the hash digest * object has been unbusied, and still have the objhead
* around to do the lookup with. * around to restart the lookup with.
*/ */
return (2); return (2);
} }
...@@ -805,22 +806,28 @@ cnt_lookup(struct worker *wrk, struct req *req) ...@@ -805,22 +806,28 @@ cnt_lookup(struct worker *wrk, struct req *req)
/* If we inserted a new object it's a miss */ /* If we inserted a new object it's a miss */
if (oc->flags & OC_F_BUSY) { if (oc->flags & OC_F_BUSY) {
CHECK_OBJ_NOTNULL(oc->busyobj, BUSYOBJ_MAGIC); AZ(req->busyobj);
assert(oc->busyobj == req->busyobj); bo = VBO_GetBusyObj(wrk);
wrk->stats.cache_miss++; req->busyobj = bo;
/* One ref for req, one for FetchBody */
bo->refcount = 2;
VRY_Validate(req->vary_b);
if (req->vary_l != NULL) { if (req->vary_l != NULL) {
assert(oc->busyobj->vary == req->vary_b); bo->vary = (void*)WS_Copy(bo->ws,
VRY_Validate(oc->busyobj->vary); (void*)req->vary_b, req->vary_l - req->vary_b);
WS_ReleaseP(req->ws, (void*)req->vary_l); AN(bo->vary);
} else { VRY_Validate(bo->vary);
AZ(oc->busyobj->vary); } else
WS_Release(req->ws, 0); bo->vary = NULL;
}
WS_Release(req->ws, 0);
req->vary_b = NULL; req->vary_b = NULL;
req->vary_l = NULL; req->vary_l = NULL;
req->vary_e = NULL; req->vary_e = NULL;
oc->busyobj = bo;
wrk->stats.cache_miss++;
req->objcore = oc; req->objcore = oc;
req->req_step = R_STP_MISS; req->req_step = R_STP_MISS;
return (0); return (0);
......
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