Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
ac1fe6e8
Commit
ac1fe6e8
authored
Oct 21, 2014
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Used a linked list allocated of req->ws for VDPs
parent
8bcaeac6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
39 deletions
+56
-39
cache.h
bin/varnishd/cache/cache.h
+4
-16
cache_deliver_proc.c
bin/varnishd/cache/cache_deliver_proc.c
+27
-21
cache_filter.h
bin/varnishd/cache/cache_filter.h
+22
-0
cache_http1_deliver.c
bin/varnishd/http1/cache_http1_deliver.c
+3
-2
No files found.
bin/varnishd/cache/cache.h
View file @
ac1fe6e8
...
...
@@ -201,18 +201,6 @@ struct http {
* VFP filter state
*/
struct
vfp_entry
{
unsigned
magic
;
#define VFP_ENTRY_MAGIC 0xbe32a027
const
struct
vfp
*
vfp
;
void
*
priv1
;
intptr_t
priv2
;
enum
vfp_status
closed
;
VTAILQ_ENTRY
(
vfp_entry
)
list
;
uint64_t
calls
;
uint64_t
bytes_out
;
};
VTAILQ_HEAD
(
vfp_entry_s
,
vfp_entry
);
struct
vfp_ctx
{
...
...
@@ -534,6 +522,8 @@ struct busyobj {
/*--------------------------------------------------------------------*/
VTAILQ_HEAD
(
vdp_entry_s
,
vdp_entry
);
struct
req
{
unsigned
magic
;
#define REQ_MAGIC 0x2751aaa1
...
...
@@ -614,10 +604,8 @@ struct req {
#define RES_PIPE (1<<7)
/* Deliver pipeline */
#define N_VDPS 5
vdp_bytes
*
vdps
[
N_VDPS
];
void
*
vdpp
[
N_VDPS
];
int
vdp_nxt
;
struct
vdp_entry_s
vdp
;
struct
vdp_entry
*
vdp_nxt
;
/* Transaction VSL buffer */
struct
vsl_log
vsl
[
1
];
...
...
bin/varnishd/cache/cache_deliver_proc.c
View file @
ac1fe6e8
...
...
@@ -35,46 +35,52 @@
int
VDP_bytes
(
struct
req
*
req
,
enum
vdp_action
act
,
const
void
*
ptr
,
ssize_t
len
)
{
int
i
,
retval
;
int
retval
;
struct
vdp_entry
*
vdp
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
vdp
=
req
->
vdp_nxt
;
CHECK_OBJ_NOTNULL
(
vdp
,
VDP_ENTRY_MAGIC
);
req
->
vdp_nxt
=
VTAILQ_NEXT
(
vdp
,
list
);
assert
(
act
>
VDP_NULL
||
len
>
0
);
/* Call the present layer, while pointing to the next layer down */
i
=
req
->
vdp_nxt
--
;
assert
(
i
>=
0
&&
i
<
N_VDPS
);
retval
=
req
->
vdps
[
i
](
req
,
act
,
&
req
->
vdpp
[
i
],
ptr
,
len
);
req
->
vdp_nxt
++
;
retval
=
vdp
->
func
(
req
,
act
,
&
vdp
->
priv
,
ptr
,
len
);
req
->
vdp_nxt
=
vdp
;
return
(
retval
);
}
void
VDP_push
(
struct
req
*
req
,
vdp_bytes
*
func
,
void
*
priv
)
{
struct
vdp_entry
*
vdp
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
AN
(
func
);
/* Push another layer */
assert
(
req
->
vdp_nxt
>=
0
);
assert
(
req
->
vdp_nxt
+
1
<
N_VDPS
);
req
->
vdps
[
++
req
->
vdp_nxt
]
=
func
;
req
->
vdpp
[
req
->
vdp_nxt
]
=
priv
;
AZ
(
req
->
vdps
[
req
->
vdp_nxt
](
req
,
VDP_INIT
,
&
req
->
vdpp
[
req
->
vdp_nxt
],
NULL
,
0
));
vdp
=
WS_Alloc
(
req
->
ws
,
sizeof
*
vdp
);
AN
(
vdp
);
memset
(
vdp
,
0
,
sizeof
*
vdp
);
vdp
->
magic
=
VDP_ENTRY_MAGIC
;
vdp
->
func
=
func
;
vdp
->
priv
=
priv
;
VTAILQ_INSERT_HEAD
(
&
req
->
vdp
,
vdp
,
list
);
req
->
vdp_nxt
=
vdp
;
AZ
(
func
(
req
,
VDP_INIT
,
&
vdp
->
priv
,
NULL
,
0
));
}
void
VDP_pop
(
struct
req
*
req
,
vdp_bytes
*
func
)
{
struct
vdp_entry
*
vdp
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
/* Pop top layer */
assert
(
req
->
vdp_nxt
>=
1
);
assert
(
req
->
vdp_nxt
<
N_VDPS
);
assert
(
req
->
vdps
[
req
->
vdp_nxt
]
==
func
);
AZ
(
req
->
vdps
[
req
->
vdp_nxt
](
req
,
VDP_FINI
,
&
req
->
vdpp
[
req
->
vdp_nxt
],
NULL
,
0
));
AZ
(
req
->
vdpp
[
req
->
vdp_nxt
]);
req
->
vdps
[
req
->
vdp_nxt
]
=
NULL
;
req
->
vdp_nxt
--
;
vdp
=
VTAILQ_FIRST
(
&
req
->
vdp
);
CHECK_OBJ_NOTNULL
(
vdp
,
VDP_ENTRY_MAGIC
);
assert
(
vdp
->
func
==
func
);
VTAILQ_REMOVE
(
&
req
->
vdp
,
vdp
,
list
);
AZ
(
vdp
->
func
(
req
,
VDP_FINI
,
&
vdp
->
priv
,
NULL
,
0
));
AZ
(
vdp
->
priv
);
req
->
vdp_nxt
=
VTAILQ_FIRST
(
&
req
->
vdp
);
}
bin/varnishd/cache/cache_filter.h
View file @
ac1fe6e8
...
...
@@ -55,6 +55,19 @@ struct vfp {
intptr_t
priv2
;
};
struct
vfp_entry
{
unsigned
magic
;
#define VFP_ENTRY_MAGIC 0xbe32a027
const
struct
vfp
*
vfp
;
void
*
priv1
;
intptr_t
priv2
;
enum
vfp_status
closed
;
VTAILQ_ENTRY
(
vfp_entry
)
list
;
uint64_t
calls
;
uint64_t
bytes_out
;
};
extern
const
struct
vfp
vfp_gunzip
;
extern
const
struct
vfp
vfp_gzip
;
extern
const
struct
vfp
vfp_testgunzip
;
...
...
@@ -78,9 +91,18 @@ enum vdp_action {
VDP_FINISH
,
VDP_FINI
,
};
typedef
int
vdp_bytes
(
struct
req
*
,
enum
vdp_action
,
void
**
priv
,
const
void
*
ptr
,
ssize_t
len
);
struct
vdp_entry
{
unsigned
magic
;
#define VDP_ENTRY_MAGIC 0x353eb781
vdp_bytes
*
func
;
void
*
priv
;
VTAILQ_ENTRY
(
vdp_entry
)
list
;
};
int
VDP_bytes
(
struct
req
*
,
enum
vdp_action
act
,
const
void
*
ptr
,
ssize_t
len
);
void
VDP_push
(
struct
req
*
,
vdp_bytes
*
func
,
void
*
priv
);
void
VDP_pop
(
struct
req
*
,
vdp_bytes
*
func
);
bin/varnishd/http1/cache_http1_deliver.c
View file @
ac1fe6e8
...
...
@@ -46,7 +46,7 @@ v1d_bytes(struct req *req, enum vdp_action act, void **priv,
if
(
act
==
VDP_INIT
||
act
==
VDP_FINI
)
return
(
0
);
assert
(
req
->
vdp_nxt
==
-
1
);
/* always at the bottom of the pile */
AZ
(
req
->
vdp_nxt
);
/* always at the bottom of the pile */
if
(
len
>
0
)
wl
=
WRW_Write
(
req
->
wrk
,
ptr
,
len
);
...
...
@@ -336,8 +336,9 @@ V1D_Deliver(struct req *req, struct busyobj *bo)
http_SetHeader
(
req
->
resp
,
req
->
doclose
?
"Connection: close"
:
"Connection: keep-alive"
);
req
->
vdps
[
0
]
=
v1d_bytes
;
req
->
vdp_nxt
=
0
;
VTAILQ_INIT
(
&
req
->
vdp
);
VDP_push
(
req
,
v1d_bytes
,
NULL
);
if
(
req
->
wantbody
&&
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment