Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Feb 2011 03:11:14 GMT
From:      Zheng Liu <lz@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 189112 for review
Message-ID:  <201102250311.p1P3BE5t086153@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@189112?ac=10

Change 189112 by lz@freebsd-dev on 2011/02/25 03:10:56

	   Update latest changes in ext2fs.

Affected files ...

.. //depot/projects/soc2010/extfs/src/sys/fs/ext2fs/ext2_alloc.c#33 integrate

Differences ...

==== //depot/projects/soc2010/extfs/src/sys/fs/ext2fs/ext2_alloc.c#33 (text+ko) ====

@@ -33,7 +33,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)ffs_alloc.c	8.8 (Berkeley) 2/21/94
- * $FreeBSD: src/sys/fs/ext2fs/ext2_alloc.c,v 1.6 2011/02/08 13:02:25 jhb Exp $
+ * $FreeBSD: src/sys/fs/ext2fs/ext2_alloc.c,v 1.7 2011/02/24 22:11:36 jhb Exp $
  */
 
 #include <sys/param.h>
@@ -1423,16 +1423,12 @@
 		}
 	} 
 	i = start + len - loc;
-	map = ibp[i];
-	ipref = i * NBBY;
-	for (i = 1; i < (1 << NBBY); i <<= 1, ipref++) {
-		if ((map & i) == 0) {
-			goto gotit;
-		}
+	map = ibp[i] ^ 0xff;
+	if (map == 0) {
+		printf("fs = %s\n", fs->e2fs_fsmnt);
+		panic("ext2fs_nodealloccg: block not in map");
 	}
-	printf("fs = %s\n", fs->e2fs_fsmnt);
-	panic("ext2fs_nodealloccg: block not in map");
-	/* NOTREACHED */
+	ipref = i * NBBY + ffs(map) - 1;
 gotit:
 	setbit(ibp, ipref);
 	EXT2_LOCK(ump);
@@ -1560,7 +1556,6 @@
 static daddr_t
 ext2_mapsearch(struct m_ext2fs *fs, char *bbp, daddr_t bpref)
 {
-	daddr_t bno;
 	int start, len, loc, i, map;
 
 	/*
@@ -1590,15 +1585,12 @@
 		}
 	}
 	i = start + len - loc;
-	map = bbp[i];
-	bno = i * NBBY;
-	for (i = 1; i < (1 << NBBY); i <<= 1, bno++) {
-		if ((map & i) == 0)
-			return (bno);
+	map = bbp[i] ^ 0xff;
+	if (map == 0) {
+		printf("fs = %s\n", fs->e2fs_fsmnt);
+		panic("ext2fs_mapsearch: block not in map");
 	}
-	printf("fs = %s\n", fs->e2fs_fsmnt);
-	panic("ext2fs_mapsearch: block not in map");
-	/* NOTREACHED */
+	return (i * NBBY + ffs(map) - 1);
 }
 
 /*



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