Skip to content

Commit

Permalink
Make obj.hits a native VCL_INT which are always 64 bit, so we can
Browse files Browse the repository at this point in the history
avoid the LONG_MAX check.
  • Loading branch information
bsdphk committed Dec 5, 2018
1 parent a9b537e commit b637c11
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
3 changes: 2 additions & 1 deletion bin/varnishd/cache/cache.h
Expand Up @@ -346,7 +346,8 @@ struct objcore {
struct objhead *objhead;
struct boc *boc;
vtim_real timer_when;
long hits;
VCL_INT hits;


vtim_real t_origin;
float ttl;
Expand Down
9 changes: 3 additions & 6 deletions bin/varnishd/cache/cache_hash.c
Expand Up @@ -473,8 +473,7 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp)
VSLb(req->vsl, SLT_HitMiss, "%u %.6f", xid, dttl);
return (HSH_HITMISS);
}
if (oc->hits < LONG_MAX)
oc->hits++;
oc->hits++;
AN(hsh_deref_objhead_unlock(wrk, &oh));
return (HSH_HIT);
}
Expand Down Expand Up @@ -502,8 +501,7 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp)
exp_oc->refcnt++;
*ocp = exp_oc;
if (EXP_Ttl_grace(req, exp_oc) > req->t_req) {
if (exp_oc->hits < LONG_MAX)
exp_oc->hits++;
exp_oc->hits++;
Lck_Unlock(&oh->mtx);
return (HSH_GRACE);
}
Expand All @@ -517,8 +515,7 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp)
/* we do not wait on the busy object if in grace */
exp_oc->refcnt++;
*ocp = exp_oc;
if (exp_oc->hits < LONG_MAX)
exp_oc->hits++;
exp_oc->hits++;
AN(hsh_deref_objhead_unlock(wrk, &oh));
return (HSH_GRACE);
}
Expand Down

0 comments on commit b637c11

Please sign in to comment.