}
/*--------------------------------------------------------------------
- * Free a range. Attemt merge forward and backward, then sort into
+ * Free a range. Attempt merge forward and backward, then sort into
* free list according to age.
*/
if (sum < MINPAGES * (uintmax_t)getpagesize())
exit (2);
MTX_INIT(&sc->mtx);
+
+ VSL_stats->sm_bfree += sc->filesize;
}
/*--------------------------------------------------------------------*/
size += (sc->pagesize - 1);
size &= ~(sc->pagesize - 1);
LOCK(&sc->mtx);
+ VSL_stats->sm_nreq++;
smf = alloc_smf(sc, size);
CHECK_OBJ_NOTNULL(smf, SMF_MAGIC);
+ VSL_stats->sm_nobj++;
+ VSL_stats->sm_balloc += smf->size;
+ VSL_stats->sm_bfree -= smf->size;
UNLOCK(&sc->mtx);
XXXAN(smf);
assert(smf->size == size);
size &= ~(sc->pagesize - 1);
if (smf->size > size) {
LOCK(&sc->mtx);
+ VSL_stats->sm_balloc -= (smf->size - size);
+ VSL_stats->sm_bfree += (smf->size - size);
trim_smf(smf, size);
assert(smf->size == size);
UNLOCK(&sc->mtx);
CAST_OBJ_NOTNULL(smf, s->priv, SMF_MAGIC);
sc = smf->sc;
LOCK(&sc->mtx);
+ VSL_stats->sm_nobj--;
+ VSL_stats->sm_balloc -= smf->size;
+ VSL_stats->sm_bfree += smf->size;
free_smf(smf);
UNLOCK(&sc->mtx);
}
#include <stdlib.h>
+#include "shmlog.h"
#include "cache.h"
struct sma {
{
struct sma *sma;
+ VSL_stats->sm_nreq++;
sma = calloc(sizeof *sma, 1);
XXXAN(sma);
sma->s.priv = sma;
sma->s.fd = -1;
sma->s.stevedore = st;
sma->s.magic = STORAGE_MAGIC;
+ VSL_stats->sm_nobj++;
+ VSL_stats->sm_balloc += sma->s.space;
return (&sma->s);
}
struct sma *sma;
sma = s->priv;
+ VSL_stats->sm_nobj--;
+ VSL_stats->sm_balloc -= sma->s.space;
free(sma->s.ptr);
free(sma);
}