From owner-svn-src-all@FreeBSD.ORG Fri Mar 4 22:26:41 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6030A106564A; Fri, 4 Mar 2011 22:26:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4F48C8FC0A; Fri, 4 Mar 2011 22:26:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p24MQfA5062421; Fri, 4 Mar 2011 22:26:41 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p24MQfjU062419; Fri, 4 Mar 2011 22:26:41 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201103042226.p24MQfjU062419@svn.freebsd.org> From: John Baldwin Date: Fri, 4 Mar 2011 22:26:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r219276 - head/sys/ufs/ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Mar 2011 22:26:41 -0000 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.