[master] b4916ea Change a fieldname that keeps confusing me.
Poul-Henning Kamp
phk at varnish-cache.org
Mon Feb 7 15:12:02 CET 2011
commit b4916ea1bbed5cdd190c41152e241cef849b99c3
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Feb 7 14:11:48 2011 +0000
Change a fieldname that keeps confusing me.
diff --git a/bin/varnishd/storage_persistent.c b/bin/varnishd/storage_persistent.c
index 32c41cb..ceae27d 100644
--- a/bin/varnishd/storage_persistent.c
+++ b/bin/varnishd/storage_persistent.c
@@ -105,7 +105,6 @@ struct smp_seg {
uint32_t nobj; /* Number of objects */
uint32_t nalloc; /* Allocations */
- uint32_t nalloc1; /* Allocated objects */
uint32_t nfixed; /* How many fixed objects */
/* Only for open segment */
@@ -683,8 +682,8 @@ smp_find_so(const struct smp_seg *sg, const struct objcore *oc)
smp_idx = oc->priv2;
assert(smp_idx > 0);
- assert(smp_idx <= sg->nalloc1);
- so = &sg->objs[sg->nalloc1 - smp_idx];
+ assert(smp_idx <= sg->p.lobjlist);
+ so = &sg->objs[sg->p.lobjlist - smp_idx];
return (so);
}
@@ -968,8 +967,7 @@ smp_load_seg(const struct sess *sp, const struct smp_sc *sc, struct smp_seg *sg)
/* test OBJIDX */
so = (void*)(sc->base + sg->p.objlist);
sg->objs = so;
- sg->nalloc1 = sg->p.nalloc;
- no = sg->p.nalloc;
+ no = sg->p.lobjlist;
/* Clear the bogus "hold" count */
sg->nobj = 0;
for (;no > 0; so++,no--) {
@@ -1184,7 +1182,6 @@ smp_new_seg(struct smp_sc *sc)
IASSERTALIGN(sc, sc->next_bot);
IASSERTALIGN(sc, sc->next_top);
sg->objs = (void*)(sc->base + sc->next_top);
- sg->nalloc1 = 0;
}
/*--------------------------------------------------------------------
@@ -1216,7 +1213,7 @@ smp_close_seg(struct smp_sc *sc, struct smp_seg *sg)
* compact the segment.
*/
left = smp_spaceleft(sc, sg);
- len = sizeof(struct smp_object) * sg->nalloc1;
+ len = sizeof(struct smp_object) * sg->p.lobjlist;
if (len < left) {
dst = sc->next_bot + IRNUP(sc, SMP_SIGN_SPACE);
dp = sc->base + dst;
@@ -1232,7 +1229,6 @@ smp_close_seg(struct smp_sc *sc, struct smp_seg *sg)
/* Update the segment header */
sg->p.objlist = sc->next_top;
- sg->p.nalloc = sg->nalloc1;
/* Write the (empty) OBJIDX signature */
sc->next_top -= IRNUP(sc, SMP_SIGN_SPACE);
@@ -1408,7 +1404,7 @@ smp_allocx(struct stevedore *st, size_t min_size, size_t max_size,
(*so)->ban = 0.;
(*so)->ptr = NULL;
sg->objs = *so;
- *idx = ++sg->nalloc1;
+ *idx = ++sg->p.lobjlist;
}
(void)smp_spaceleft(sc, sg); /* for the assert */
}
@@ -1594,8 +1590,8 @@ debug_report_silo(struct cli *cli, const struct smp_sc *sc)
(uintmax_t)(sc->next_bot),
(uintmax_t)(sc->next_top),
(uintmax_t)(sc->next_top - sc->next_bot));
- cli_out(cli, "\t%u nobj, %u alloc, %u alloc1, %u fixed\n",
- sg->nobj, sg->nalloc, sg->nalloc1, sg->nfixed);
+ cli_out(cli, "\t%u nobj, %u alloc, %u lobjlist, %u fixed\n",
+ sg->nobj, sg->nalloc, sg->p.lobjlist, sg->nfixed);
VLIST_FOREACH(oc, &sg->lru->lru_head, lru_list) {
if (oc == &sg->lru->senteniel)
cli_out(cli, "\t\t(senteniel) %p\n", oc);
diff --git a/include/persistent.h b/include/persistent.h
index 596a7ed..6aebd40 100644
--- a/include/persistent.h
+++ b/include/persistent.h
@@ -122,10 +122,10 @@ struct smp_sign {
*/
struct smp_segptr {
- uint64_t offset;
- uint64_t length;
- uint64_t objlist;
- uint32_t nalloc;
+ uint64_t offset; /* rel to silo */
+ uint64_t length; /* rel to offset */
+ uint64_t objlist; /* rel to silo */
+ uint32_t lobjlist; /* len of objlist */
};
/*
More information about the varnish-commit
mailing list