[Ocfs2-commits] jlbec commits r1688 - trunk/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Dec 3 14:06:30 CST 2004


Author: jlbec
Date: 2004-12-03 14:06:28 -0600 (Fri, 03 Dec 2004)
New Revision: 1688

Modified:
   trunk/src/localalloc.c
   trunk/src/ocfs.h
Log:

o Remove BITCOUNT()
o Make local_alloc_count_bits() less, um, silly



Modified: trunk/src/localalloc.c
===================================================================
--- trunk/src/localalloc.c	2004-12-03 00:48:18 UTC (rev 1687)
+++ trunk/src/localalloc.c	2004-12-03 20:06:28 UTC (rev 1688)
@@ -31,6 +31,7 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/highmem.h>
+#include <linux/bitops.h>
 
 #include "ocfs_log.h"
 #include "ocfs.h"
@@ -629,7 +630,6 @@
 static __u32 ocfs_local_alloc_count_bits(ocfs2_dinode *alloc)
 {
 	int i;
-	__u8 tmp;
 	__u8 *buffer;
 	__u32 count = 0;
 
@@ -637,9 +637,7 @@
 
 	buffer = LOCAL_ALLOC(alloc)->la_bitmap;
 	for (i = 0; i < LOCAL_ALLOC(alloc)->la_size; i++) {
-		memcpy(&tmp, buffer, 1);
-		count+= BITCOUNT(tmp);
-		buffer++;
+		count += hweight8(buffer[i]);
 	}
 
 	LOG_EXIT_ULONG ((unsigned long)count);

Modified: trunk/src/ocfs.h
===================================================================
--- trunk/src/ocfs.h	2004-12-03 00:48:18 UTC (rev 1687)
+++ trunk/src/ocfs.h	2004-12-03 20:06:28 UTC (rev 1688)
@@ -85,12 +85,6 @@
 	} while (0)
 
 
-#define BITCOUNT(x)     (((BX_(x)+(BX_(x)>>4)) & 0x0F0F0F0F) % 255)
-#define BX_(x)          ((x) - (((x)>>1)&0x77777777) \
-			     - (((x)>>2)&0x33333333) \
-			     - (((x)>>3)&0x11111111))
-
-
 #define OCFS_CURRENT_TIME               ocfs_get_seconds(CURRENT_TIME)
 #define OCFS_SET_INODE_TIME(i, x, y)    (ocfs_get_seconds(i->x) = (y))
 



More information about the Ocfs2-commits mailing list