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
246428b5
Commit
246428b5
authored
Feb 06, 2016
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A lot of commenting and some minor cleanups
parent
13c713a0
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
81 additions
and
34 deletions
+81
-34
cache_obj.c
bin/varnishd/cache/cache_obj.c
+54
-12
mgt_stevedore.c
bin/varnishd/storage/mgt_stevedore.c
+0
-1
storage.h
bin/varnishd/storage/storage.h
+21
-15
storage_file.c
bin/varnishd/storage/storage_file.c
+2
-2
storage_malloc.c
bin/varnishd/storage/storage_malloc.c
+2
-2
storage_persistent.c
bin/varnishd/storage/storage_persistent.c
+1
-1
storage_persistent.h
bin/varnishd/storage/storage_persistent.h
+1
-1
No files found.
bin/varnishd/cache/cache_obj.c
View file @
246428b5
...
...
@@ -25,18 +25,60 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Primary API:
* ObjNew Associate stevedore with oc
* ObjGetSpace Add space
* ObjExtend Commit space
* ObjDone Object completed
* ObjGetLen Len of committed space
* ObjIterate Iterate over committed space
* ObjReserveAttr Attr will be set later
* ObjSetAttr Set attr now
* ObjGetAttr Get attr no
* ObjRelease Done with attr ptr
* ObjTouch Object was used
* Lifetime of an objcore:
* phase 0 - nonexistent
* phase 1 - created, but no stevedore associated
* phase 2 - stevedore associated, being filled out
* phase 3 - stable, no changes happening
* phase 4 - unavailable, being dismantled
* phase 5 - stevedore disassociated
* phase 6 - nonexistent
*
* 0->1 ObjNew() creates objcore
*
* 1->2 STV_NewObject() associates a stevedore
*
* 2 ObjSetState() sets state
* 2 ObjWaitState() waits for particular state
* INVALID->REQ_DONE->STREAM->FINISHED->FAILED
*
* 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()
* 2 ObjSetFlag()
* 2 ObjSetDouble()
* 2 ObjSetU32()
* 2 ObjSetU64()
*
* 2->3 ObjStable() Will no longer be modified
*
* 23 ObjHasAttr()
* 23 ObjGetAttr()
* 23 ObjCheckFlag()
* 23 ObjGetDouble()
* 23 ObjGetU32()
* 23 ObjGetU64()
* 23 ObjGetLen()
* 23 ObjGetXID()
*
* 23 ObjIterate() ... over body
*
* 23 ObjTouch() Signal to LRU(-like) facilities
*
* 23 ObjUpdateMeta() ban/ttl/grace/keep changed
*
* 3->4 ObjSnipe() kill if not in use
* 3->4 ObjKill() make unavailable
*
* 234 ObjSlim() Release body storage (but retain attribute storage)
*
* 4->5 ObjFreeObj() disassociates stevedore
*
* 5->6 FREE_OBJ() ...in HSH_DerefObjCore()
*/
#include "config.h"
...
...
bin/varnishd/storage/mgt_stevedore.c
View file @
246428b5
...
...
@@ -186,7 +186,6 @@ STV_Config(const char *spec)
AN
(
stv
->
methods
);
if
(
!
strcmp
(
stv
->
ident
,
TRANSIENT_STORAGE
))
{
stv
->
transient
=
1
;
AZ
(
stv_transient
);
stv_transient
=
stv
;
}
else
{
...
...
bin/varnishd/storage/storage.h
View file @
246428b5
...
...
@@ -68,9 +68,9 @@ typedef int storage_baninfo_f(const struct stevedore *, enum baninfo event,
typedef
void
storage_banexport_f
(
const
struct
stevedore
*
,
const
uint8_t
*
bans
,
unsigned
len
);
typedef
struct
object
*
s
torage
_getobj_f
(
struct
worker
*
,
struct
objcore
*
);
typedef
struct
storage
*
s
torage
_alloc_f
(
const
struct
stevedore
*
,
size_t
size
);
typedef
void
s
torage
_free_f
(
struct
storage
*
);
typedef
struct
object
*
s
ml
_getobj_f
(
struct
worker
*
,
struct
objcore
*
);
typedef
struct
storage
*
s
ml
_alloc_f
(
const
struct
stevedore
*
,
size_t
size
);
typedef
void
s
ml
_free_f
(
struct
storage
*
);
/* Prototypes for VCL variable responders */
#define VRTSTVTYPE(ct) typedef ct storage_var_##ct(const struct stevedore *);
...
...
@@ -83,22 +83,28 @@ struct stevedore {
unsigned
magic
;
#define STEVEDORE_MAGIC 0x4baf43db
const
char
*
name
;
unsigned
transient
;
storage_init_f
*
init
;
/* called by mgt process */
storage_open_f
*
open
;
/* called by cache process */
storage_alloc_f
*
sml_alloc
;
/* --//-- only if SML */
storage_free_f
*
sml_free
;
/* --//-- only if SML */
storage_getobj_f
*
sml_getobj
;
/* --//-- only if SML */
storage_close_f
*
close
;
/* --//-- */
storage_allocobj_f
*
allocobj
;
/* --//-- */
storage_signal_close_f
*
signal_close
;
/* --//-- */
storage_baninfo_f
*
baninfo
;
/* --//-- */
storage_banexport_f
*
banexport
;
/* --//-- */
/* Called in MGT process */
storage_init_f
*
init
;
/* Called in cache process */
storage_open_f
*
open
;
storage_close_f
*
close
;
storage_allocobj_f
*
allocobj
;
storage_signal_close_f
*
signal_close
;
storage_baninfo_f
*
baninfo
;
storage_banexport_f
*
banexport
;
/* Only if SML is used */
sml_alloc_f
*
sml_alloc
;
sml_free_f
*
sml_free
;
sml_getobj_f
*
sml_getobj
;
const
struct
obj_methods
*
methods
;
struct
lru
*
lru
;
/* For storage_lru.c */
/* Only if LRU is used */
struct
lru
*
lru
;
#define VRTSTVVAR(nm, vtype, ctype, dval) storage_var_##ctype *var_##nm;
#include "tbl/vrt_stv_var.h"
...
...
bin/varnishd/storage/storage_file.c
View file @
246428b5
...
...
@@ -415,7 +415,7 @@ smf_open(struct stevedore *st)
/*--------------------------------------------------------------------*/
static
struct
storage
*
static
struct
storage
*
__match_proto__
(
sml_alloc_f
)
smf_alloc
(
const
struct
stevedore
*
st
,
size_t
size
)
{
struct
smf
*
smf
;
...
...
@@ -451,7 +451,7 @@ smf_alloc(const struct stevedore *st, size_t size)
/*--------------------------------------------------------------------*/
static
void
__match_proto__
(
s
torage
_free_f
)
static
void
__match_proto__
(
s
ml
_free_f
)
smf_free
(
struct
storage
*
s
)
{
struct
smf
*
smf
;
...
...
bin/varnishd/storage/storage_malloc.c
View file @
246428b5
...
...
@@ -59,7 +59,7 @@ struct sma {
static
struct
VSC_C_lck
*
lck_sma
;
static
struct
storage
*
static
struct
storage
*
__match_proto__
(
sml_alloc_f
)
sma_alloc
(
const
struct
stevedore
*
st
,
size_t
size
)
{
struct
sma_sc
*
sma_sc
;
...
...
@@ -125,7 +125,7 @@ sma_alloc(const struct stevedore *st, size_t size)
return
(
&
sma
->
s
);
}
static
void
__match_proto__
(
s
torage
_free_f
)
static
void
__match_proto__
(
s
ml
_free_f
)
sma_free
(
struct
storage
*
s
)
{
struct
sma_sc
*
sma_sc
;
...
...
bin/varnishd/storage/storage_persistent.c
View file @
246428b5
...
...
@@ -577,7 +577,7 @@ smp_allocobj(struct worker *wrk, const struct stevedore *stv,
* Allocate a bite
*/
static
struct
storage
*
static
struct
storage
*
__match_proto__
(
sml_alloc_f
)
smp_alloc
(
const
struct
stevedore
*
st
,
size_t
size
)
{
...
...
bin/varnishd/storage/storage_persistent.h
View file @
246428b5
...
...
@@ -307,7 +307,7 @@ void smp_new_seg(struct smp_sc *sc);
void
smp_close_seg
(
struct
smp_sc
*
sc
,
struct
smp_seg
*
sg
);
void
smp_init_oc
(
struct
objcore
*
oc
,
struct
smp_seg
*
sg
,
unsigned
objidx
);
void
smp_save_segs
(
struct
smp_sc
*
sc
);
s
torage
_getobj_f
smp_sml_getobj
;
s
ml
_getobj_f
smp_sml_getobj
;
void
smp_oc_objupdatemeta
(
struct
worker
*
,
struct
objcore
*
);
void
smp_oc_objfree
(
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