summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2011-03-04 22:26:41 +0000
committerjhb <jhb@FreeBSD.org>2011-03-04 22:26:41 +0000
commitd9f2a532570f381ba87c5dd039ca21e4fe9d4b3a (patch)
tree04dfc30b63b950e08181549826455a0288873ad6 /sys/ufs
parent2ad117efbde9b99d429aadcbea6799e5629cb5d9 (diff)
downloadFreeBSD-src-d9f2a532570f381ba87c5dd039ca21e4fe9d4b3a.zip
FreeBSD-src-d9f2a532570f381ba87c5dd039ca21e4fe9d4b3a.tar.gz
Use ffs() to locate free bits in the inode bitmap rather than a loop with
bit shifts. Reviewed by: mckusick MFC after: 1 month
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ffs/ffs_alloc.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c
index 392c150..b5e00e6 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.
OpenPOWER on IntegriCloud