[master] 4670ed0 Eliminate req->exp, there's just req.d_ttl left now.
Poul-Henning Kamp
phk at varnish-cache.org
Fri Oct 4 08:43:08 CEST 2013
commit 4670ed03fc88fc8793f683f52669ae65acd7d636
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Fri Oct 4 06:42:51 2013 +0000
Eliminate req->exp, there's just req.d_ttl left now.
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index cd71bc6..52b8d93 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -658,7 +658,7 @@ struct req {
uint8_t digest[DIGEST_LEN];
enum sess_close doclose;
- struct exp exp;
+ double d_ttl;
unsigned char wantbody;
uint64_t req_bodybytes;
diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index dd805fd..d9225bf 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -135,8 +135,8 @@ EXP_Ttl(const struct req *req, const struct object *o)
double r;
r = o->exp.ttl;
- if (req != NULL && req->exp.ttl > 0. && req->exp.ttl < r)
- r = req->exp.ttl;
+ if (req != NULL && req->d_ttl > 0. && req->d_ttl < r)
+ r = req->d_ttl;
return (o->exp.t_origin + r);
}
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 647ef49..9e1609b 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -684,8 +684,7 @@ cnt_recv(struct worker *wrk, struct req *req)
req->director = req->vcl->director[0];
AN(req->director);
- EXP_Clr(&req->exp);
-
+ req->d_ttl = -1;
req->disable_esi = 0;
req->hash_always_miss = 0;
req->hash_ignore_busy = 0;
diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c
index a605ad1..9c5ba19 100644
--- a/bin/varnishd/cache/cache_vrt_var.c
+++ b/bin/varnishd/cache/cache_vrt_var.c
@@ -304,24 +304,32 @@ VRT_l_beresp_storage(const struct vrt_ctx *ctx, const char *str, ...)
/*--------------------------------------------------------------------*/
-void
-VRT_l_req_backend(const struct vrt_ctx *ctx, struct director *be)
-{
-
- CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
- CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC);
- ctx->req->director = be;
+#define REQ_VAR_L(nm, elem, type,extra) \
+ \
+void \
+VRT_l_req_##nm(const struct vrt_ctx *ctx, type arg) \
+{ \
+ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \
+ CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); \
+ extra; \
+ ctx->req->elem = arg; \
}
-struct director *
-VRT_r_req_backend(const struct vrt_ctx *ctx)
-{
-
- CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
- CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC);
- return (ctx->req->director);
+#define REQ_VAR_R(nm, elem, type) \
+ \
+type \
+VRT_r_req_##nm(const struct vrt_ctx *ctx) \
+{ \
+ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \
+ CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); \
+ return(ctx->req->elem); \
}
+REQ_VAR_L(backend, director, struct director *,)
+REQ_VAR_R(backend, director, struct director *)
+REQ_VAR_L(ttl, d_ttl, double, if (!(arg>0.0)) arg = 0;)
+REQ_VAR_R(ttl, d_ttl, double)
+
unsigned
VRT_r_req_backend_healthy(const struct vrt_ctx *ctx)
{
@@ -472,8 +480,6 @@ vrt_wsp_exp(struct vsl_log *vsl, double now, const struct exp *e)
e->ttl - dt, e->grace, e->keep, now, dt);
}
-VRT_DO_EXP(req, ctx->req->exp, ttl, 0, )
-
VRT_DO_EXP(obj, ctx->req->obj->exp, grace, 0,
EXP_Rearm(ctx->req->obj);
vrt_wsp_exp(ctx->vsl, ctx->req->t_req, &ctx->req->obj->exp);)
More information about the varnish-commit
mailing list