svn commit: r220672 - stable/7/sys/ufs/ffs

John Baldwin jhb at FreeBSD.org
Fri Apr 15 20:26:37 UTC 2011


Author: jhb
Date: Fri Apr 15 20:26:36 2011
New Revision: 220672
URL: http://svn.freebsd.org/changeset/base/220672

Log:
  MFC 219276:
  Use ffs() to locate free bits in the inode bitmap rather than a loop with
  bit shifts.

Modified:
  stable/7/sys/ufs/ffs/ffs_alloc.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/ufs/ffs/ffs_alloc.c
==============================================================================
--- stable/7/sys/ufs/ffs/ffs_alloc.c	Fri Apr 15 20:26:24 2011	(r220671)
+++ stable/7/sys/ufs/ffs/ffs_alloc.c	Fri Apr 15 20:26:36 2011	(r220672)
@@ -1765,17 +1765,13 @@ ffs_nodealloccg(ip, cg, ipref, mode)
 		}
 	}
 	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