Commit 44a35137 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Hide struct dstat from vmods.

parent ee58cb23
......@@ -250,18 +250,6 @@ struct acct_bereq {
/*--------------------------------------------------------------------*/
#define L0(t, n)
#define L1(t, n) t n;
#define VSC_FF(n,t,l,s,f,v,d,e) L##l(t, n)
struct dstat {
unsigned summs;
#include "tbl/vsc_f_main.h"
};
#undef L0
#undef L1
/*--------------------------------------------------------------------*/
struct vsl_log {
uint32_t *wlb, *wlp, *wle;
unsigned wlr;
......@@ -315,7 +303,7 @@ struct worker {
struct objhead *nobjhead;
struct objcore *nobjcore;
void *nhashpriv;
struct dstat stats[1];
struct dstat *stats;
struct vsl_log *vsl; // borrowed from req/bo
struct pool_task task;
......@@ -860,8 +848,8 @@ void *MPL_Get(struct mempool *mpl, unsigned *size);
void MPL_Free(struct mempool *mpl, void *item);
/* cache_obj.c */
struct objcore * ObjNew(struct worker *);
void ObjDestroy(struct worker *, struct objcore **);
struct objcore * ObjNew(const struct worker *);
void ObjDestroy(const struct worker *, struct objcore **);
typedef int objiterate_f(void *priv, int flush, const void *ptr, ssize_t len);
int ObjIterate(struct worker *, struct objcore *,
void *priv, objiterate_f *func, int final);
......@@ -920,8 +908,8 @@ const char *sess_close_2str(enum sess_close sc, int want_desc);
int Pool_Task(struct pool *pp, struct pool_task *task, enum task_prio prio);
int Pool_Task_Arg(struct worker *, enum task_prio, task_func_t *,
const void *arg, size_t arg_len);
void Pool_Sumstat(struct worker *w);
int Pool_TrySumstat(struct worker *wrk);
void Pool_Sumstat(const struct worker *w);
int Pool_TrySumstat(const struct worker *wrk);
void Pool_PurgeStat(unsigned nobj);
int Pool_Task_Any(struct pool_task *task, enum task_prio prio);
......
......@@ -72,7 +72,8 @@ struct rush {
static const struct hash_slinger *hash;
static struct objhead *private_oh;
static void hsh_rush1(struct worker *, struct objhead *, struct rush *, int);
static void hsh_rush1(const struct worker *, struct objhead *,
struct rush *, int);
static void hsh_rush2(struct worker *, struct rush *);
/*---------------------------------------------------------------------*/
......@@ -116,7 +117,7 @@ hsh_prealloc(struct worker *wrk)
/*---------------------------------------------------------------------*/
struct objcore *
HSH_Private(struct worker *wrk)
HSH_Private(const struct worker *wrk)
{
struct objcore *oc;
......@@ -156,7 +157,7 @@ HSH_Cleanup(struct worker *wrk)
}
void
HSH_DeleteObjHead(struct worker *wrk, struct objhead *oh)
HSH_DeleteObjHead(const struct worker *wrk, struct objhead *oh)
{
AZ(oh->refcnt);
......@@ -529,7 +530,7 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
*/
static void
hsh_rush1(struct worker *wrk, struct objhead *oh, struct rush *r, int max)
hsh_rush1(const struct worker *wrk, struct objhead *oh, struct rush *r, int max)
{
unsigned u;
struct req *req;
......
......@@ -132,7 +132,7 @@ obj_deleteboc(struct boc **p)
*/
struct objcore *
ObjNew(struct worker *wrk)
ObjNew(const struct worker *wrk)
{
struct objcore *oc;
......@@ -155,7 +155,7 @@ ObjNew(struct worker *wrk)
*/
void
ObjDestroy(struct worker *wrk, struct objcore **p)
ObjDestroy(const struct worker *wrk, struct objcore **p)
{
struct objcore *oc;
......
......@@ -64,7 +64,7 @@ pool_sumstat(const struct dstat *src)
}
void
Pool_Sumstat(struct worker *wrk)
Pool_Sumstat(const struct worker *wrk)
{
Lck_Lock(&wstat_mtx);
......@@ -74,7 +74,7 @@ Pool_Sumstat(struct worker *wrk)
}
int
Pool_TrySumstat(struct worker *wrk)
Pool_TrySumstat(const struct worker *wrk)
{
if (Lck_Trylock(&wstat_mtx))
return (0);
......
......@@ -31,6 +31,18 @@
#include "VSC_main.h"
/*--------------------------------------------------------------------*/
#define L0(t, n)
#define L1(t, n) t n;
#define VSC_FF(n,t,l,s,f,v,d,e) L##l(t, n)
struct dstat {
unsigned summs;
#include "tbl/vsc_f_main.h"
};
#undef L0
#undef L1
/* Prototypes etc ----------------------------------------------------*/
/* cache_acceptor.c */
......
......@@ -61,10 +61,13 @@ wrk_bgthread(void *arg)
{
struct bgthread *bt;
struct worker wrk;
struct dstat ds;
CAST_OBJ_NOTNULL(bt, arg, BGTHREAD_MAGIC);
THR_SetName(bt->name);
INIT_OBJ(&wrk, WORKER_MAGIC);
memset(&ds, 0, sizeof ds);
wrk.stats = &ds;
(void)bt->func(&wrk, bt->priv);
......@@ -93,6 +96,7 @@ static void
WRK_Thread(struct pool *qp, size_t stacksize, unsigned thread_workspace)
{
struct worker *w, ww;
struct dstat ds;
unsigned char ws[thread_workspace];
uintptr_t u;
......@@ -104,6 +108,8 @@ WRK_Thread(struct pool *qp, size_t stacksize, unsigned thread_workspace)
w = &ww;
INIT_OBJ(w, WORKER_MAGIC);
w->lastused = NAN;
memset(&ds, 0, sizeof ds);
w->stats = &ds;
AZ(pthread_cond_init(&w->cond, NULL));
WS_Init(w->aws, "wrk", ws, thread_workspace);
......
......@@ -74,7 +74,7 @@ void HSH_Purge(struct worker *, struct objhead *, double ttl, double grace,
void HSH_config(const char *h_arg);
struct boc *HSH_RefBoc(const struct objcore *);
void HSH_DerefBoc(struct worker *wrk, struct objcore *);
struct objcore *HSH_Private(struct worker *wrk);
struct objcore *HSH_Private(const struct worker *wrk);
void HSH_Abandon(struct objcore *oc);
int HSH_Snipe(const struct worker *, struct objcore *);
void HSH_Kill(struct objcore *);
......@@ -107,7 +107,7 @@ struct objhead {
void HSH_Fail(struct objcore *);
void HSH_Unbusy(struct worker *, struct objcore *);
void HSH_DeleteObjHead(struct worker *, struct objhead *);
void HSH_DeleteObjHead(const struct worker *, struct objhead *);
int HSH_DerefObjHead(struct worker *, struct objhead **);
int HSH_DerefObjCore(struct worker *, struct objcore **, int);
#define HSH_RUSH_POLICY -1
......
......@@ -389,7 +389,7 @@ smp_loaded_st(const struct smp_sc *sc, const struct smp_seg *sg,
* objcore methods for persistent objects
*/
struct object *
struct object * __match_proto__(sml_getobj_f)
smp_sml_getobj(struct worker *wrk, struct objcore *oc)
{
struct object *o;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment