[master] afbe6b648 Make the internal representation of vxid's 64 bit wide.
Poul-Henning Kamp
phk at FreeBSD.org
Tue Oct 25 07:35:10 UTC 2022
commit afbe6b648503687b1e9a2571a9e87ab089fc7bee
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Oct 25 07:33:40 2022 +0000
Make the internal representation of vxid's 64 bit wide.
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 7ad710995..de022c726 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -58,7 +58,7 @@
/*--------------------------------------------------------------------*/
struct vxids {
- uint32_t vxid;
+ uint64_t vxid;
};
typedef struct vxids vxid_t;
@@ -66,7 +66,7 @@ typedef struct vxids vxid_t;
#define NO_VXID ((struct vxids){0})
#define IS_NO_VXID(x) ((x).vxid == 0)
#define VXID_TAG(x) ((x).vxid & (VSL_CLIENTMARKER|VSL_BACKENDMARKER))
-#define VXID(u) ((u.vxid) & VSL_IDENTMASK)
+#define VXID(u) ((uintmax_t)(u.vxid) & VSL_IDENTMASK)
#define IS_SAME_VXID(x, y) ((x).vxid == (y).vxid)
/*--------------------------------------------------------------------*/
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index 5a7bba66c..87d85d935 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -139,9 +139,9 @@ ved_include(struct req *preq, const char *src, const char *host,
wrk->stats->esi_req++;
req->esi_level = preq->esi_level + 1;
- VSLb(req->vsl, SLT_Begin, "req %u esi %u", VXID(preq->vsl->wid),
+ VSLb(req->vsl, SLT_Begin, "req %ju esi %u", VXID(preq->vsl->wid),
req->esi_level);
- VSLb(preq->vsl, SLT_Link, "req %u esi %u", VXID(req->vsl->wid),
+ VSLb(preq->vsl, SLT_Link, "req %ju esi %u", VXID(req->vsl->wid),
req->esi_level);
VSLb_ts_req(req, "Start", W_TIM_real(wrk));
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 154563f75..95bbc27f0 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -404,7 +404,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
if (bo->retries > 0)
http_Unset(bo->bereq, "\012X-Varnish:");
- http_PrintfHeader(bo->bereq, "X-Varnish: %u", VXID(bo->vsl->wid));
+ http_PrintfHeader(bo->bereq, "X-Varnish: %ju", VXID(bo->vsl->wid));
VCL_backend_fetch_method(bo->vcl, wrk, NULL, bo, NULL);
@@ -1147,9 +1147,9 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
#define REQ_BEREQ_FLAG(l, r, w, d) bo->l = req->l;
#include "tbl/req_bereq_flags.h"
- VSLb(bo->vsl, SLT_Begin, "bereq %u %s", VXID(req->vsl->wid), how);
+ VSLb(bo->vsl, SLT_Begin, "bereq %ju %s", VXID(req->vsl->wid), how);
VSLbs(bo->vsl, SLT_VCL_use, TOSTRAND(VCL_Name(bo->vcl)));
- VSLb(req->vsl, SLT_Link, "bereq %u %s", VXID(bo->vsl->wid), how);
+ VSLb(req->vsl, SLT_Link, "bereq %ju %s", VXID(bo->vsl->wid), how);
THR_SetBusyobj(bo);
diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index 23a961ed2..44fd82871 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -452,7 +452,7 @@ pan_req(struct vsb *vsb, const struct req *req)
if (PAN_dump_struct(vsb, req, REQ_MAGIC, "req"))
return;
xp = req->transport;
- VSB_printf(vsb, "vxid = %u, transport = %s", VXID(req->vsl->wid),
+ VSB_printf(vsb, "vxid = %ju, transport = %s", VXID(req->vsl->wid),
xp == NULL ? "NULL" : xp->name);
if (xp != NULL && xp->req_panic != NULL) {
@@ -553,7 +553,7 @@ pan_sess(struct vsb *vsb, const struct sess *sp)
if (PAN_dump_struct(vsb, sp, SESS_MAGIC, "sess"))
return;
- VSB_printf(vsb, "fd = %d, vxid = %u,\n",
+ VSB_printf(vsb, "fd = %d, vxid = %ju,\n",
sp->fd, VXID(sp->vxid));
VSB_printf(vsb, "t_open = %f,\n", sp->t_open);
VSB_printf(vsb, "t_idle = %f,\n", sp->t_idle);
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 1a1fd7e2a..457506209 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -153,10 +153,10 @@ Resp_Setup_Deliver(struct req *req)
http_ForceField(h, HTTP_HDR_PROTO, "HTTP/1.1");
if (req->is_hit)
- http_PrintfHeader(h, "X-Varnish: %u %u", VXID(req->vsl->wid),
+ http_PrintfHeader(h, "X-Varnish: %ju %u", VXID(req->vsl->wid),
ObjGetXID(req->wrk, oc));
else
- http_PrintfHeader(h, "X-Varnish: %u", VXID(req->vsl->wid));
+ http_PrintfHeader(h, "X-Varnish: %ju", VXID(req->vsl->wid));
/*
* We base Age calculation upon the last timestamp taken during client
@@ -193,7 +193,7 @@ Resp_Setup_Synth(struct req *req)
http_TimeHeader(h, "Date: ", W_TIM_real(req->wrk));
http_SetHeader(h, "Server: Varnish");
- http_PrintfHeader(h, "X-Varnish: %u", VXID(req->vsl->wid));
+ http_PrintfHeader(h, "X-Varnish: %ju", VXID(req->vsl->wid));
/*
* For late 100-continue, we suggest to VCL to close the connection to
@@ -767,8 +767,8 @@ cnt_pipe(struct worker *wrk, struct req *req)
wrk->stats->s_pipe++;
bo = VBO_GetBusyObj(wrk, req);
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
- VSLb(bo->vsl, SLT_Begin, "bereq %u pipe", VXID(req->vsl->wid));
- VSLb(req->vsl, SLT_Link, "bereq %u pipe", VXID(bo->vsl->wid));
+ VSLb(bo->vsl, SLT_Begin, "bereq %ju pipe", VXID(req->vsl->wid));
+ VSLb(req->vsl, SLT_Link, "bereq %ju pipe", VXID(bo->vsl->wid));
VSLb_ts_busyobj(bo, "Start", W_TIM_real(wrk));
THR_SetBusyobj(bo);
bo->sp = req->sp;
@@ -776,7 +776,7 @@ cnt_pipe(struct worker *wrk, struct req *req)
HTTP_Setup(bo->bereq, req->ws, bo->vsl, SLT_BereqMethod);
http_FilterReq(bo->bereq, req->http, 0); // XXX: 0 ?
- http_PrintfHeader(bo->bereq, "X-Varnish: %u", VXID(req->vsl->wid));
+ http_PrintfHeader(bo->bereq, "X-Varnish: %ju", VXID(req->vsl->wid));
http_ForceHeader(bo->bereq, H_Connection, "close");
if (req->want100cont) {
@@ -1112,7 +1112,7 @@ cnt_diag(struct req *req, const char *state)
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
- VSLb(req->vsl, SLT_Debug, "vxid %u STP_%s sp %p vcl %p",
+ VSLb(req->vsl, SLT_Debug, "vxid %ju STP_%s sp %p vcl %p",
req->vsl->wid.vxid, state, req->sp, req->vcl); // XXX_VXID
VSL_Flush(req->vsl, 0);
}
diff --git a/bin/varnishd/cache/cache_shmlog.c b/bin/varnishd/cache/cache_shmlog.c
index eccdf69e1..955382580 100644
--- a/bin/varnishd/cache/cache_shmlog.c
+++ b/bin/varnishd/cache/cache_shmlog.c
@@ -580,10 +580,10 @@ VSL_ChgId(struct vsl_log *vsl, const char *typ, const char *why, vxid_t vxid)
vsl_sanity(vsl);
ovxid = vsl->wid;
- VSLb(vsl, SLT_Link, "%s %u %s", typ, VXID(vxid), why);
+ VSLb(vsl, SLT_Link, "%s %ju %s", typ, VXID(vxid), why);
VSL_End(vsl);
vsl->wid = vxid;
- VSLb(vsl, SLT_Begin, "%s %u %s", typ, VXID(ovxid), why);
+ VSLb(vsl, SLT_Begin, "%s %ju %s", typ, VXID(ovxid), why);
}
/*--------------------------------------------------------------------*/
diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c
index cbe280d11..d3880f4af 100644
--- a/bin/varnishd/cache/cache_vrt_var.c
+++ b/bin/varnishd/cache/cache_vrt_var.c
@@ -776,7 +776,7 @@ VRT_r_req_xid(VRT_CTX)
CHECK_OBJ_NOTNULL(ctx->req->http, HTTP_MAGIC);
AN(ctx->req->vsl);
- return (WS_Printf(ctx->req->http->ws, "%u",
+ return (WS_Printf(ctx->req->http->ws, "%ju",
VXID(ctx->req->vsl->wid)));
}
@@ -788,7 +788,7 @@ VRT_r_bereq_xid(VRT_CTX)
CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
AN(ctx->bo->vsl);
- return (WS_Printf(ctx->ws, "%u", VXID(ctx->bo->vsl->wid)));
+ return (WS_Printf(ctx->ws, "%ju", VXID(ctx->bo->vsl->wid)));
}
VCL_STRING
@@ -807,7 +807,7 @@ VRT_r_sess_xid(VRT_CTX)
}
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
- return (WS_Printf(ctx->ws, "%u", VXID(sp->vxid)));
+ return (WS_Printf(ctx->ws, "%ju", VXID(sp->vxid)));
}
/*--------------------------------------------------------------------
diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c
index f22ffeef7..0d23af1de 100644
--- a/bin/varnishd/http1/cache_http1_fsm.c
+++ b/bin/varnishd/http1/cache_http1_fsm.c
@@ -254,8 +254,8 @@ http1_dissect(struct worker *wrk, struct req *req)
assert(IS_NO_VXID(req->vsl->wid));
req->vsl->wid = VXID_Get(wrk, VSL_CLIENTMARKER);
- VSLb(req->vsl, SLT_Begin, "req %u rxreq", VXID(req->sp->vxid));
- VSL(SLT_Link, req->sp->vxid, "req %u rxreq", VXID(req->vsl->wid));
+ VSLb(req->vsl, SLT_Begin, "req %ju rxreq", VXID(req->sp->vxid));
+ VSL(SLT_Link, req->sp->vxid, "req %ju rxreq", VXID(req->vsl->wid));
AZ(isnan(req->t_first)); /* First byte timestamp set by http1_wait */
AZ(isnan(req->t_req)); /* Complete req rcvd set by http1_wait */
req->t_prev = req->t_first;
diff --git a/bin/varnishd/http2/cache_http2_proto.c b/bin/varnishd/http2/cache_http2_proto.c
index 63c491fbd..fa50c6ec7 100644
--- a/bin/varnishd/http2/cache_http2_proto.c
+++ b/bin/varnishd/http2/cache_http2_proto.c
@@ -672,8 +672,8 @@ h2_rx_headers(struct worker *wrk, struct h2_sess *h2, struct h2_req *r2)
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
req->vsl->wid = VXID_Get(wrk, VSL_CLIENTMARKER);
- VSLb(req->vsl, SLT_Begin, "req %u rxreq", VXID(req->sp->vxid));
- VSL(SLT_Link, req->sp->vxid, "req %u rxreq", VXID(req->vsl->wid));
+ VSLb(req->vsl, SLT_Begin, "req %ju rxreq", VXID(req->sp->vxid));
+ VSL(SLT_Link, req->sp->vxid, "req %ju rxreq", VXID(req->vsl->wid));
h2->new_req = req;
req->sp = h2->sess;
More information about the varnish-commit
mailing list