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
6895fcb6
Commit
6895fcb6
authored
Feb 25, 2014
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the same storage allocation policy for 304/IMS as for regular
fetches.
parent
911194b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
22 deletions
+49
-22
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+49
-22
No files found.
bin/varnishd/cache/cache_fetch.c
View file @
6895fcb6
...
...
@@ -55,6 +55,52 @@ vbf_release_req(struct busyobj *bo)
VBO_setstate
(
bo
,
BOS_REQ_DONE
);
}
/*--------------------------------------------------------------------
* Allocate an object, with fall-back to Transient.
* XXX: This somewhat overlaps the stuff in stevedore.c
* XXX: Should this be merged over there ?
*/
static
struct
object
*
vbf_allocobj
(
struct
busyobj
*
bo
,
unsigned
l
,
uint16_t
nhttp
)
{
struct
object
*
obj
;
const
char
*
storage_hint
;
double
lifetime
;
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
->
fetch_objcore
,
OBJCORE_MAGIC
);
lifetime
=
bo
->
exp
.
ttl
+
bo
->
exp
.
grace
+
bo
->
exp
.
keep
;
if
(
bo
->
uncacheable
||
lifetime
<
cache_param
->
shortlived
)
storage_hint
=
TRANSIENT_STORAGE
;
else
storage_hint
=
bo
->
storage_hint
;
bo
->
storage_hint
=
NULL
;
obj
=
STV_NewObject
(
bo
,
storage_hint
,
l
,
nhttp
);
if
(
obj
!=
NULL
)
return
(
obj
);
if
(
storage_hint
!=
NULL
&&
!
strcmp
(
storage_hint
,
TRANSIENT_STORAGE
))
return
(
NULL
);
/*
* Try to salvage the transaction by allocating a shortlived object
* on Transient storage.
*/
if
(
bo
->
exp
.
ttl
>
cache_param
->
shortlived
)
bo
->
exp
.
ttl
=
cache_param
->
shortlived
;
bo
->
exp
.
grace
=
0
.
0
;
bo
->
exp
.
keep
=
0
.
0
;
obj
=
STV_NewObject
(
bo
,
TRANSIENT_STORAGE
,
l
,
nhttp
);
return
(
obj
);
}
/*--------------------------------------------------------------------
* Turn the beresp into a obj
*/
...
...
@@ -100,32 +146,13 @@ vbf_beresp2obj(struct busyobj *bo)
if
(
bo
->
uncacheable
)
bo
->
fetch_objcore
->
flags
|=
OC_F_PASS
;
if
(
bo
->
uncacheable
||
bo
->
exp
.
ttl
+
bo
->
exp
.
grace
+
bo
->
exp
.
keep
<
cache_param
->
shortlived
)
bo
->
storage_hint
=
TRANSIENT_STORAGE
;
AN
(
bo
->
fetch_objcore
);
obj
=
STV_NewObject
(
bo
,
bo
->
storage_hint
,
l
,
nhttp
);
if
(
obj
==
NULL
&&
(
bo
->
storage_hint
==
NULL
||
strcmp
(
bo
->
storage_hint
,
TRANSIENT_STORAGE
)))
{
/*
* Try to salvage the transaction by allocating a
* shortlived object on Transient storage.
*/
if
(
bo
->
exp
.
ttl
>
cache_param
->
shortlived
)
bo
->
exp
.
ttl
=
cache_param
->
shortlived
;
bo
->
exp
.
grace
=
0
.
0
;
bo
->
exp
.
keep
=
0
.
0
;
obj
=
STV_NewObject
(
bo
,
TRANSIENT_STORAGE
,
l
,
nhttp
);
}
obj
=
vbf_allocobj
(
bo
,
l
,
nhttp
);
if
(
obj
==
NULL
)
return
(
-
1
);
CHECK_OBJ_NOTNULL
(
obj
,
OBJECT_MAGIC
);
bo
->
storage_hint
=
NULL
;
AZ
(
bo
->
fetch_obj
);
bo
->
fetch_obj
=
obj
;
...
...
@@ -563,7 +590,7 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
vl
=
0
;
l
+=
http_EstimateWS
(
bo
->
ims_obj
->
http
,
0
,
&
nhttp
);
obj
=
STV_NewObject
(
bo
,
bo
->
storage_hint
,
l
,
nhttp
);
obj
=
vbf_allocobj
(
bo
,
l
,
nhttp
);
if
(
obj
==
NULL
)
{
(
void
)
VFP_Error
(
bo
,
"Could not get storage"
);
VDI_CloseFd
(
&
bo
->
vbc
);
...
...
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