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
115742b0
Commit
115742b0
authored
Oct 07, 2020
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge ObjTrimStore into ObjExtend, as aid to #3298
parent
ed13c9f2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
27 additions
and
41 deletions
+27
-41
cache_esi_fetch.c
bin/varnishd/cache/cache_esi_fetch.c
+1
-1
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+5
-6
cache_fetch_proc.c
bin/varnishd/cache/cache_fetch_proc.c
+2
-2
cache_obj.c
bin/varnishd/cache/cache_obj.c
+15
-26
cache_req_body.c
bin/varnishd/cache/cache_req_body.c
+1
-2
cache_req_fsm.c
bin/varnishd/cache/cache_req_fsm.c
+1
-1
cache_varnishd.h
bin/varnishd/cache/cache_varnishd.h
+2
-3
No files found.
bin/varnishd/cache/cache_esi_fetch.c
View file @
115742b0
...
...
@@ -100,7 +100,7 @@ vfp_vep_callback(struct vfp_ctx *vc, void *priv, ssize_t l, enum vgz_flag flg)
VGZ_UpdateObj
(
vc
,
vef
->
vgz
,
VUA_UPDATE
);
if
(
dl
>
0
)
{
vef
->
tot
+=
dl
;
VFP_Extend
(
vc
,
dl
);
VFP_Extend
(
vc
,
dl
,
VFP_OK
);
}
}
while
(
i
!=
VGZ_ERROR
&&
(
!
VGZ_IbufEmpty
(
vef
->
vgz
)
||
VGZ_ObufFull
(
vef
->
vgz
)));
...
...
bin/varnishd/cache/cache_fetch.c
View file @
115742b0
...
...
@@ -517,7 +517,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
*/
static
enum
fetch_step
vbf_stp_fetchbody
(
struct
worker
*
wrk
,
struct
busyobj
*
bo
)
vbf_stp_fetchbody
(
const
struct
worker
*
wrk
,
struct
busyobj
*
bo
)
{
ssize_t
l
;
uint8_t
*
ptr
;
...
...
@@ -561,8 +561,8 @@ vbf_stp_fetchbody(struct worker *wrk, struct busyobj *bo)
AZ
(
vfc
->
failed
);
vfps
=
VFP_Suck
(
vfc
,
ptr
,
&
l
);
if
(
l
>
0
&&
vfps
!=
VFP_ERROR
)
{
VFP_Extend
(
vfc
,
l
);
if
(
l
>
=
0
&&
vfps
!=
VFP_ERROR
)
{
VFP_Extend
(
vfc
,
l
,
vfps
);
if
(
est
>=
l
)
est
-=
l
;
else
...
...
@@ -584,7 +584,6 @@ vbf_stp_fetchbody(struct worker *wrk, struct busyobj *bo)
}
}
ObjTrimStore
(
wrk
,
oc
);
return
(
F_STP_FETCHEND
);
}
...
...
@@ -729,7 +728,7 @@ vbf_objiterator(void *priv, unsigned flush, const void *ptr, ssize_t len)
if
(
len
<
l
)
l
=
len
;
memcpy
(
pd
,
ps
,
l
);
VFP_Extend
(
bo
->
vfc
,
l
);
VFP_Extend
(
bo
->
vfc
,
l
,
l
==
len
?
VFP_END
:
VFP_OK
);
ps
+=
l
;
len
-=
l
;
}
...
...
@@ -929,7 +928,7 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo)
if
(
l
>
ll
)
l
=
ll
;
memcpy
(
ptr
,
VSB_data
(
synth_body
)
+
o
,
l
);
VFP_Extend
(
bo
->
vfc
,
l
);
VFP_Extend
(
bo
->
vfc
,
l
,
l
==
ll
?
VFP_END
:
VFP_OK
);
ll
-=
l
;
o
+=
l
;
}
...
...
bin/varnishd/cache/cache_fetch_proc.c
View file @
115742b0
...
...
@@ -95,11 +95,11 @@ VFP_GetStorage(struct vfp_ctx *vc, ssize_t *sz, uint8_t **ptr)
}
void
VFP_Extend
(
const
struct
vfp_ctx
*
vc
,
ssize_t
sz
)
VFP_Extend
(
const
struct
vfp_ctx
*
vc
,
ssize_t
sz
,
enum
vfp_status
flg
)
{
CHECK_OBJ_NOTNULL
(
vc
,
VFP_CTX_MAGIC
);
ObjExtend
(
vc
->
wrk
,
vc
->
oc
,
sz
);
ObjExtend
(
vc
->
wrk
,
vc
->
oc
,
sz
,
flg
==
VFP_END
);
}
/**********************************************************************
...
...
bin/varnishd/cache/cache_obj.c
View file @
115742b0
...
...
@@ -47,7 +47,6 @@
* 2 ObjGetSpace() allocates space
* 2 ObjExtend() commits content
* 2 ObjWaitExtend() waits for content - used to implement ObjIterate())
* 2 ObjTrimStore() signals end of content addition
*
* 2 ObjSetAttr()
* 2 ObjCopyAttr()
...
...
@@ -212,23 +211,33 @@ ObjGetSpace(struct worker *wrk, struct objcore *oc, ssize_t *sz, uint8_t **ptr)
*
* This function extends the used part of the object a number of bytes
* into the last space returned by ObjGetSpace()
*
* The final flag must be set on the last call, and it will release any
* surplus space allocated.
*/
void
ObjExtend
(
struct
worker
*
wrk
,
struct
objcore
*
oc
,
ssize_t
l
)
ObjExtend
(
struct
worker
*
wrk
,
struct
objcore
*
oc
,
ssize_t
l
,
int
final
)
{
const
struct
obj_methods
*
om
=
obj_getmethods
(
oc
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
oc
->
boc
,
BOC_MAGIC
);
assert
(
l
>
0
);
(
void
)
final
;
assert
(
l
>=
0
);
Lck_Lock
(
&
oc
->
boc
->
mtx
);
AN
(
om
->
objextend
);
om
->
objextend
(
wrk
,
oc
,
l
);
oc
->
boc
->
len_so_far
+=
l
;
if
(
l
>
0
)
{
om
->
objextend
(
wrk
,
oc
,
l
);
oc
->
boc
->
len_so_far
+=
l
;
AZ
(
pthread_cond_broadcast
(
&
oc
->
boc
->
cond
));
}
Lck_Unlock
(
&
oc
->
boc
->
mtx
);
AZ
(
pthread_cond_broadcast
(
&
oc
->
boc
->
cond
));
assert
(
oc
->
boc
==
NULL
||
oc
->
boc
->
state
<
BOS_FINISHED
);
if
(
final
&&
om
->
objtrimstore
!=
NULL
)
om
->
objtrimstore
(
wrk
,
oc
);
}
/*====================================================================
...
...
@@ -320,26 +329,6 @@ ObjGetLen(struct worker *wrk, struct objcore *oc)
return
(
len
);
}
/*====================================================================
* ObjTrimStore()
*
* Release any surplus space allocated, we promise not to call ObjExtend()
* any more.
*/
void
ObjTrimStore
(
struct
worker
*
wrk
,
struct
objcore
*
oc
)
{
const
struct
obj_methods
*
om
=
obj_getmethods
(
oc
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
assert
(
oc
->
boc
==
NULL
||
oc
->
boc
->
state
<
BOS_FINISHED
);
if
(
om
->
objtrimstore
!=
NULL
)
om
->
objtrimstore
(
wrk
,
oc
);
}
/*====================================================================
* ObjSlim()
*
...
...
bin/varnishd/cache/cache_req_body.c
View file @
115742b0
...
...
@@ -124,7 +124,7 @@ vrb_pull(struct req *req, ssize_t maxsize, objiterate_f *func, void *priv)
if
(
r
)
break
;
}
else
{
ObjExtend
(
req
->
wrk
,
req
->
body_oc
,
l
);
ObjExtend
(
req
->
wrk
,
req
->
body_oc
,
l
,
vfps
==
VFP_END
);
}
}
...
...
@@ -142,7 +142,6 @@ vrb_pull(struct req *req, ssize_t maxsize, objiterate_f *func, void *priv)
return
(
r
);
}
ObjTrimStore
(
req
->
wrk
,
req
->
body_oc
);
AZ
(
ObjSetU64
(
req
->
wrk
,
req
->
body_oc
,
OA_LEN
,
req_bodybytes
));
HSH_DerefBoc
(
req
->
wrk
,
req
->
body_oc
);
...
...
bin/varnishd/cache/cache_req_fsm.c
View file @
115742b0
...
...
@@ -337,7 +337,7 @@ cnt_synth(struct worker *wrk, struct req *req)
if
(
sz
>
0
&&
ObjGetSpace
(
wrk
,
req
->
objcore
,
&
sz
,
&
ptr
)
&&
sz
>=
szl
)
{
memcpy
(
ptr
,
VSB_data
(
synth_body
),
szl
);
ObjExtend
(
wrk
,
req
->
objcore
,
szl
);
ObjExtend
(
wrk
,
req
->
objcore
,
szl
,
1
);
}
else
if
(
sz
>
0
)
{
szl
=
-
1
;
}
...
...
bin/varnishd/cache/cache_varnishd.h
View file @
115742b0
...
...
@@ -248,7 +248,7 @@ void Bereq_Rollback(struct busyobj *);
/* cache_fetch_proc.c */
void
VFP_Init
(
void
);
enum
vfp_status
VFP_GetStorage
(
struct
vfp_ctx
*
,
ssize_t
*
sz
,
uint8_t
**
ptr
);
void
VFP_Extend
(
const
struct
vfp_ctx
*
,
ssize_t
sz
);
void
VFP_Extend
(
const
struct
vfp_ctx
*
,
ssize_t
sz
,
enum
vfp_status
);
void
VFP_Setup
(
struct
vfp_ctx
*
vc
,
struct
worker
*
wrk
);
int
VFP_Open
(
struct
vfp_ctx
*
bo
);
uint64_t
VFP_Close
(
struct
vfp_ctx
*
bo
);
...
...
@@ -295,13 +295,12 @@ void ObjInit(void);
struct
objcore
*
ObjNew
(
const
struct
worker
*
);
void
ObjDestroy
(
const
struct
worker
*
,
struct
objcore
**
);
int
ObjGetSpace
(
struct
worker
*
,
struct
objcore
*
,
ssize_t
*
sz
,
uint8_t
**
ptr
);
void
ObjExtend
(
struct
worker
*
,
struct
objcore
*
,
ssize_t
l
);
void
ObjExtend
(
struct
worker
*
,
struct
objcore
*
,
ssize_t
l
,
int
final
);
uint64_t
ObjWaitExtend
(
const
struct
worker
*
,
const
struct
objcore
*
,
uint64_t
l
);
void
ObjSetState
(
struct
worker
*
,
const
struct
objcore
*
,
enum
boc_state_e
next
);
void
ObjWaitState
(
const
struct
objcore
*
,
enum
boc_state_e
want
);
void
ObjTrimStore
(
struct
worker
*
,
struct
objcore
*
);
void
ObjTouch
(
struct
worker
*
,
struct
objcore
*
,
vtim_real
now
);
void
ObjFreeObj
(
struct
worker
*
,
struct
objcore
*
);
void
ObjSlim
(
struct
worker
*
,
struct
objcore
*
);
...
...
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