[master] 1ad90c3dd cache_busyobj: cleanup

Nils Goroll nils.goroll at uplex.de
Sun Feb 9 18:41:06 UTC 2025


commit 1ad90c3dde15146c7a9042565b221393cb2d8117
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Sun Feb 9 19:28:35 2025 +0100

    cache_busyobj: cleanup
    
    The two removed functions had just one call site and wrapped trivial code.
    
    We had three instances of AZ(bo->htc) in the VBO_ReleaseBusyObj code path.

diff --git a/bin/varnishd/cache/cache_busyobj.c b/bin/varnishd/cache/cache_busyobj.c
index 75a8c68b3..5293186fe 100644
--- a/bin/varnishd/cache/cache_busyobj.c
+++ b/bin/varnishd/cache/cache_busyobj.c
@@ -58,29 +58,6 @@ VBO_Init(void)
  * BusyObj handling
  */
 
-static struct busyobj *
-vbo_New(void)
-{
-	struct busyobj *bo;
-	unsigned sz;
-
-	bo = MPL_Get(vbopool, &sz);
-	XXXAN(bo);
-	bo->magic = BUSYOBJ_MAGIC;
-	bo->end = (char *)bo + sz;
-	return (bo);
-}
-
-static void
-vbo_Free(struct busyobj **bop)
-{
-	struct busyobj *bo;
-
-	TAKE_OBJ_NOTNULL(bo, bop, BUSYOBJ_MAGIC);
-	AZ(bo->htc);
-	MPL_Free(vbopool, bo);
-}
-
 struct busyobj *
 VBO_GetBusyObj(const struct worker *wrk, const struct req *req)
 {
@@ -91,8 +68,10 @@ VBO_GetBusyObj(const struct worker *wrk, const struct req *req)
 
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 
-	bo = vbo_New();
-	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+	bo = MPL_Get(vbopool, &sz);
+	XXXAN(bo);
+	bo->magic = BUSYOBJ_MAGIC;
+	bo->end = (char *)bo + sz;
 
 	p = (void*)(bo + 1);
 	p = (void*)PRNDUP(p);
@@ -173,8 +152,6 @@ VBO_ReleaseBusyObj(struct worker *wrk, struct busyobj **pbo)
 
 	VSL_End(bo->vsl);
 
-	AZ(bo->htc);
-
 	if (WS_Overflowed(bo->ws))
 		wrk->stats->ws_backend_overflow++;
 
@@ -190,5 +167,5 @@ VBO_ReleaseBusyObj(struct worker *wrk, struct busyobj **pbo)
 	WS_Rollback(bo->ws, 0);
 #endif
 
-	vbo_Free(&bo);
+	MPL_Free(vbopool, bo);
 }


More information about the varnish-commit mailing list