
From: David Howells <dhowells@redhat.com>

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/fs/dcache.c            |   10 ++--------
 25-akpm/fs/inode.c             |   10 ++--------
 25-akpm/include/linux/fs.h     |   13 +++++++------
 25-akpm/include/linux/kernel.h |    9 +++++++++
 25-akpm/mm/page_alloc.c        |   19 +++++--------------
 5 files changed, 25 insertions(+), 36 deletions(-)

diff -puN fs/dcache.c~permit-inode-dentry-hash-tables-to-be-allocated-max_order-size-update fs/dcache.c
--- 25/fs/dcache.c~permit-inode-dentry-hash-tables-to-be-allocated-max_order-size-update	2004-06-17 22:36:17.674845688 -0700
+++ 25-akpm/fs/dcache.c	2004-06-17 22:36:17.688843560 -0700
@@ -1564,7 +1564,6 @@ __setup("dhash_entries=", set_dhash_entr
 
 static void __init dcache_init_early(void)
 {
-	struct hlist_head *p;
 	int loop;
 
 	dentry_hashtable =
@@ -1576,13 +1575,8 @@ static void __init dcache_init_early(voi
 					&d_hash_shift,
 					&d_hash_mask);
 
-	p = dentry_hashtable;
-	loop = 1 << d_hash_shift;
-	do {
-		INIT_HLIST_HEAD(p);
-		p++;
-		loop--;
-	} while (loop);
+	for (loop = 0; loop < (1 << d_hash_shift); loop++)
+		INIT_HLIST_HEAD(&dentry_hashtable[loop]);
 }
 
 static void __init dcache_init(unsigned long mempages)
diff -puN fs/inode.c~permit-inode-dentry-hash-tables-to-be-allocated-max_order-size-update fs/inode.c
--- 25/fs/inode.c~permit-inode-dentry-hash-tables-to-be-allocated-max_order-size-update	2004-06-17 22:36:17.677845232 -0700
+++ 25-akpm/fs/inode.c	2004-06-17 22:36:17.690843256 -0700
@@ -1337,7 +1337,6 @@ __setup("ihash_entries=", set_ihash_entr
  */
 void __init inode_init_early(void)
 {
-	struct hlist_head *p;
 	int loop;
 
 	inode_hashtable =
@@ -1349,13 +1348,8 @@ void __init inode_init_early(void)
 					&i_hash_shift,
 					&i_hash_mask);
 
-	p = inode_hashtable;
-	loop = 1 << i_hash_shift;
-	do {
-		INIT_HLIST_HEAD(p);
-		p++;
-		loop--;
-	} while (loop);
+	for (loop = 0; loop < (1 << i_hash_shift); loop++)
+		INIT_HLIST_HEAD(&inode_hashtable[loop]);
 }
 
 void __init inode_init(unsigned long mempages)
diff -puN include/linux/fs.h~permit-inode-dentry-hash-tables-to-be-allocated-max_order-size-update include/linux/fs.h
--- 25/include/linux/fs.h~permit-inode-dentry-hash-tables-to-be-allocated-max_order-size-update	2004-06-17 22:36:17.679844928 -0700
+++ 25-akpm/include/linux/fs.h	2004-06-17 22:36:17.692842952 -0700
@@ -215,16 +215,17 @@ extern int leases_enable, dir_notify_ena
 #include <linux/list.h>
 #include <linux/radix-tree.h>
 #include <linux/audit.h>
+#include <linux/init.h>
 #include <asm/semaphore.h>
 #include <asm/byteorder.h>
 
 /* Used to be a macro which just called the function, now just a function */
 extern void update_atime (struct inode *);
 
-extern void inode_init(unsigned long);
-extern void inode_init_early(void);
-extern void mnt_init(unsigned long);
-extern void files_init(unsigned long);
+extern void __init inode_init(unsigned long);
+extern void __init inode_init_early(void);
+extern void __init mnt_init(unsigned long);
+extern void __init files_init(unsigned long);
 
 struct buffer_head;
 typedef int (get_block_t)(struct inode *inode, sector_t iblock,
@@ -1204,8 +1205,8 @@ extern int filp_close(struct file *, fl_
 extern char * getname(const char __user *);
 
 /* fs/dcache.c */
-extern void vfs_caches_init_early(void);
-extern void vfs_caches_init(unsigned long);
+extern void __init vfs_caches_init_early(void);
+extern void __init vfs_caches_init(unsigned long);
 
 #define __getname()	kmem_cache_alloc(names_cachep, SLAB_KERNEL)
 #define __putname(name) kmem_cache_free(names_cachep, (void *)(name))
diff -puN include/linux/kernel.h~permit-inode-dentry-hash-tables-to-be-allocated-max_order-size-update include/linux/kernel.h
--- 25/include/linux/kernel.h~permit-inode-dentry-hash-tables-to-be-allocated-max_order-size-update	2004-06-17 22:36:17.682844472 -0700
+++ 25-akpm/include/linux/kernel.h	2004-06-17 22:36:17.693842800 -0700
@@ -92,6 +92,15 @@ asmlinkage int printk(const char * fmt, 
 
 unsigned long int_sqrt(unsigned long);
 
+static inline int __attribute_pure__ long_log2(unsigned long x)
+{
+	int r = 0;
+	for (x >>= 1; x > 0; x >>= 1)
+		r++;
+	return r;
+}
+
+
 extern int printk_ratelimit(void);
 extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst);
 
diff -puN mm/page_alloc.c~permit-inode-dentry-hash-tables-to-be-allocated-max_order-size-update mm/page_alloc.c
--- 25/mm/page_alloc.c~permit-inode-dentry-hash-tables-to-be-allocated-max_order-size-update	2004-06-17 22:36:17.684844168 -0700
+++ 25-akpm/mm/page_alloc.c	2004-06-17 22:36:17.695842496 -0700
@@ -1983,15 +1983,6 @@ int lower_zone_protection_sysctl_handler
  * - it is assumed that the hash table must contain an exact power-of-2
  *   quantity of entries
  */
-static inline int calc_log2(unsigned long x) __attribute_pure__;
-static inline int calc_log2(unsigned long x)
-{
-	int r = 0;
-	for (x >>= 1; x > 0; x >>= 1)
-		r++;
-	return r;
-}
-
 void *__init alloc_large_system_hash(const char *tablename,
 				     unsigned long bucketsize,
 				     unsigned long numentries,
@@ -2016,7 +2007,7 @@ void *__init alloc_large_system_hash(con
 	else
 		mem <<= (PAGE_SHIFT - scale);
 
-	mem = 1UL << (calc_log2(mem) + 1);
+	mem = 1UL << (long_log2(mem) + 1);
 
 	/* limit allocation size */
 	max = (1UL << (PAGE_SHIFT + MAX_SYS_HASH_TABLE_ORDER)) / bucketsize;
@@ -2027,14 +2018,14 @@ void *__init alloc_large_system_hash(con
 	if (!numentries || numentries > max)
 		numentries = max;
 
-	log2qty = calc_log2(numentries);
+	log2qty = long_log2(numentries);
 
 	do {
 		size = bucketsize << log2qty;
 
-		table = alloc_bootmem(size);
+		table = (void *) alloc_bootmem(size);
 
-	} while (!table && size > PAGE_SIZE && --log2qty);
+	} while (!table && size > PAGE_SIZE);
 
 	if (!table)
 		panic("Failed to allocate %s hash table\n", tablename);
@@ -2042,7 +2033,7 @@ void *__init alloc_large_system_hash(con
 	printk("%s hash table entries: %d (order: %d, %lu bytes)\n",
 	       tablename,
 	       (1U << log2qty),
-	       calc_log2(size) - PAGE_SHIFT,
+	       long_log2(size) - PAGE_SHIFT,
 	       size);
 
 	if (_hash_shift)
_
