Attempt to fix the rpm issue in build.
[linux-2.6.git] / linux-2.6-590-GC-dcookies.patch
1 --- linux-2.6.22.19-chopstix/fs/dcookies.c      2009-02-28 03:10:05.000000000 -0500
2 +++ linux-2.6.22.19-chopstix/fs/dcookies.c.orig 2008-02-25 18:59:40.000000000 -0500
3 @@ -38,19 +38,14 @@
4  static LIST_HEAD(dcookie_users);
5  static DEFINE_MUTEX(dcookie_mutex);
6  static struct kmem_cache *dcookie_cache __read_mostly;
7 -static struct list_head *dcookie_hashtable[2] __read_mostly;
8 +static struct list_head *dcookie_hashtable __read_mostly;
9  static size_t hash_size __read_mostly;
10 -unsigned int current_hash = 0;
11  
12  static inline int is_live(void)
13  {
14         return !(list_empty(&dcookie_users));
15  }
16  
17 -static inline int is_shared(void)
18 -{
19 -       return !(list_empty(&dcookie_users)) && !(list_empty(dcookie_users.next));
20 -}
21  
22  /* The dentry is locked, its address will do for the cookie */
23  static inline unsigned long dcookie_value(struct dcookie_struct * dcs)
24 @@ -72,7 +67,7 @@
25         struct list_head * pos;
26         struct list_head * list;
27  
28 -       list = dcookie_hashtable[current_hash] + dcookie_hash(dcookie);
29 +       list = dcookie_hashtable + dcookie_hash(dcookie);
30  
31         list_for_each(pos, list) {
32                 dcs = list_entry(pos, struct dcookie_struct, hash_list);
33 @@ -88,7 +83,7 @@
34  
35  static void hash_dcookie(struct dcookie_struct * dcs)
36  {
37 -       struct list_head * list = dcookie_hashtable[current_hash] + dcookie_hash(dcookie_value(dcs));
38 +       struct list_head * list = dcookie_hashtable + dcookie_hash(dcookie_value(dcs));
39         list_add(&dcs->hash_list, list);
40  }
41  
42 @@ -96,7 +91,7 @@
43  static struct dcookie_struct * alloc_dcookie(struct dentry * dentry,
44         struct vfsmount * vfsmnt)
45  {
46 -       struct dcookie_struct * dcs = kmem_cache_alloc(dcookie_cache, GFP_ATOMIC);
47 +       struct dcookie_struct * dcs = kmem_cache_alloc(dcookie_cache, GFP_KERNEL);
48         if (!dcs)
49                 return NULL;
50  
51 @@ -215,12 +210,8 @@
52         if (!dcookie_cache)
53                 goto out;
54  
55 -       dcookie_hashtable[0] = kmalloc(PAGE_SIZE, GFP_KERNEL);
56 -       if (!dcookie_hashtable[0])
57 -               goto out_kmem;
58 -    
59 -    dcookie_hashtable[1] = kmalloc(PAGE_SIZE, GFP_KERNEL);
60 -       if (!dcookie_hashtable[1])
61 +       dcookie_hashtable = kmalloc(PAGE_SIZE, GFP_KERNEL);
62 +       if (!dcookie_hashtable)
63                 goto out_kmem;
64  
65         err = 0;
66 @@ -244,15 +235,7 @@
67         hash_size = 1UL << hash_bits;
68  
69         /* And initialize the newly allocated array */
70 -       d = dcookie_hashtable[0];
71 -       i = hash_size;
72 -       do {
73 -               INIT_LIST_HEAD(d);
74 -               d++;
75 -               i--;
76 -       } while (i);
77 -
78 -    d = dcookie_hashtable[1];
79 +       d = dcookie_hashtable;
80         i = hash_size;
81         do {
82                 INIT_LIST_HEAD(d);
83 @@ -276,30 +259,6 @@
84         kmem_cache_free(dcookie_cache, dcs);
85  }
86  
87 -/* Switch to the second hash */
88 -int garbage_collect(void) {
89 -    struct list_head * list;
90 -       struct list_head * pos;
91 -       struct list_head * pos2;
92 -       struct dcookie_struct * dcs;
93 -       size_t i;
94 -
95 -    if (is_shared())
96 -        return -EAGAIN;
97 -
98 -       for (i = 0; i < hash_size; ++i) {
99 -               list = dcookie_hashtable[current_hash] + i;
100 -               list_for_each_safe(pos, pos2, list) {
101 -                       dcs = list_entry(pos, struct dcookie_struct, hash_list);
102 -                       list_del(&dcs->hash_list);
103 -                       free_dcookie(dcs);
104 -               }
105 -       }
106 -
107 -    current_hash = (current_hash & 1) ^ 1;
108 -
109 -    return 0;
110 -}
111  
112  static void dcookie_exit(void)
113  {
114 @@ -310,14 +269,7 @@
115         size_t i;
116  
117         for (i = 0; i < hash_size; ++i) {
118 -               list = dcookie_hashtable[0] + i;
119 -               list_for_each_safe(pos, pos2, list) {
120 -                       dcs = list_entry(pos, struct dcookie_struct, hash_list);
121 -                       list_del(&dcs->hash_list);
122 -                       free_dcookie(dcs);
123 -               }
124 -
125 -        list = dcookie_hashtable[1] + i;
126 +               list = dcookie_hashtable + i;
127                 list_for_each_safe(pos, pos2, list) {
128                         dcs = list_entry(pos, struct dcookie_struct, hash_list);
129                         list_del(&dcs->hash_list);
130 @@ -325,8 +277,7 @@
131                 }
132         }
133  
134 -       kfree(dcookie_hashtable[0]);
135 -       kfree(dcookie_hashtable[1]);
136 +       kfree(dcookie_hashtable);
137         kmem_cache_destroy(dcookie_cache);
138  }
139