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

Simplify the handover to the fetch-thread: the req-side doesn't

need the busyobj at all now.
parent ba104c92
...@@ -967,7 +967,8 @@ void ...@@ -967,7 +967,8 @@ void
VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc, VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
struct objcore *oldoc, enum vbf_fetch_mode_e mode) struct objcore *oldoc, enum vbf_fetch_mode_e mode)
{ {
struct busyobj *bo, *bo_fetch; struct boc *boc;
struct busyobj *bo;
const char *how; const char *how;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
...@@ -994,9 +995,9 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc, ...@@ -994,9 +995,9 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
THR_SetBusyobj(bo); THR_SetBusyobj(bo);
assert(HSH_RefBusy(oc) == bo->boc); boc = HSH_RefBusy(oc);
bo_fetch = bo; AN(boc);
assert(boc == bo->boc);
AN(bo->vcl); AN(bo->vcl);
...@@ -1021,7 +1022,7 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc, ...@@ -1021,7 +1022,7 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
AZ(bo->req); AZ(bo->req);
bo->req = req; bo->req = req;
bo->fetch_task.priv = bo_fetch; bo->fetch_task.priv = bo;
bo->fetch_task.func = vbf_fetch_thread; bo->fetch_task.func = vbf_fetch_thread;
if (Pool_Task(wrk->pool, &bo->fetch_task, TASK_QUEUE_BO)) { if (Pool_Task(wrk->pool, &bo->fetch_task, TASK_QUEUE_BO)) {
...@@ -1029,22 +1030,23 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc, ...@@ -1029,22 +1030,23 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
(void)vbf_stp_fail(req->wrk, bo); (void)vbf_stp_fail(req->wrk, bo);
if (bo->stale_oc != NULL) if (bo->stale_oc != NULL)
(void)HSH_DerefObjCore(wrk, &bo->stale_oc); (void)HSH_DerefObjCore(wrk, &bo->stale_oc);
HSH_DerefBusy(wrk, bo->fetch_objcore); HSH_DerefBusy(wrk, oc);
} else { } else {
bo_fetch = NULL; /* ref transferred to fetch thread */ bo = NULL; /* ref transferred to fetch thread */
if (mode == VBF_BACKGROUND) { if (mode == VBF_BACKGROUND) {
ObjWaitState(bo->boc, BOS_REQ_DONE); ObjWaitState(boc, BOS_REQ_DONE);
} else { } else {
ObjWaitState(bo->boc, BOS_STREAM); ObjWaitState(boc, BOS_STREAM);
if (bo->boc->state == BOS_FAILED) { if (boc->state == BOS_FAILED) {
AN((oc->flags & OC_F_FAILED)); AN((oc->flags & OC_F_FAILED));
} else { } else {
AZ(bo->fetch_objcore->flags & OC_F_BUSY); AZ(oc->flags & OC_F_BUSY);
} }
} }
} }
AZ(bo_fetch); AZ(bo);
VSLb_ts_req(req, "Fetch", W_TIM_real(wrk)); VSLb_ts_req(req, "Fetch", W_TIM_real(wrk));
HSH_DerefBusy(wrk, bo->fetch_objcore); assert(oc->boc == boc);
HSH_DerefBusy(wrk, oc);
THR_SetBusyobj(NULL); THR_SetBusyobj(NULL);
} }
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