head	1.1;
access;
symbols
	LKML-branch:1.1.0.2;
locks; strict;
comment	@# @;


1.1
date	2007.02.04.03.35.16;	author jsipek;	state dead;
branches
	1.1.2.1;
next	;

1.1.2.1
date	2007.02.04.03.35.16;	author jsipek;	state Exp;
branches;
next	;


desc
@@


1.1
log
@file remove-round-to-next-power-of-two was initially added on branch LKML-branch.
@
text
@@


1.1.2.1
log
@Move rebase mmap code on top of xattr enabled code & replace hand coded
round to the next power of two code with a call to __roundup_pow_of_two
@
text
@a0 42
fs/unionfs/: Use __roundup_pow_of_two instead of custom rounding code

Signed-off-by: Josef 'Jeff' Sipek <jsipek@@cs.sunysb.edu>

diff --git a/fs/unionfs/rdstate.c b/fs/unionfs/rdstate.c
index 16ce1bf..e240285 100644
--- a/fs/unionfs/rdstate.c
+++ b/fs/unionfs/rdstate.c
@@@@ -115,19 +115,12 @@@@ struct unionfs_dir_state *alloc_rdstate(struct inode *inode, int bindex)
 {
 	int i = 0;
 	int hashsize;
-	int mallocsize = sizeof(struct unionfs_dir_state);
+	unsigned long mallocsize = sizeof(struct unionfs_dir_state);
 	struct unionfs_dir_state *rdstate;
 
 	hashsize = guesstimate_hash_size(inode);
 	mallocsize += hashsize * sizeof(struct list_head);
-	/* Round it up to the next highest power of two. */
-	mallocsize--;
-	mallocsize |= mallocsize >> 1;
-	mallocsize |= mallocsize >> 2;
-	mallocsize |= mallocsize >> 4;
-	mallocsize |= mallocsize >> 8;
-	mallocsize |= mallocsize >> 16;
-	mallocsize++;
+	mallocsize = __roundup_pow_of_two(mallocsize);
 
 	/* This should give us about 500 entries anyway. */
 	if (mallocsize > PAGE_SIZE)
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index 8e9a1cc..fc87b03 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@@@ -41,6 +41,7 @@@@
 #include <linux/xattr.h>
 #include <linux/fs_stack.h>
 #include <linux/magic.h>
+#include <linux/log2.h>
 
 #include <asm/mman.h>
 #include <asm/system.h>
@

