src/sys/dev/md/md.c
/*
 * This function does the math and allocates the top level "indir" structure
 * for a device of "size" sectors.
 */
This function does the math and allocates the top level "indir" structure
for a device of "size" sectors.
This function does the math and allocates the top level " indir " structure for a device of " size " sectors .
static struct indir *
dimension(off_t size)
{
	off_t rcnt;
	struct indir *ip;
	int layer;
	rcnt = size;
	layer = 0;
	while (rcnt > NINDIR) {
		rcnt /= NINDIR;
		layer++;
	}
	ip = malloc(sizeof *ip, M_MD, M_WAITOK | M_ZERO);
	ip->array = malloc(sizeof(uintptr_t) * NINDIR,
	    M_MDSECT, M_WAITOK | M_ZERO);
	ip->total = NINDIR;
	ip->shift = layer * nshift;
	return (ip);
}
static struct indir * dimension ( off_t size ) { off_t rcnt ; struct indir * ip ; int layer ; rcnt = size ; layer = 0 ; while ( rcnt > NINDIR ) { rcnt /= NINDIR ; layer ++ ; } ip = malloc ( sizeof * ip , M_MD , M_WAITOK | M_ZERO ) ; ip -> array = malloc ( sizeof ( uintptr_t ) * NINDIR , M_MDSECT , M_WAITOK | M_ZERO ) ; ip -> total = NINDIR ; ip -> shift = layer * nshift ; return ( ip ) ; }
This function does the math and allocates the top level "indir" structure
 for a device of "size" sectors.
This function does the math and allocates the top level " indir " structure for a device of " size " sectors .
/*
	 * XXX: the top layer is probably not fully populated, so we allocate
	 * too much space for ip->array in here.
	 */