[master] fa4f00e Skip checks on pointers and work lists when at VSL_ENDMARKER
Nils Goroll
nils.goroll at uplex.de
Fri Jun 26 14:38:38 CEST 2015
commit fa4f00e1d7654dfe12c56d1ae7122268e290773a
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Wed Jun 24 16:33:12 2015 +0200
Skip checks on pointers and work lists when at VSL_ENDMARKER
Safe a couple of needless calls to vslc_vsm_check when we know that
there are no new records and this no need to check shm references /
the next cursor.
diff --git a/lib/libvarnishapi/vsl_cursor.c b/lib/libvarnishapi/vsl_cursor.c
index b9bbcb3..52dde5f 100644
--- a/lib/libvarnishapi/vsl_cursor.c
+++ b/lib/libvarnishapi/vsl_cursor.c
@@ -125,18 +125,6 @@ vslc_vsm_next(const struct VSL_cursor *cursor)
assert(&c->cursor == cursor);
CHECK_OBJ_NOTNULL(c->vsm, VSM_MAGIC);
- i = vslc_vsm_check(&c->cursor, &c->next);
- if (i <= 0)
- /* Overrun */
- return (-3);
-
- /* Check VSL fantom and abandonment */
- if (*(volatile const uint32_t *)c->next.ptr == VSL_ENDMARKER) {
- if (VSM_invalid == VSM_StillValid(c->vsm, &c->vf) ||
- VSM_Abandoned(c->vsm))
- return (-2);
- }
-
while (1) {
t = *(volatile const uint32_t *)c->next.ptr;
AN(t);
@@ -151,13 +139,18 @@ vslc_vsm_next(const struct VSL_cursor *cursor)
}
if (t == VSL_ENDMARKER) {
+ if (VSM_invalid == VSM_StillValid(c->vsm, &c->vf) ||
+ VSM_Abandoned(c->vsm))
+ return (-2); /* VSL abandoned */
if (c->options & VSL_COPT_TAILSTOP)
- /* EOF */
- return (-1);
- else
- return (0);
+ return (-1); /* EOF */
+ return (0); /* No new records available */
}
+ i = vslc_vsm_check(&c->cursor, &c->next);
+ if (i <= 0)
+ return (-3); /* Overrun */
+
c->cursor.rec = c->next;
c->next.ptr = VSL_NEXT(c->next.ptr);
diff --git a/lib/libvarnishapi/vsl_dispatch.c b/lib/libvarnishapi/vsl_dispatch.c
index f03f932..459d0b7 100644
--- a/lib/libvarnishapi/vsl_dispatch.c
+++ b/lib/libvarnishapi/vsl_dispatch.c
@@ -1320,18 +1320,18 @@ VSLQ_Dispatch(struct VSLQ *vslq, VSLQ_dispatch_f *func, void *priv)
if (vslq->grouping == VSL_g_raw)
return (vslq_raw(vslq, func, priv));
+ /* Process next cursor input */
+ i = vslq_next(vslq);
+ if (i <= 0)
+ /* At end of log or cursor reports error condition */
+ return (i);
+
/* Check shmref list and buffer if necessary */
r = vslq_shmref_check(vslq);
if (r)
/* Buffering of shm ref failed */
return (r);
- /* Process next cursor input */
- i = vslq_next(vslq);
- if (i < 0)
- /* Cursor reports error condition */
- return (i);
-
/* Check vtx timeout */
now = VTIM_mono();
while (!VTAILQ_EMPTY(&vslq->incomplete)) {
More information about the varnish-commit
mailing list