Changeset d38709


Ignore:
Timestamp:
2012-02-15 13:49:25 (2 years ago)
Author:
Poul-Henning Kamp <phk@…>
Branches:
master, 4.0, experimental-ims
Children:
5d4e2c
Parents:
7703a5
git-author:
Poul-Henning Kamp <phk@…> (2012-02-15 13:49:25)
git-committer:
Poul-Henning Kamp <phk@…> (2012-02-15 13:49:25)
Message:

Make FetchStorage?() take a busyobj instead of a worker as arg.

Location:
bin/varnishd
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • bin/varnishd/cache/cache.h

    r7703a5 rd38709  
    746746void EXP_Rearm(const struct object *o); 
    747747int EXP_Touch(struct objcore *oc); 
    748 int EXP_NukeOne(struct vsl_log *, struct dstat *, struct lru *lru); 
     748int EXP_NukeOne(struct busyobj *, struct lru *lru); 
    749749 
    750750/* cache_fetch.c */ 
    751 struct storage *FetchStorage(struct worker *w, ssize_t sz); 
     751struct storage *FetchStorage(struct busyobj *, ssize_t sz); 
    752752int FetchError(struct busyobj *, const char *error); 
    753753int FetchError2(struct busyobj *, const char *error, const char *more); 
     
    10141014struct object *STV_NewObject(struct worker *wrk, const char *hint, unsigned len, 
    10151015    uint16_t nhttp); 
    1016 struct storage *STV_alloc(struct worker *w, size_t size); 
     1016struct storage *STV_alloc(struct busyobj *, size_t size); 
    10171017void STV_trim(struct storage *st, size_t size); 
    10181018void STV_free(struct storage *st); 
  • bin/varnishd/cache/cache_esi_fetch.c

    rbd9df97 rd38709  
    9595 
    9696        while (bytes > 0) { 
    97                 st = FetchStorage(wrk, 0); 
     97                st = FetchStorage(wrk->busyobj, 0); 
    9898                if (st == NULL) 
    9999                        return (-1); 
     
    397397                        assert(l > 0); 
    398398                        /* XXX: This is a huge waste of storage... */ 
    399                         bo->fetch_obj->esidata = STV_alloc(wrk, l); 
     399                        bo->fetch_obj->esidata = STV_alloc(bo, l); 
    400400                        if (bo->fetch_obj->esidata != NULL) { 
    401401                                memcpy(bo->fetch_obj->esidata->ptr, 
  • bin/varnishd/cache/cache_expire.c

    raf2bfa rd38709  
    415415 
    416416int 
    417 EXP_NukeOne(struct vsl_log *vsl, struct dstat *ds, struct lru *lru) 
     417EXP_NukeOne(struct busyobj *bo, struct lru *lru) 
    418418{ 
    419419        struct objcore *oc; 
     
    446446 
    447447        /* XXX: bad idea for -spersistent */ 
    448         WSL(vsl, SLT_ExpKill, -1, "%u LRU", oc_getxid(ds, oc)); 
    449         (void)HSH_Deref(ds, oc, NULL); 
     448        WSL(bo->vsl, SLT_ExpKill, -1, "%u LRU", oc_getxid(bo->stats, oc)); 
     449        (void)HSH_Deref(bo->stats, oc, NULL); 
    450450        return (1); 
    451451} 
  • bin/varnishd/cache/cache_fetch.c

    r7703a5 rd38709  
    9393 
    9494        if (estimate > 0) 
    95                 (void)FetchStorage(wrk, estimate); 
     95                (void)FetchStorage(wrk->busyobj, estimate); 
    9696} 
    9797 
     
    115115        AZ(wrk->busyobj->fetch_failed); 
    116116        while (bytes > 0) { 
    117                 st = FetchStorage(wrk, 0); 
     117                st = FetchStorage(wrk->busyobj, 0); 
    118118                if (st == NULL) 
    119119                        return(-1); 
     
    171171 
    172172struct storage * 
    173 FetchStorage(struct worker *wrk, ssize_t sz) 
     173FetchStorage(struct busyobj *bo, ssize_t sz) 
    174174{ 
    175175        ssize_t l; 
     
    177177        struct object *obj; 
    178178 
    179         obj = wrk->busyobj->fetch_obj; 
     179        CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); 
     180        obj = bo->fetch_obj; 
    180181        CHECK_OBJ_NOTNULL(obj, OBJECT_MAGIC); 
    181182        st = VTAILQ_LAST(&obj->store, storagehead); 
     
    188189        if (l == 0) 
    189190                l = cache_param->fetch_chunksize; 
    190         st = STV_alloc(wrk, l); 
     191        st = STV_alloc(bo, l); 
    191192        if (st == NULL) { 
    192                 (void)FetchError(wrk->busyobj, "Could not get storage"); 
     193                (void)FetchError(bo, "Could not get storage"); 
    193194                return (NULL); 
    194195        } 
     
    508509 
    509510        /* 
    510          * XXX: The busyobj needs a dstat, but it is not obvious which one 
     511         * XXX: The busyobj needs a dstat, but it is not obvious which one 
    511512         * XXX: it should be (own/borrowed).  For now borrow the wrk's. 
    512513         */ 
  • bin/varnishd/cache/cache_gzip.c

    rb5f187 rd38709  
    208208        struct storage *st; 
    209209 
    210         st = FetchStorage(wrk, 0); 
     210        st = FetchStorage(wrk->busyobj, 0); 
    211211        if (st == NULL) 
    212212                return (-1); 
     
    628628        AZ(vg->vz.avail_in); 
    629629        while (bytes > 0) { 
    630                 st = FetchStorage(wrk, 0); 
     630                st = FetchStorage(wrk->busyobj, 0); 
    631631                if (st == NULL) 
    632632                        return(-1); 
  • bin/varnishd/storage/stevedore.c

    raf2bfa rd38709  
    158158 
    159159static struct storage * 
    160 stv_alloc(struct worker *w, const struct object *obj, size_t size) 
     160stv_alloc(struct busyobj *bo, size_t size) 
    161161{ 
    162162        struct storage *st; 
    163163        struct stevedore *stv; 
    164164        unsigned fail = 0; 
     165        struct object *obj; 
    165166 
    166167        /* 
     
    168169         * keep an object inside the same stevedore. 
    169170         */ 
     171        CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); 
     172        obj = bo->fetch_obj; 
    170173        CHECK_OBJ_NOTNULL(obj, OBJECT_MAGIC); 
    171         CHECK_OBJ_NOTNULL(w, WORKER_MAGIC); 
    172174        stv = obj->objstore->stevedore; 
    173175        CHECK_OBJ_NOTNULL(stv, STEVEDORE_MAGIC); 
     
    189191 
    190192                /* no luck; try to free some space and keep trying */ 
    191                 if (EXP_NukeOne(w->vsl, &w->stats, stv->lru) == -1) 
     193                if (EXP_NukeOne(bo, stv->lru) == -1) 
    192194                        break; 
    193195 
     
    338340        } 
    339341        if (o == NULL) { 
     342                /* XXX: lend busyobj wrk's stats while we nuke */ 
     343                AZ(wrk->busyobj->stats); 
     344                wrk->busyobj->stats = &wrk->stats; 
    340345                /* no luck; try to free some space and keep trying */ 
    341346                for (i = 0; o == NULL && i < cache_param->nuke_limit; i++) { 
    342                         if (EXP_NukeOne(wrk->vsl, &wrk->stats, stv->lru) == -1) 
     347                        if (EXP_NukeOne(wrk->busyobj, stv->lru) == -1) 
    343348                                break; 
    344349                        o = stv->allocobj(stv, wrk, ltot, &soc); 
    345350                } 
     351                wrk->busyobj->stats = NULL; 
    346352        } 
    347353 
     
    374380 
    375381struct storage * 
    376 STV_alloc(struct worker *w, size_t size) 
    377 { 
    378  
    379         return (stv_alloc(w, w->busyobj->fetch_obj, size)); 
     382STV_alloc(struct busyobj *bo, size_t size) 
     383{ 
     384 
     385        return (stv_alloc(bo, size)); 
    380386} 
    381387 
Note: See TracChangeset for help on using the changeset viewer.