svn commit: r219276 - head/sys/ufs/ffs

John Baldwin jhb at FreeBSD.org
Fri Mar 4 22:26:41 UTC 2011


Author: jhb
Date: Fri Mar  4 22:26:41 2011
New Revision: 219276
URL: http://svn.freebsd.org/changeset/base/219276

Log:
  Use ffs() to locate free bits in the inode bitmap rather than a loop with
  bit shifts.
  
  Reviewed by:	mckusick
  MFC after:	1 month

Modified:
  head/sys/ufs/ffs/ffs_alloc.c

Modified: head/sys/ufs/ffs/ffs_alloc.c
==============================================================================
--- head/sys/ufs/ffs/ffs_alloc.c	Fri Mar  4 20:37:38 2011	(r219275)
+++ head/sys/ufs/ffs/ffs_alloc.c	Fri Mar  4 22:26:41 2011	(r219276)
@@ -1782,17 +1782,13 @@ ffs_nodealloccg(ip, cg, ipref, mode, unu
 		}
 	}
 	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.


More information about the svn-src-all mailing list