~ubuntu-branches/ubuntu/vivid/aufs/vivid

« back to all changes in this revision

Viewing changes to patch/rt-compat.patch

  • Committer: Bazaar Package Importer
  • Author(s): Julian Andres Klode
  • Date: 2007-12-15 23:32:51 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20071215233251-2vgs2lmg8mai5d9e
Tags: 0+20071211-1ubuntu1
* Merge from debian unstable (LP: #175705), remaining changes:
  - Fix for Ubuntu Kernels (updated)
* patches/01_vserver.dpatch: Removed
* patches/06_ubuntu.dpatch: Added (update of ubuntu patch)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Checking RT patch for linux-2.6.23, I found,
 
2
- lock_list_first_entry() and lock_list_next_entry() were changed from
 
3
  'static inline'-ed function to 'global un-inlined'-ed function, and
 
4
  moved from lock_list.h to lock_list.c. They are not exported to kernel
 
5
  modules.
 
6
- lock_list_splice_init() was newly introduced, and it is not exported
 
7
  either.
 
8
 
 
9
Finally, you should,,,
 
10
- link aufs statically
 
11
- or, ask Ingo Molar to export them.
 
12
 
 
13
 
 
14
Index: fs/aufs/branch.c
 
15
===================================================================
 
16
RCS file: /cvsroot/aufs/aufs/fs/aufs/branch.c,v
 
17
retrieving revision 1.67
 
18
diff -u -p -r1.67 branch.c
 
19
--- fs/aufs/branch.c    5 Nov 2007 01:36:26 -0000       1.67
 
20
+++ fs/aufs/branch.c    14 Nov 2007 17:16:49 -0000
 
21
@@ -852,6 +852,7 @@ int br_mod(struct super_block *sb, struc
 
22
                if (!br_writable(mod->perm)) {
 
23
                        /* rw --> ro, file might be mmapped */
 
24
                        struct file *file, *hf;
 
25
+                       int idx;
 
26
 
 
27
 #if 1 // test here
 
28
                        DiMustNoWaiters(root);
 
29
@@ -863,7 +864,8 @@ int br_mod(struct super_block *sb, struc
 
30
                         * since BKL (and sbinfo) is locked
 
31
                         */
 
32
                        AuDebugOn(!kernel_locked());
 
33
-                       list_for_each_entry(file, &sb->s_files, f_u.fu_list) {
 
34
+                       idx = au_rt_s_files_lock(sb);
 
35
+                       au_rt_s_files_loop(file, sb) {
 
36
                                LKTRTrace("%.*s\n", AuDLNPair(file->f_dentry));
 
37
                                if (unlikely(!au_test_aufs_file(file)))
 
38
                                        continue;
 
39
@@ -885,6 +887,7 @@ int br_mod(struct super_block *sb, struc
 
40
                                FiMustNoWaiters(file);
 
41
                                fi_read_unlock(file);
 
42
                        }
 
43
+                       au_rt_s_files_unlock(sb, idx);
 
44
 
 
45
                        /* aufs_write_lock() calls ..._child() */
 
46
                        di_write_lock_child(root);
 
47
Index: fs/aufs/debug.c
 
48
===================================================================
 
49
RCS file: /cvsroot/aufs/aufs/fs/aufs/debug.c,v
 
50
retrieving revision 1.43
 
51
diff -u -p -r1.43 debug.c
 
52
--- fs/aufs/debug.c     12 Nov 2007 01:43:10 -0000      1.43
 
53
+++ fs/aufs/debug.c     14 Nov 2007 17:16:49 -0000
 
54
@@ -112,7 +112,7 @@ static int do_pri_inode(aufs_bindex_t bi
 
55
             ntfy,
 
56
             i_size_read(inode), (u64)inode->i_blocks,
 
57
             timespec_to_ns(&inode->i_ctime) & 0x0ffff,
 
58
-            inode->i_mapping ? inode->i_mapping->nrpages : 0,
 
59
+            inode->i_mapping ? au_mapping_nrpages(inode->i_mapping) : 0,
 
60
             inode->i_state, inode->i_flags, inode->i_generation,
 
61
             l ? ", wh " : "", l, n);
 
62
        return 0;
 
63
Index: fs/aufs/misc.h
 
64
===================================================================
 
65
RCS file: /cvsroot/aufs/aufs/fs/aufs/misc.h,v
 
66
retrieving revision 1.38
 
67
diff -u -p -r1.38 misc.h
 
68
--- fs/aufs/misc.h      12 Nov 2007 01:40:06 -0000      1.38
 
69
+++ fs/aufs/misc.h      14 Nov 2007 17:16:49 -0000
 
70
@@ -29,6 +29,142 @@
 
71
 #include <linux/version.h>
 
72
 #include <linux/aufs_type.h>
 
73
 
 
74
+
 
75
+/* ---------------------------------------------------------------------- */
 
76
+
 
77
+/*
 
78
+ * support for RT patch (testing).
 
79
+ * it uses 'standard compat_rw_semaphore' instead of 'realtime rw_semaphore.'
 
80
+ * sigh, wrapper for wrapper...
 
81
+ */
 
82
+
 
83
+#ifndef CONFIG_PREEMPT_RT
 
84
+
 
85
+#define au_rw_semaphore                rw_semaphore
 
86
+#define au_init_rwsem          init_rwsem
 
87
+#define au_down_read           down_read
 
88
+#define au_down_read_nested    down_read_nested
 
89
+#define au_down_read_trylock   down_read_trylock
 
90
+#define au_up_read             up_read
 
91
+#define au_downgrade_write     downgrade_write
 
92
+#define au_down_write          down_write
 
93
+#define au_down_write_nested   down_write_nested
 
94
+#define au_down_write_trylock  down_write_trylock
 
95
+#define au_up_write            up_write
 
96
+
 
97
+static inline int au_rt_s_files_lock(struct super_block *sb)
 
98
+{
 
99
+       /* nothing */
 
100
+       return 0;
 
101
+}
 
102
+
 
103
+static inline void au_rt_s_files_unlock(struct super_block *sb, int idx)
 
104
+{
 
105
+       /* nothing */
 
106
+}
 
107
+
 
108
+#define au_rt_s_files_loop(pos, sb) \
 
109
+       list_for_each_entry(pos, &(sb)->s_files, f_u.fu_list)
 
110
+#define au_rt_s_files_loop_break(pos)  do {} while (0)
 
111
+
 
112
+static inline unsigned long au_mapping_nrpages(struct address_space *mapping)
 
113
+{
 
114
+       return mapping->nrpages;
 
115
+}
 
116
+
 
117
+#else /* CONFIG_PREEMPT_RT */
 
118
+
 
119
+#define au_rw_semaphore                compat_rw_semaphore
 
120
+#define au_init_rwsem          compat_init_rwsem
 
121
+#define au_down_read           compat_down_read
 
122
+#define au_down_read_nested    compat_down_read_nested
 
123
+#define au_down_read_trylock   compat_down_read_trylock
 
124
+#define au_up_read             compat_up_read
 
125
+#define au_downgrade_write     compat_downgrade_write
 
126
+#define au_down_write          compat_down_write
 
127
+#define au_down_write_nested   compat_down_write_nested
 
128
+#define au_down_write_trylock  compat_down_write_trylock
 
129
+#define au_up_write            compat_up_write
 
130
+
 
131
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
 
132
+
 
133
+static inline int au_rt_s_files_lock(struct super_block *sb)
 
134
+{
 
135
+       int idx;
 
136
+       idx = qrcu_read_lock(&sb->s_qrcu);
 
137
+       percpu_list_fold(&sb->s_files);
 
138
+       return idx;
 
139
+}
 
140
+
 
141
+static inline void au_rt_s_files_unlock(struct super_block *sb, int idx)
 
142
+{
 
143
+       qrcu_read_unlock(&sb->s_qrcu, idx);
 
144
+}
 
145
+
 
146
+#define au_rt_s_files_loop(pos, sb) \
 
147
+       lock_list_for_each_entry(pos, percpu_list_head(&(sb)->s_files), \
 
148
+                                f_u.fu_llist)
 
149
+
 
150
+#define au_rt_s_files_loop_break(pos) \
 
151
+       lock_list_for_each_entry_stop(pos, f_u.fu_llist);
 
152
+
 
153
+static inline unsigned long au_mapping_nrpages(struct address_space *mapping)
 
154
+{
 
155
+       return mapping_nrpages(mapping);
 
156
+}
 
157
+
 
158
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
 
159
+
 
160
+static inline int au_rt_s_files_lock(struct super_block *sb)
 
161
+{
 
162
+       //barrier_lock(&sb->s_barrier);
 
163
+       filevec_add_drain_all();
 
164
+       return 0;
 
165
+}
 
166
+
 
167
+static inline void au_rt_s_files_unlock(struct super_block *sb, int idx)
 
168
+{
 
169
+       //barrier_unlock(&sb->s_barrier);
 
170
+}
 
171
+
 
172
+#define au_rt_s_files_loop(pos, sb) \
 
173
+       lock_list_for_each_entry(pos, &(sb)->s_files, f_u.fu_llist)
 
174
+
 
175
+#define au_rt_s_files_loop_break(pos) \
 
176
+       lock_list_for_each_entry_stop(pos, f_u.fu_llist);
 
177
+
 
178
+static inline unsigned long au_mapping_nrpages(struct address_space *mapping)
 
179
+{
 
180
+       return mapping->nrpages;
 
181
+}
 
182
+
 
183
+#else
 
184
+
 
185
+static inline int au_rt_s_files_lock(struct super_block *sb)
 
186
+{
 
187
+       /* nothing */
 
188
+       return 0;
 
189
+}
 
190
+
 
191
+static inline void au_rt_s_files_unlock(struct super_block *sb, int idx)
 
192
+{
 
193
+       /* nothing */
 
194
+}
 
195
+
 
196
+#define au_rt_s_files_loop(pos, sb) \
 
197
+       list_for_each_entry(pos, &(sb)->s_files, f_u.fu_list)
 
198
+#define au_rt_s_files_loop_break(pos)  do {} while (0)
 
199
+
 
200
+static inline unsigned long au_mapping_nrpages(struct address_space *mapping)
 
201
+{
 
202
+       return mapping->nrpages;
 
203
+}
 
204
+
 
205
+#endif /* LINUX_VERSION_CODE */
 
206
+#endif /* CONFIG_PREEMPT_RT */
 
207
+
 
208
+/* ---------------------------------------------------------------------- */
 
209
+
 
210
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
 
211
 #define I_MUTEX_QUOTA                  0
 
212
 #define lockdep_off()                  do {} while (0)
 
213
@@ -48,7 +184,7 @@ typedef unsigned int au_gen_t;
 
214
 /* ---------------------------------------------------------------------- */
 
215
 
 
216
 struct aufs_rwsem {
 
217
-       struct rw_semaphore     rwsem;
 
218
+       struct au_rw_semaphore  rwsem;
 
219
 #ifdef CONFIG_AUFS_DEBUG
 
220
        atomic_t                rcnt;
 
221
 #endif
 
222
@@ -71,64 +207,64 @@ struct aufs_rwsem {
 
223
 static inline void rw_init_nolock(struct aufs_rwsem *rw)
 
224
 {
 
225
        DbgRcntInit(rw);
 
226
-       init_rwsem(&rw->rwsem);
 
227
+       au_init_rwsem(&rw->rwsem);
 
228
 }
 
229
 
 
230
 static inline void rw_init_wlock(struct aufs_rwsem *rw)
 
231
 {
 
232
        rw_init_nolock(rw);
 
233
-       down_write(&rw->rwsem);
 
234
+       au_down_write(&rw->rwsem);
 
235
 }
 
236
 
 
237
 static inline void rw_init_wlock_nested(struct aufs_rwsem *rw, unsigned int lsc)
 
238
 {
 
239
        rw_init_nolock(rw);
 
240
-       down_write_nested(&rw->rwsem, lsc);
 
241
+       au_down_write_nested(&rw->rwsem, lsc);
 
242
 }
 
243
 
 
244
 static inline void rw_read_lock(struct aufs_rwsem *rw)
 
245
 {
 
246
-       down_read(&rw->rwsem);
 
247
+       au_down_read(&rw->rwsem);
 
248
        DbgRcntInc(rw);
 
249
 }
 
250
 
 
251
 static inline void rw_read_lock_nested(struct aufs_rwsem *rw, unsigned int lsc)
 
252
 {
 
253
-       down_read_nested(&rw->rwsem, lsc);
 
254
+       au_down_read_nested(&rw->rwsem, lsc);
 
255
        DbgRcntInc(rw);
 
256
 }
 
257
 
 
258
 static inline void rw_read_unlock(struct aufs_rwsem *rw)
 
259
 {
 
260
        DbgRcntDec(rw);
 
261
-       up_read(&rw->rwsem);
 
262
+       au_up_read(&rw->rwsem);
 
263
 }
 
264
 
 
265
 static inline void rw_dgrade_lock(struct aufs_rwsem *rw)
 
266
 {
 
267
        DbgRcntInc(rw);
 
268
-       downgrade_write(&rw->rwsem);
 
269
+       au_downgrade_write(&rw->rwsem);
 
270
 }
 
271
 
 
272
 static inline void rw_write_lock(struct aufs_rwsem *rw)
 
273
 {
 
274
-       down_write(&rw->rwsem);
 
275
+       au_down_write(&rw->rwsem);
 
276
 }
 
277
 
 
278
 static inline void rw_write_lock_nested(struct aufs_rwsem *rw, unsigned int lsc)
 
279
 {
 
280
-       down_write_nested(&rw->rwsem, lsc);
 
281
+       au_down_write_nested(&rw->rwsem, lsc);
 
282
 }
 
283
 
 
284
 static inline void rw_write_unlock(struct aufs_rwsem *rw)
 
285
 {
 
286
-       up_write(&rw->rwsem);
 
287
+       au_up_write(&rw->rwsem);
 
288
 }
 
289
 
 
290
 /* why is not _nested version defined */
 
291
 static inline int rw_read_trylock(struct aufs_rwsem *rw)
 
292
 {
 
293
-       int ret = down_read_trylock(&rw->rwsem);
 
294
+       int ret = au_down_read_trylock(&rw->rwsem);
 
295
        if (ret)
 
296
                DbgRcntInc(rw);
 
297
        return ret;
 
298
@@ -136,7 +272,7 @@ static inline int rw_read_trylock(struct
 
299
 
 
300
 static inline int rw_write_trylock(struct aufs_rwsem *rw)
 
301
 {
 
302
-       return down_write_trylock(&rw->rwsem);
 
303
+       return au_down_write_trylock(&rw->rwsem);
 
304
 }
 
305
 
 
306
 #undef DbgRcntInit
 
307
@@ -145,7 +281,7 @@ static inline int rw_write_trylock(struc
 
308
 
 
309
 /* to debug easier, do not make them inlined functions */
 
310
 #define RwMustNoWaiters(rw)    AuDebugOn(!list_empty(&(rw)->rwsem.wait_list))
 
311
-#define RwMustAnyLock(rw)      AuDebugOn(down_write_trylock(&(rw)->rwsem))
 
312
+#define RwMustAnyLock(rw)      AuDebugOn(au_down_write_trylock(&(rw)->rwsem))
 
313
 #ifdef CONFIG_AUFS_DEBUG
 
314
 #define RwMustReadLock(rw) do { \
 
315
        RwMustAnyLock(rw); \