Use ffs() to locate free bits in the inode bitmap rather than a loop with

bit shifts.

Reviewed by:	mckusick
MFC after:	1 month
This commit is contained in:
John Baldwin 2011-03-04 22:26:41 +00:00
parent 5f82cfdf6c
commit 96e1934a43

View File

@ -1782,17 +1782,13 @@ ffs_nodealloccg(ip, cg, ipref, mode, unused)
}
}
i = start + len - loc;
map = inosused[i];
ipref = i * NBBY;
for (i = 1; i < (1 << NBBY); i <<= 1, ipref++) {
if ((map & i) == 0) {
cgp->cg_irotor = ipref;
goto gotit;
}
map = inosused[i] ^ 0xff;
if (map == 0) {
printf("fs = %s\n", fs->fs_fsmnt);
panic("ffs_nodealloccg: block not in map");
}
printf("fs = %s\n", fs->fs_fsmnt);
panic("ffs_nodealloccg: block not in map");
/* NOTREACHED */
ipref = i * NBBY + ffs(map) - 1;
cgp->cg_irotor = ipref;
gotit:
/*
* Check to see if we need to initialize more inodes.