diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index 392c150c2bbb..b5e00e64ad85 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -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.