Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Mar 2011 22:26:41 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r219276 - head/sys/ufs/ffs
Message-ID:  <201103042226.p24MQfjU062419@svn.freebsd.org>

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



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