Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
d387098f
Commit
d387098f
authored
Feb 15, 2012
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make FetchStorage() take a busyobj instead of a worker as arg.
parent
7703a5f8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
23 deletions
+30
-23
cache.h
bin/varnishd/cache/cache.h
+3
-3
cache_esi_fetch.c
bin/varnishd/cache/cache_esi_fetch.c
+2
-2
cache_expire.c
bin/varnishd/cache/cache_expire.c
+3
-3
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+8
-7
cache_gzip.c
bin/varnishd/cache/cache_gzip.c
+2
-2
stevedore.c
bin/varnishd/storage/stevedore.c
+12
-6
No files found.
bin/varnishd/cache/cache.h
View file @
d387098f
...
...
@@ -745,10 +745,10 @@ void EXP_Inject(struct objcore *oc, struct lru *lru, double when);
void
EXP_Init
(
void
);
void
EXP_Rearm
(
const
struct
object
*
o
);
int
EXP_Touch
(
struct
objcore
*
oc
);
int
EXP_NukeOne
(
struct
vsl_log
*
,
struct
dstat
*
,
struct
lru
*
lru
);
int
EXP_NukeOne
(
struct
busyobj
*
,
struct
lru
*
lru
);
/* cache_fetch.c */
struct
storage
*
FetchStorage
(
struct
worker
*
w
,
ssize_t
sz
);
struct
storage
*
FetchStorage
(
struct
busyobj
*
,
ssize_t
sz
);
int
FetchError
(
struct
busyobj
*
,
const
char
*
error
);
int
FetchError2
(
struct
busyobj
*
,
const
char
*
error
,
const
char
*
more
);
int
FetchHdr
(
struct
sess
*
sp
,
int
need_host_hdr
,
int
sendbody
);
...
...
@@ -1013,7 +1013,7 @@ int RFC2616_Do_Cond(const struct sess *sp);
/* stevedore.c */
struct
object
*
STV_NewObject
(
struct
worker
*
wrk
,
const
char
*
hint
,
unsigned
len
,
uint16_t
nhttp
);
struct
storage
*
STV_alloc
(
struct
worker
*
w
,
size_t
size
);
struct
storage
*
STV_alloc
(
struct
busyobj
*
,
size_t
size
);
void
STV_trim
(
struct
storage
*
st
,
size_t
size
);
void
STV_free
(
struct
storage
*
st
);
void
STV_open
(
void
);
...
...
bin/varnishd/cache/cache_esi_fetch.c
View file @
d387098f
...
...
@@ -94,7 +94,7 @@ vfp_esi_bytes_uu(struct worker *wrk, const struct vef_priv *vef,
CHECK_OBJ_NOTNULL
(
vef
,
VEF_MAGIC
);
while
(
bytes
>
0
)
{
st
=
FetchStorage
(
wrk
,
0
);
st
=
FetchStorage
(
wrk
->
busyobj
,
0
);
if
(
st
==
NULL
)
return
(
-
1
);
wl
=
vef_read
(
htc
,
...
...
@@ -396,7 +396,7 @@ vfp_esi_end(struct worker *wrk)
l
=
VSB_len
(
vsb
);
assert
(
l
>
0
);
/* XXX: This is a huge waste of storage... */
bo
->
fetch_obj
->
esidata
=
STV_alloc
(
wrk
,
l
);
bo
->
fetch_obj
->
esidata
=
STV_alloc
(
bo
,
l
);
if
(
bo
->
fetch_obj
->
esidata
!=
NULL
)
{
memcpy
(
bo
->
fetch_obj
->
esidata
->
ptr
,
VSB_data
(
vsb
),
l
);
...
...
bin/varnishd/cache/cache_expire.c
View file @
d387098f
...
...
@@ -414,7 +414,7 @@ exp_timer(struct sess *sp, void *priv)
*/
int
EXP_NukeOne
(
struct
vsl_log
*
vsl
,
struct
dstat
*
ds
,
struct
lru
*
lru
)
EXP_NukeOne
(
struct
busyobj
*
bo
,
struct
lru
*
lru
)
{
struct
objcore
*
oc
;
...
...
@@ -445,8 +445,8 @@ EXP_NukeOne(struct vsl_log *vsl, struct dstat *ds, struct lru *lru)
return
(
-
1
);
/* XXX: bad idea for -spersistent */
WSL
(
vsl
,
SLT_ExpKill
,
-
1
,
"%u LRU"
,
oc_getxid
(
d
s
,
oc
));
(
void
)
HSH_Deref
(
d
s
,
oc
,
NULL
);
WSL
(
bo
->
vsl
,
SLT_ExpKill
,
-
1
,
"%u LRU"
,
oc_getxid
(
bo
->
stat
s
,
oc
));
(
void
)
HSH_Deref
(
bo
->
stat
s
,
oc
,
NULL
);
return
(
1
);
}
...
...
bin/varnishd/cache/cache_fetch.c
View file @
d387098f
...
...
@@ -92,7 +92,7 @@ vfp_nop_begin(struct worker *wrk, size_t estimate)
{
if
(
estimate
>
0
)
(
void
)
FetchStorage
(
wrk
,
estimate
);
(
void
)
FetchStorage
(
wrk
->
busyobj
,
estimate
);
}
/*--------------------------------------------------------------------
...
...
@@ -114,7 +114,7 @@ vfp_nop_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
AZ
(
wrk
->
busyobj
->
fetch_failed
);
while
(
bytes
>
0
)
{
st
=
FetchStorage
(
wrk
,
0
);
st
=
FetchStorage
(
wrk
->
busyobj
,
0
);
if
(
st
==
NULL
)
return
(
-
1
);
l
=
st
->
space
-
st
->
len
;
...
...
@@ -170,13 +170,14 @@ static struct vfp vfp_nop = {
*/
struct
storage
*
FetchStorage
(
struct
worker
*
wrk
,
ssize_t
sz
)
FetchStorage
(
struct
busyobj
*
bo
,
ssize_t
sz
)
{
ssize_t
l
;
struct
storage
*
st
;
struct
object
*
obj
;
obj
=
wrk
->
busyobj
->
fetch_obj
;
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
obj
=
bo
->
fetch_obj
;
CHECK_OBJ_NOTNULL
(
obj
,
OBJECT_MAGIC
);
st
=
VTAILQ_LAST
(
&
obj
->
store
,
storagehead
);
if
(
st
!=
NULL
&&
st
->
len
<
st
->
space
)
...
...
@@ -187,9 +188,9 @@ FetchStorage(struct worker *wrk, ssize_t sz)
l
=
sz
;
if
(
l
==
0
)
l
=
cache_param
->
fetch_chunksize
;
st
=
STV_alloc
(
wrk
,
l
);
st
=
STV_alloc
(
bo
,
l
);
if
(
st
==
NULL
)
{
(
void
)
FetchError
(
wrk
->
busyobj
,
"Could not get storage"
);
(
void
)
FetchError
(
bo
,
"Could not get storage"
);
return
(
NULL
);
}
AZ
(
st
->
len
);
...
...
@@ -507,7 +508,7 @@ FetchBody(struct worker *wrk, struct object *obj)
CHECK_OBJ_NOTNULL
(
obj
->
http
,
HTTP_MAGIC
);
/*
* XXX: The busyobj needs a dstat, but it is not obvious which one
* XXX: The busyobj needs a dstat, but it is not obvious which one
* XXX: it should be (own/borrowed). For now borrow the wrk's.
*/
AZ
(
bo
->
stats
);
...
...
bin/varnishd/cache/cache_gzip.c
View file @
d387098f
...
...
@@ -207,7 +207,7 @@ VGZ_ObufStorage(struct worker *wrk, struct vgz *vg)
{
struct
storage
*
st
;
st
=
FetchStorage
(
wrk
,
0
);
st
=
FetchStorage
(
wrk
->
busyobj
,
0
);
if
(
st
==
NULL
)
return
(
-
1
);
...
...
@@ -627,7 +627,7 @@ vfp_testgzip_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
CHECK_OBJ_NOTNULL
(
vg
,
VGZ_MAGIC
);
AZ
(
vg
->
vz
.
avail_in
);
while
(
bytes
>
0
)
{
st
=
FetchStorage
(
wrk
,
0
);
st
=
FetchStorage
(
wrk
->
busyobj
,
0
);
if
(
st
==
NULL
)
return
(
-
1
);
l
=
st
->
space
-
st
->
len
;
...
...
bin/varnishd/storage/stevedore.c
View file @
d387098f
...
...
@@ -157,18 +157,20 @@ stv_pick_stevedore(struct vsl_log *vsl, const char **hint)
/*-------------------------------------------------------------------*/
static
struct
storage
*
stv_alloc
(
struct
worker
*
w
,
const
struct
object
*
obj
,
size_t
size
)
stv_alloc
(
struct
busyobj
*
bo
,
size_t
size
)
{
struct
storage
*
st
;
struct
stevedore
*
stv
;
unsigned
fail
=
0
;
struct
object
*
obj
;
/*
* Always use the stevedore which allocated the object in order to
* keep an object inside the same stevedore.
*/
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
obj
=
bo
->
fetch_obj
;
CHECK_OBJ_NOTNULL
(
obj
,
OBJECT_MAGIC
);
CHECK_OBJ_NOTNULL
(
w
,
WORKER_MAGIC
);
stv
=
obj
->
objstore
->
stevedore
;
CHECK_OBJ_NOTNULL
(
stv
,
STEVEDORE_MAGIC
);
...
...
@@ -188,7 +190,7 @@ stv_alloc(struct worker *w, const struct object *obj, size_t size)
}
/* no luck; try to free some space and keep trying */
if
(
EXP_NukeOne
(
w
->
vsl
,
&
w
->
stats
,
stv
->
lru
)
==
-
1
)
if
(
EXP_NukeOne
(
bo
,
stv
->
lru
)
==
-
1
)
break
;
/* Enough is enough: try another if we have one */
...
...
@@ -337,12 +339,16 @@ STV_NewObject(struct worker *wrk, const char *hint, unsigned wsl,
}
while
(
o
==
NULL
&&
stv
!=
stv0
);
}
if
(
o
==
NULL
)
{
/* XXX: lend busyobj wrk's stats while we nuke */
AZ
(
wrk
->
busyobj
->
stats
);
wrk
->
busyobj
->
stats
=
&
wrk
->
stats
;
/* no luck; try to free some space and keep trying */
for
(
i
=
0
;
o
==
NULL
&&
i
<
cache_param
->
nuke_limit
;
i
++
)
{
if
(
EXP_NukeOne
(
wrk
->
vsl
,
&
wrk
->
stats
,
stv
->
lru
)
==
-
1
)
if
(
EXP_NukeOne
(
wrk
->
busyobj
,
stv
->
lru
)
==
-
1
)
break
;
o
=
stv
->
allocobj
(
stv
,
wrk
,
ltot
,
&
soc
);
}
wrk
->
busyobj
->
stats
=
NULL
;
}
if
(
o
==
NULL
)
...
...
@@ -373,10 +379,10 @@ STV_Freestore(struct object *o)
/*-------------------------------------------------------------------*/
struct
storage
*
STV_alloc
(
struct
worker
*
w
,
size_t
size
)
STV_alloc
(
struct
busyobj
*
bo
,
size_t
size
)
{
return
(
stv_alloc
(
w
,
w
->
busyobj
->
fetch_obj
,
size
));
return
(
stv_alloc
(
bo
,
size
));
}
void
...
...
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