]> git.pld-linux.org Git - packages/kernel.git/blame - 2.6.1-hash_table_size-lkml.patch
- obsolete
[packages/kernel.git] / 2.6.1-hash_table_size-lkml.patch
CommitLineData
0ea6a5dc 1--- 2.6/fs/inode.c 2003-11-29 09:46:34.000000000 +0100
2+++ build-2.6/fs/inode.c 2003-11-29 10:19:21.000000000 +0100
3@@ -1327,6 +1327,20 @@
4 wake_up_all(wq);
5 }
6
7+static __initdata int ihash_entries;
8+
9+static int __init set_ihash_entries(char *str)
10+{
11+ get_option(&str, &ihash_entries);
12+ if (ihash_entries <= 0) {
13+ ihash_entries = 0;
14+ return 0;
15+ }
16+ return 1;
17+}
18+
19+__setup("ihash_entries=", set_ihash_entries);
20+
21 /*
22 * Initialize the waitqueues and inode hash table.
23 */
24@@ -1340,8 +1354,16 @@
25 for (i = 0; i < ARRAY_SIZE(i_wait_queue_heads); i++)
26 init_waitqueue_head(&i_wait_queue_heads[i].wqh);
27
28- mempages >>= (14 - PAGE_SHIFT);
29- mempages *= sizeof(struct hlist_head);
30+ if (!ihash_entries) {
31+ ihash_entries = mempages >> (14 - PAGE_SHIFT);
32+ /* Limit inode hash size. Override for nfs servers
33+ * that handle lots of files.
34+ */
35+ if (ihash_entries > 1024*1024)
36+ ihash_entries = 1024*1024;
37+ }
38+
39+ mempages = ihash_entries*sizeof(struct hlist_head);
40 for (order = 0; ((1UL << order) << PAGE_SHIFT) < mempages; order++)
41 ;
42
43--- 2.6/fs/dcache.c 2003-11-29 09:46:34.000000000 +0100
44+++ build-2.6/fs/dcache.c 2003-11-29 10:53:15.000000000 +0100
45@@ -1546,6 +1546,20 @@
46 return ino;
47 }
48
49+static __initdata int dhash_entries;
50+
51+static int __init set_dhash_entries(char *str)
52+{
53+ get_option(&str, &dhash_entries);
54+ if (dhash_entries <= 0) {
55+ dhash_entries = 0;
56+ return 0;
57+ }
58+ return 1;
59+}
60+
61+__setup("dhash_entries=", set_dhash_entries);
62+
63 static void __init dcache_init(unsigned long mempages)
64 {
65 struct hlist_head *d;
66@@ -1571,10 +1585,18 @@
67
68 set_shrinker(DEFAULT_SEEKS, shrink_dcache_memory);
69
70+ if (!dhash_entries) {
71 #if PAGE_SHIFT < 13
72- mempages >>= (13 - PAGE_SHIFT);
73+ mempages >>= (13 - PAGE_SHIFT);
74 #endif
75- mempages *= sizeof(struct hlist_head);
76+ dhash_entries = mempages;
77+ /* 8 mio is enough for general purpose systems.
78+ * For file servers, override with "dhash_entries="
79+ */
80+ if (dhash_entries > 8*1024*1024)
81+ dhash_entries = 8*1024*1024;
82+ }
83+ mempages = dhash_entries*sizeof(struct hlist_head);
84 for (order = 0; ((1UL << order) << PAGE_SHIFT) < mempages; order++)
85 ;
86
This page took 0.365812 seconds and 4 git commands to generate.