From: phk Date: Sun, 22 Jun 2008 11:46:00 +0000 (+0000) Subject: Polish this to the new more general usage: X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4abbce5bffb9a4f35e3044661ddacf6bd8b7bdec;p=varnish Polish this to the new more general usage: Allocate smaller lumps. Don't extend to clear bits. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2770 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/include/vbm.h b/varnish-cache/include/vbm.h index 7015a1d9..e4582c41 100644 --- a/varnish-cache/include/vbm.h +++ b/varnish-cache/include/vbm.h @@ -38,7 +38,7 @@ */ #define VBITMAP_TYPE unsigned /* Our preferred wordsize */ -#define VBITMAP_LUMP (32*1024) /* How many bits we alloc at a time */ +#define VBITMAP_LUMP (1024) /* How many bits we alloc at a time */ #define VBITMAP_WORD (sizeof(VBITMAP_TYPE) * 8) #define VBITMAP_IDX(n) (n / VBITMAP_WORD) #define VBITMAP_BIT(n) (1U << (n % VBITMAP_WORD)) @@ -88,9 +88,8 @@ static inline void vbit_clr(struct vbitmap *vb, unsigned bit) { - if (bit >= vb->nbits) - vbit_expand(vb, bit); - vb->bits[VBITMAP_IDX(bit)] &= ~VBITMAP_BIT(bit); + if (bit < vb->nbits) + vb->bits[VBITMAP_IDX(bit)] &= ~VBITMAP_BIT(bit); } static inline int @@ -98,6 +97,6 @@ vbit_test(struct vbitmap *vb, unsigned bit) { if (bit >= vb->nbits) - vbit_expand(vb, bit); + return (0); return (vb->bits[VBITMAP_IDX(bit)] & VBITMAP_BIT(bit)); }