Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Apr 2011 20:26:36 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r220672 - stable/7/sys/ufs/ffs
Message-ID:  <201104152026.p3FKQavd081011@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104152026.p3FKQavd081011>