[master] c463be3 Move beresp.storage to busyobj
Poul-Henning Kamp
phk at varnish-cache.org
Mon Apr 22 22:07:51 CEST 2013
commit c463be36739380fa04a3be234ffaf5b1bd06b714
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Apr 22 20:07:41 2013 +0000
Move beresp.storage to busyobj
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 3a0fb92..232e2f1 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -537,6 +537,8 @@ struct busyobj {
double first_byte_timeout;
double between_bytes_timeout;
+ const char *storage_hint;
+
struct vsl_log vsl[1];
struct dstat *stats;
};
@@ -645,8 +647,6 @@ struct req {
struct objcore *objcore;
/* Lookup stuff */
struct SHA256Context *sha256ctx;
- /* This is only here so VRT can find it */
- const char *storage_hint;
/* ESI delivery stuff */
int gzip_resp;
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 17222a0..3c6c96d 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -362,7 +362,7 @@ cnt_fetch(struct worker *wrk, struct req *req)
AN(req->director);
AZ(bo->vbc);
AZ(bo->should_close);
- AZ(req->storage_hint);
+ AZ(bo->storage_hint);
HTTP_Setup(bo->beresp, bo->ws, bo->vsl, HTTP_Beresp);
@@ -445,10 +445,10 @@ cnt_fetch(struct worker *wrk, struct req *req)
req->objcore = NULL;
}
assert(bo->refcount == 2);
+ bo->storage_hint = NULL;
VBO_DerefBusyObj(wrk, &bo);
VBO_DerefBusyObj(wrk, &req->busyobj);
req->director = NULL;
- req->storage_hint = NULL;
switch (wrk->handling) {
case VCL_RET_RESTART:
@@ -601,11 +601,11 @@ cnt_fetchbody(struct worker *wrk, struct req *req)
if (bo->exp.ttl < cache_param->shortlived ||
req->objcore == NULL)
- req->storage_hint = TRANSIENT_STORAGE;
+ bo->storage_hint = TRANSIENT_STORAGE;
AZ(bo->stats);
bo->stats = &wrk->stats;
- req->obj = STV_NewObject(bo, &req->objcore, req->storage_hint, l,
+ req->obj = STV_NewObject(bo, &req->objcore, bo->storage_hint, l,
nhttp);
if (req->obj == NULL) {
/*
@@ -631,7 +631,7 @@ cnt_fetchbody(struct worker *wrk, struct req *req)
}
CHECK_OBJ_NOTNULL(req->obj, OBJECT_MAGIC);
- req->storage_hint = NULL;
+ bo->storage_hint = NULL;
AZ(bo->fetch_obj);
bo->fetch_obj = req->obj;
diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c
index 307ae1a..5c5e72b 100644
--- a/bin/varnishd/cache/cache_vrt_var.c
+++ b/bin/varnishd/cache/cache_vrt_var.c
@@ -288,26 +288,26 @@ VRT_r_beresp_backend_port(const struct req *req)
}
const char *
-VRT_r_beresp_storage(const struct req *req)
+VRT_r_beresp_storage(const struct busyobj *bo)
{
- CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
- if (req->storage_hint != NULL)
- return (req->storage_hint);
+ CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+ if (bo->storage_hint != NULL)
+ return (bo->storage_hint);
else
return (NULL);
}
void
-VRT_l_beresp_storage(struct req *req, const char *str, ...)
+VRT_l_beresp_storage(struct busyobj *bo, const char *str, ...)
{
va_list ap;
char *b;
- CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+ CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
va_start(ap, str);
- b = VRT_String(req->busyobj->ws, NULL, str, ap);
+ b = VRT_String(bo->ws, NULL, str, ap);
va_end(ap);
- req->storage_hint = b;
+ bo->storage_hint = b;
}
/*--------------------------------------------------------------------*/
diff --git a/lib/libvcl/generate.py b/lib/libvcl/generate.py
index e6d78fe..eca1974 100755
--- a/lib/libvcl/generate.py
+++ b/lib/libvcl/generate.py
@@ -391,7 +391,7 @@ sp_variables = (
'STRING',
( 'backend_response',),
( 'backend_response',),
- 'R'
+ 'B'
),
('obj.proto',
'STRING',
More information about the varnish-commit
mailing list