Commit 4070878b authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Give the stevedores alloc method a flag that tells that we are allocating

an object structure.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4266 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent deba7885
...@@ -169,7 +169,7 @@ STV_alloc(struct sess *sp, size_t size) ...@@ -169,7 +169,7 @@ STV_alloc(struct sess *sp, size_t size)
/* try to allocate from it */ /* try to allocate from it */
AN(stv->alloc); AN(stv->alloc);
st = stv->alloc(stv, size); st = stv->alloc(stv, size, 0);
if (st != NULL) if (st != NULL)
break; break;
......
...@@ -36,7 +36,7 @@ struct object; ...@@ -36,7 +36,7 @@ struct object;
typedef void storage_init_f(struct stevedore *, int ac, char * const *av); typedef void storage_init_f(struct stevedore *, int ac, char * const *av);
typedef void storage_open_f(const struct stevedore *); typedef void storage_open_f(const struct stevedore *);
typedef struct storage *storage_alloc_f(struct stevedore *, size_t size); typedef struct storage *storage_alloc_f(struct stevedore *, size_t size, int isobj);
typedef struct object *storage_alloc_obj_f(struct stevedore *, size_t size, double ttl); typedef struct object *storage_alloc_obj_f(struct stevedore *, size_t size, double ttl);
typedef void storage_trim_f(struct storage *, size_t size); typedef void storage_trim_f(struct storage *, size_t size);
typedef void storage_free_f(struct storage *); typedef void storage_free_f(struct storage *);
......
...@@ -461,11 +461,12 @@ smf_open(const struct stevedore *st) ...@@ -461,11 +461,12 @@ smf_open(const struct stevedore *st)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
static struct storage * static struct storage *
smf_alloc(struct stevedore *st, size_t size) smf_alloc(struct stevedore *st, size_t size, int isobj)
{ {
struct smf *smf; struct smf *smf;
struct smf_sc *sc = st->priv; struct smf_sc *sc = st->priv;
(void)isobj;
assert(size > 0); assert(size > 0);
size += (sc->pagesize - 1); size += (sc->pagesize - 1);
size &= ~(sc->pagesize - 1); size &= ~(sc->pagesize - 1);
......
...@@ -53,10 +53,11 @@ struct sma { ...@@ -53,10 +53,11 @@ struct sma {
}; };
static struct storage * static struct storage *
sma_alloc(struct stevedore *st, size_t size) sma_alloc(struct stevedore *st, size_t size, int isobj)
{ {
struct sma *sma; struct sma *sma;
(void)isobj;
Lck_Lock(&sma_mtx); Lck_Lock(&sma_mtx);
VSL_stats->sma_nreq++; VSL_stats->sma_nreq++;
if (VSL_stats->sma_nbytes + size > sma_max) if (VSL_stats->sma_nbytes + size > sma_max)
......
...@@ -1220,13 +1220,14 @@ smp_object(const struct sess *sp) ...@@ -1220,13 +1220,14 @@ smp_object(const struct sess *sp)
*/ */
static struct storage * static struct storage *
smp_alloc(struct stevedore *st, size_t size) smp_alloc(struct stevedore *st, size_t size, int isobj)
{ {
struct smp_sc *sc; struct smp_sc *sc;
struct storage *ss; struct storage *ss;
struct smp_seg *sg; struct smp_seg *sg;
size_t sz2; size_t sz2;
(void)isobj;
CAST_OBJ_NOTNULL(sc, st->priv, SMP_SC_MAGIC); CAST_OBJ_NOTNULL(sc, st->priv, SMP_SC_MAGIC);
Lck_Lock(&sc->mtx); Lck_Lock(&sc->mtx);
......
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