[master] 245ea1d Push busyobj out of STV_NewObject()
Poul-Henning Kamp
phk at FreeBSD.org
Mon Sep 15 14:46:42 CEST 2014
commit 245ea1daf39d54f48baced99eb8d3ccdea0f28cf
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Sep 15 12:46:27 2014 +0000
Push busyobj out of STV_NewObject()
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index e6d5369..fc7a2d9 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -1216,7 +1216,8 @@ void RFC2616_Weaken_Etag(struct http *hp);
void RFC2616_Vary_AE(struct http *hp);
/* stevedore.c */
-int STV_NewObject(struct busyobj *, const char *hint, unsigned len);
+int STV_NewObject(struct objcore *, struct vsl_log *, struct dstat *,
+ const char *hint, unsigned len);
struct storage *STV_alloc(struct stevedore *, size_t size);
void STV_trim(struct storage *st, size_t size, int move_ok);
void STV_free(struct storage *st);
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 04df133..b245b82 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -66,7 +66,8 @@ vbf_allocobj(struct busyobj *bo, unsigned l)
bo->storage_hint = NULL;
- if (STV_NewObject(bo, storage_hint, l))
+ if (STV_NewObject(bo->fetch_objcore, bo->vsl, bo->stats,
+ storage_hint, l))
return (1);
if (storage_hint != NULL && !strcmp(storage_hint, TRANSIENT_STORAGE))
@@ -81,7 +82,8 @@ vbf_allocobj(struct busyobj *bo, unsigned l)
oc->exp.ttl = cache_param->shortlived;
oc->exp.grace = 0.0;
oc->exp.keep = 0.0;
- return (STV_NewObject(bo, TRANSIENT_STORAGE, l));
+ return (STV_NewObject(bo->fetch_objcore, bo->vsl, bo->stats,
+ TRANSIENT_STORAGE, l));
}
/*--------------------------------------------------------------------
diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c
index c1fb802..58ab16f 100644
--- a/bin/varnishd/storage/stevedore.c
+++ b/bin/varnishd/storage/stevedore.c
@@ -246,27 +246,27 @@ stv_default_allocobj(struct stevedore *stv, struct objcore *oc, unsigned ltot)
*/
int
-STV_NewObject(struct busyobj *bo, const char *hint, unsigned wsl)
+STV_NewObject(struct objcore *oc, struct vsl_log *vsl, struct dstat *stats,
+ const char *hint, unsigned wsl)
{
- struct objcore *oc;
struct stevedore *stv, *stv0;
unsigned ltot;
int i, j;
- CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
- oc = bo->fetch_objcore;
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
+ AN(vsl);
+ AN(stats);
assert(wsl > 0);
wsl = PRNDUP(wsl);
ltot = sizeof(struct object) + wsl;
- stv = stv0 = stv_pick_stevedore(bo->vsl, &hint);
+ stv = stv0 = stv_pick_stevedore(vsl, &hint);
AN(stv->allocobj);
j = stv->allocobj(stv, oc, ltot);
if (j == 0 && hint == NULL) {
do {
- stv = stv_pick_stevedore(bo->vsl, &hint);
+ stv = stv_pick_stevedore(vsl, &hint);
AN(stv->allocobj);
j = stv->allocobj(stv, oc, ltot);
} while (j == 0 && stv != stv0);
@@ -274,7 +274,7 @@ STV_NewObject(struct busyobj *bo, const char *hint, unsigned wsl)
if (j == 0) {
/* no luck; try to free some space and keep trying */
for (i = 0; j == 0 && i < cache_param->nuke_limit; i++) {
- if (EXP_NukeOne(bo->vsl, bo->stats, stv->lru) == -1)
+ if (EXP_NukeOne(vsl, stats, stv->lru) == -1)
break;
j = stv->allocobj(stv, oc, ltot);
}
@@ -283,8 +283,8 @@ STV_NewObject(struct busyobj *bo, const char *hint, unsigned wsl)
if (j == 0)
return (0);
- bo->stats->n_object++;
- VSLb(bo->vsl, SLT_Storage, "%s %s",
+ stats->n_object++;
+ VSLb(vsl, SLT_Storage, "%s %s",
oc->stobj->stevedore->name, oc->stobj->stevedore->ident);
return (1);
}
More information about the varnish-commit
mailing list