Calculate nshift only once.

Also noted by:	avg
MFC after:	1 week
This commit is contained in:
kib 2010-07-06 18:22:57 +00:00
parent 15d16124c2
commit cc677e94f4

View File

@ -255,7 +255,7 @@ dimension(off_t size)
{
off_t rcnt;
struct indir *ip;
int i, layer;
int layer;
rcnt = size;
layer = 0;
@ -263,9 +263,6 @@ dimension(off_t size)
rcnt /= NINDIR;
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
@ -1220,6 +1217,11 @@ g_md_init(struct g_class *mp __unused)
caddr_t c;
u_char *ptr, *name, *type;
unsigned len;
int i;
/* figure out log2(NINDIR) */
for (i = NINDIR, nshift = -1; i; nshift++)
i >>= 1;
mod = NULL;
sx_init(&md_sx, "MD config lock");