Calculate nshift only once.

Also noted by:	avg
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2010-07-06 18:22:57 +00:00
parent aa81ae08e9
commit d12fc952b7

View File

@ -255,7 +255,7 @@ dimension(off_t size)
{ {
off_t rcnt; off_t rcnt;
struct indir *ip; struct indir *ip;
int i, layer; int layer;
rcnt = size; rcnt = size;
layer = 0; layer = 0;
@ -263,9 +263,6 @@ dimension(off_t size)
rcnt /= NINDIR; rcnt /= NINDIR;
layer++; layer++;
} }
/* figure out log2(NINDIR) */
for (i = NINDIR, nshift = -1; i; nshift++)
i >>= 1;
/* /*
* XXX: the top layer is probably not fully populated, so we allocate * XXX: the top layer is probably not fully populated, so we allocate
@ -1220,6 +1217,11 @@ g_md_init(struct g_class *mp __unused)
caddr_t c; caddr_t c;
u_char *ptr, *name, *type; u_char *ptr, *name, *type;
unsigned len; unsigned len;
int i;
/* figure out log2(NINDIR) */
for (i = NINDIR, nshift = -1; i; nshift++)
i >>= 1;
mod = NULL; mod = NULL;
sx_init(&md_sx, "MD config lock"); sx_init(&md_sx, "MD config lock");