[master] 33330796d v1l: simplify workspace reservation handling

Nils Goroll nils.goroll at uplex.de
Mon Oct 5 13:46:06 UTC 2020


commit 33330796df3526a649352539f2bc860e83ab5aca
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed Sep 16 10:55:16 2020 +0200

    v1l: simplify workspace reservation handling
    
    For niov == 0, we reserve up to IOV_MAX io vectors, otherwise niov io
    vectors capped to IOV_MAX.
    
    We used to handle the two cases differently and delay the WS_Release for
    niov == 0 until V1L_Close(). There is no need to do so, in both cases we
    can just reduce the reservation (turned into allocation) to the amount
    of space we actually use.
    
    As we are rolling back the workspace in V1L_Close(), this neither has
    any influence on the state after the close.

diff --git a/bin/varnishd/http1/cache_http1_line.c b/bin/varnishd/http1/cache_http1_line.c
index cd5020bd5..2499c68cb 100644
--- a/bin/varnishd/http1/cache_http1_line.c
+++ b/bin/varnishd/http1/cache_http1_line.c
@@ -120,8 +120,7 @@ V1L_Open(struct worker *wrk, struct ws *ws, int *fd, struct vsl_log *vsl,
 	v1l->vsl = vsl;
 	wrk->v1l = v1l;
 
-	if (niov != 0)
-		WS_Release(ws, u * sizeof(struct iovec));
+	WS_Release(ws, u * sizeof(struct iovec));
 }
 
 enum sess_close
@@ -137,8 +136,6 @@ V1L_Close(struct worker *wrk, uint64_t *cnt)
 	wrk->v1l = NULL;
 	CHECK_OBJ_NOTNULL(v1l, V1L_MAGIC);
 	*cnt = v1l->cnt;
-	if (WS_IsReserved(v1l->ws))
-		WS_Release(v1l->ws, 0);
 	WS_Rollback(v1l->ws, v1l->ws_snap);
 	ZERO_OBJ(v1l, sizeof *v1l);
 	return (sc);


More information about the varnish-commit mailing list