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

Now that we have decided bump VRT_MAJOR, drop the reqtop struct

again and all the overhead it brought.
parent b9708eac
......@@ -443,11 +443,6 @@ struct busyobj {
/*--------------------------------------------------------------------*/
struct reqtop {
unsigned magic;
#define REQTOP_MAGIC 0x57fbda52
struct req *topreq;
};
struct req {
unsigned magic;
......@@ -458,7 +453,7 @@ struct req {
enum sess_close doclose;
int restarts;
int esi_level;
struct reqtop *top; /* esi_level == 0 request */
struct req *topreq; /* esi_level == 0 request */
#define REQ_FLAG(l, r, w, d) unsigned l:1;
#include "tbl/req_flags.h"
......@@ -537,7 +532,7 @@ struct req {
struct vrt_privs privs[1];
};
#define IS_TOPREQ(req) ((req)->top == NULL || (req)->top->topreq == (req))
#define IS_TOPREQ(req) ((req)->topreq == (req))
/*--------------------------------------------------------------------
* Struct sess is a high memory-load structure because sessions typically
......
......@@ -112,7 +112,7 @@ ved_include(struct req *preq, const char *src, const char *host,
enum req_fsm_nxt s;
CHECK_OBJ_NOTNULL(preq, REQ_MAGIC);
CHECK_OBJ_NOTNULL(preq->top, REQTOP_MAGIC);
CHECK_OBJ_NOTNULL(preq->topreq, REQ_MAGIC);
sp = preq->sp;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(ecx, ECX_MAGIC);
......@@ -138,7 +138,7 @@ ved_include(struct req *preq, const char *src, const char *host,
req->esi_level = preq->esi_level + 1;
req->top = preq->top;
req->topreq = preq->topreq;
HTTP_Setup(req->http, req->ws, req->vsl, SLT_ReqMethod);
HTTP_Dup(req->http, preq->http0);
......@@ -258,16 +258,6 @@ ved_vdp_esi_init(struct req *req, void **priv)
*priv = ecx;
RFC2616_Weaken_Etag(req->resp);
if (IS_TOPREQ(req)) {
Req_MakeTop(req);
if (req->top == NULL) {
VSLb(req->vsl, SLT_Error,
"(top)request workspace overflow");
Req_Fail(req, SC_OVERLOAD);
return (-1);
}
}
req->res_mode |= RES_ESI;
if (req->resp_len != 0)
req->resp_len = -1;
......
......@@ -455,20 +455,6 @@ pan_busyobj(struct vsb *vsb, const struct busyobj *bo)
/*--------------------------------------------------------------------*/
static void
pan_top(struct vsb *vsb, const struct reqtop *top)
{
VSB_printf(vsb, "top = %p {\n", top);
if (PAN_already(vsb, top))
return;
VSB_indent(vsb, 2);
pan_req(vsb, top->topreq);
VSB_indent(vsb, -2);
VSB_printf(vsb, "},\n");
}
/*--------------------------------------------------------------------*/
static void
pan_req(struct vsb *vsb, const struct req *req)
{
......@@ -542,8 +528,11 @@ pan_req(struct vsb *vsb, const struct req *req)
pan_privs(vsb, req->privs);
if (req->top != NULL)
pan_top(vsb, req->top);
VSB_printf(vsb, "topreq = {\n");
VSB_indent(vsb, 2);
pan_req(vsb, req->topreq);
VSB_indent(vsb, -2);
VSB_printf(vsb, "},\n");
VSB_indent(vsb, -2);
VSB_printf(vsb, "},\n");
......
......@@ -63,6 +63,7 @@ Req_AcctLogCharge(struct VSC_main_wrk *ds, struct req *req)
(uintmax_t)(a->resp_hdrbytes + a->resp_bodybytes));
}
AN(req->topreq);
if (IS_TOPREQ(req)) {
#define ACCT(foo) ds->s_##foo += a->foo;
#include "tbl/acct_fields_req.h"
......@@ -147,6 +148,8 @@ Req_New(const struct worker *wrk, struct sess *sp)
req->t_prev = NAN;
req->t_req = NAN;
req->topreq = req;
return (req);
}
......@@ -174,7 +177,7 @@ Req_Release(struct req *req)
MPL_AssertSane(req);
VSL_Flush(req->vsl, 0);
req->sp = NULL;
req->top = NULL;
req->topreq = NULL;
MPL_Free(pp->mpl_req, req);
}
......@@ -193,7 +196,6 @@ Req_Rollback(struct req *req)
if (WS_Overflowed(req->ws))
req->wrk->stats->ws_client_overflow++;
WS_Reset(req->ws, req->ws_req);
req->top = NULL;
}
/*----------------------------------------------------------------------
......@@ -207,6 +209,7 @@ Req_Cleanup(struct sess *sp, struct worker *wrk, struct req *req)
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
CHECK_OBJ_NOTNULL(req->topreq, REQ_MAGIC);
assert(sp == req->sp);
req->director_hint = NULL;
......@@ -238,7 +241,6 @@ Req_Cleanup(struct sess *sp, struct worker *wrk, struct req *req)
req->hash_ignore_busy = 0;
req->esi_level = 0;
req->is_hit = 0;
req->top = 0;
if (WS_Overflowed(req->ws))
wrk->stats->ws_client_overflow++;
......@@ -257,20 +259,3 @@ Req_Fail(struct req *req, enum sess_close reason)
AN(req->transport->req_fail);
req->transport->req_fail(req, reason);
}
/*----------------------------------------------------------------------
*/
void
Req_MakeTop(struct req *req)
{
CHECK_OBJ_ORNULL(req->top, REQTOP_MAGIC);
if (req->top != NULL)
return;
req->top = WS_Alloc(req->ws, sizeof *req->top);
if (req->top != NULL) {
INIT_OBJ(req->top, REQTOP_MAGIC);
req->top->topreq = req;
}
}
......@@ -1021,6 +1021,7 @@ CNT_Embark(struct worker *wrk, struct req *req)
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
CHECK_OBJ_NOTNULL(req->topreq, REQ_MAGIC);
/* wrk can have changed for restarts */
req->vfc->wrk = req->wrk = wrk;
......
......@@ -314,7 +314,6 @@ void Req_Rollback(struct req *req);
void Req_Cleanup(struct sess *sp, struct worker *wrk, struct req *req);
void Req_Fail(struct req *req, enum sess_close reason);
void Req_AcctLogCharge(struct VSC_main_wrk *, struct req *);
void Req_MakeTop(struct req *req);
/* cache_req_body.c */
int VRB_Ignore(struct req *);
......
......@@ -91,15 +91,12 @@ VCL_Req2Ctx(struct vrt_ctx *ctx, struct req *req)
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
CHECK_OBJ_ORNULL(req->topreq, REQ_MAGIC);
ctx->vcl = req->vcl;
ctx->vsl = req->vsl;
ctx->http_req = req->http;
CHECK_OBJ_ORNULL(req->top, REQTOP_MAGIC);
if (req->top != NULL)
ctx->http_req_top = req->top->topreq->http;
else
ctx->http_req_top = req->http;
ctx->http_req_top = req->topreq->http;
ctx->http_resp = req->resp;
ctx->req = req;
ctx->sp = req->sp;
......
......@@ -166,13 +166,7 @@ VRT_priv_top(VRT_CTX, const void *vmod_id)
NEEDLESS(return NULL);
}
CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC);
if (ctx->req->top != NULL) {
CHECK_OBJ_NOTNULL(ctx->req->top, REQTOP_MAGIC);
CHECK_OBJ_NOTNULL(ctx->req->top->topreq, REQ_MAGIC);
req = ctx->req->top->topreq;
} else {
req = ctx->req;
}
req = ctx->req->topreq;
CAST_OBJ_NOTNULL(vps, req->privs, VRT_PRIVS_MAGIC);
return (vrt_priv_dynamic(req->ws, vps, (uintptr_t)vmod_id));
}
......
......@@ -430,7 +430,6 @@ vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo,
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
CHECK_OBJ_NOTNULL(req->sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(req->vcl, VCL_MAGIC);
CHECK_OBJ_ORNULL(req->top, REQTOP_MAGIC);
VCL_Req2Ctx(&ctx, req);
}
if (bo != 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