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

« back to all changes in this revision

Viewing changes to debian/patches/06_rt.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Julian Andres Klode
  • Date: 2008-08-21 14:58:54 UTC
  • mfrom: (1.2.1 upstream) (11 intrepid)
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: james.westby@ubuntu.com-20080821145854-6erljbzg007r476y
01_vserver_apparmor.dpatch: [UPDATE] Disable vserver patches on kernel 
2.6.26, because they are not needed anymore. (Closes: #495921)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh /usr/share/dpatch/dpatch-run
 
2
## 06_rt.dpatch by Julian Andres Klode <jak@jak-linux.org>
 
3
##
 
4
## DP: Add support for RT Kernels, based on patch/rt-compat.patch
 
5
 
 
6
@DPATCH@
 
7
Index: aufs-0+20080415/fs/aufs/branch.c
 
8
===================================================================
 
9
--- aufs-0+20080415.orig/fs/aufs/branch.c       2008-04-14 01:37:42.000000000 +0200
 
10
+++ aufs-0+20080415/fs/aufs/branch.c    2008-04-15 15:37:01.000000000 +0200
 
11
@@ -864,6 +864,7 @@
 
12
                if (!au_br_writable(mod->perm)) {
 
13
                        /* rw --> ro, file might be mmapped */
 
14
                        struct file *file, *hf;
 
15
+                       int idx;
 
16
 
 
17
 #if 1 // test here
 
18
                        DiMustNoWaiters(root);
 
19
@@ -875,7 +876,8 @@
 
20
                         * since BKL (and sbinfo) is locked
 
21
                         */
 
22
                        AuDebugOn(!kernel_locked());
 
23
-                       list_for_each_entry(file, &sb->s_files, f_u.fu_list) {
 
24
+                       idx = au_rt_s_files_lock(sb);
 
25
+                       au_rt_s_files_loop(file, sb) {
 
26
                                LKTRTrace("%.*s\n", AuDLNPair(file->f_dentry));
 
27
                                if (!au_test_aufs_file(file))
 
28
                                        continue;
 
29
@@ -904,6 +906,7 @@
 
30
                                FiMustNoWaiters(file);
 
31
                                fi_read_unlock(file);
 
32
                        }
 
33
+                       au_rt_s_files_unlock(sb, idx);
 
34
 
 
35
                        /* aufs_write_lock() calls ..._child() */
 
36
                        di_write_lock_child(root);
 
37
Index: aufs-0+20080415/fs/aufs/debug.c
 
38
===================================================================
 
39
--- aufs-0+20080415.orig/fs/aufs/debug.c        2008-04-14 01:38:37.000000000 +0200
 
40
+++ aufs-0+20080415/fs/aufs/debug.c     2008-04-15 15:37:01.000000000 +0200
 
41
@@ -114,7 +114,7 @@
 
42
             ntfy,
 
43
             i_size_read(inode), (u64)inode->i_blocks,
 
44
             timespec_to_ns(&inode->i_ctime) & 0x0ffff,
 
45
-            inode->i_mapping ? inode->i_mapping->nrpages : 0,
 
46
+            inode->i_mapping ? au_mapping_nrpages(inode->i_mapping) : 0,
 
47
             inode->i_state, inode->i_flags, inode->i_generation,
 
48
             l ? ", wh " : "", l, n);
 
49
        return 0;
 
50
Index: aufs-0+20080415/fs/aufs/misc.h
 
51
===================================================================
 
52
--- aufs-0+20080415.orig/fs/aufs/misc.h 2008-04-14 01:43:36.000000000 +0200
 
53
+++ aufs-0+20080415/fs/aufs/misc.h      2008-04-15 15:41:44.000000000 +0200
 
54
@@ -30,6 +30,142 @@
 
55
 #include <linux/version.h>
 
56
 #include <linux/aufs_type.h>
 
57
 
 
58
+
 
59
+/* ---------------------------------------------------------------------- */
 
60
+
 
61
+/*
 
62
+ * support for RT patch (testing).
 
63
+ * it uses 'standard compat_rw_semaphore' instead of 'realtime rw_semaphore.'
 
64
+ * sigh, wrapper for wrapper...
 
65
+ */
 
66
+
 
67
+#ifndef CONFIG_PREEMPT_RT
 
68
+
 
69
+#define au_rw_semaphore                rw_semaphore
 
70
+#define au_init_rwsem          init_rwsem
 
71
+#define au_down_read           down_read
 
72
+#define au_down_read_nested    down_read_nested
 
73
+#define au_down_read_trylock   down_read_trylock
 
74
+#define au_up_read             up_read
 
75
+#define au_downgrade_write     downgrade_write
 
76
+#define au_down_write          down_write
 
77
+#define au_down_write_nested   down_write_nested
 
78
+#define au_down_write_trylock  down_write_trylock
 
79
+#define au_up_write            up_write
 
80
+
 
81
+static inline int au_rt_s_files_lock(struct super_block *sb)
 
82
+{
 
83
+       /* nothing */
 
84
+       return 0;
 
85
+}
 
86
+
 
87
+static inline void au_rt_s_files_unlock(struct super_block *sb, int idx)
 
88
+{
 
89
+       /* nothing */
 
90
+}
 
91
+
 
92
+#define au_rt_s_files_loop(pos, sb) \
 
93
+       list_for_each_entry(pos, &(sb)->s_files, f_u.fu_list)
 
94
+#define au_rt_s_files_loop_break(pos)  do {} while (0)
 
95
+
 
96
+static inline unsigned long au_mapping_nrpages(struct address_space *mapping)
 
97
+{
 
98
+       return mapping->nrpages;
 
99
+}
 
100
+
 
101
+#else /* CONFIG_PREEMPT_RT */
 
102
+
 
103
+#define au_rw_semaphore                compat_rw_semaphore
 
104
+#define au_init_rwsem          compat_init_rwsem
 
105
+#define au_down_read           compat_down_read
 
106
+#define au_down_read_nested    compat_down_read_nested
 
107
+#define au_down_read_trylock   compat_down_read_trylock
 
108
+#define au_up_read             compat_up_read
 
109
+#define au_downgrade_write     compat_downgrade_write
 
110
+#define au_down_write          compat_down_write
 
111
+#define au_down_write_nested   compat_down_write_nested
 
112
+#define au_down_write_trylock  compat_down_write_trylock
 
113
+#define au_up_write            compat_up_write
 
114
+
 
115
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
 
116
+
 
117
+static inline int au_rt_s_files_lock(struct super_block *sb)
 
118
+{
 
119
+       int idx;
 
120
+       idx = qrcu_read_lock(&sb->s_qrcu);
 
121
+       percpu_list_fold(&sb->s_files);
 
122
+       return idx;
 
123
+}
 
124
+
 
125
+static inline void au_rt_s_files_unlock(struct super_block *sb, int idx)
 
126
+{
 
127
+       qrcu_read_unlock(&sb->s_qrcu, idx);
 
128
+}
 
129
+
 
130
+#define au_rt_s_files_loop(pos, sb) \
 
131
+       lock_list_for_each_entry(pos, percpu_list_head(&(sb)->s_files), \
 
132
+                                f_u.fu_llist)
 
133
+
 
134
+#define au_rt_s_files_loop_break(pos) \
 
135
+       lock_list_for_each_entry_stop(pos, f_u.fu_llist);
 
136
+
 
137
+static inline unsigned long au_mapping_nrpages(struct address_space *mapping)
 
138
+{
 
139
+       return mapping_nrpages(mapping);
 
140
+}
 
141
+
 
142
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
 
143
+
 
144
+static inline int au_rt_s_files_lock(struct super_block *sb)
 
145
+{
 
146
+       //barrier_lock(&sb->s_barrier);
 
147
+       filevec_add_drain_all();
 
148
+       return 0;
 
149
+}
 
150
+
 
151
+static inline void au_rt_s_files_unlock(struct super_block *sb, int idx)
 
152
+{
 
153
+       //barrier_unlock(&sb->s_barrier);
 
154
+}
 
155
+
 
156
+#define au_rt_s_files_loop(pos, sb) \
 
157
+       lock_list_for_each_entry(pos, &(sb)->s_files, f_u.fu_llist)
 
158
+
 
159
+#define au_rt_s_files_loop_break(pos) \
 
160
+       lock_list_for_each_entry_stop(pos, f_u.fu_llist);
 
161
+
 
162
+static inline unsigned long au_mapping_nrpages(struct address_space *mapping)
 
163
+{
 
164
+       return mapping->nrpages;
 
165
+}
 
166
+
 
167
+#else
 
168
+
 
169
+static inline int au_rt_s_files_lock(struct super_block *sb)
 
170
+{
 
171
+       /* nothing */
 
172
+       return 0;
 
173
+}
 
174
+
 
175
+static inline void au_rt_s_files_unlock(struct super_block *sb, int idx)
 
176
+{
 
177
+       /* nothing */
 
178
+}
 
179
+
 
180
+#define au_rt_s_files_loop(pos, sb) \
 
181
+       list_for_each_entry(pos, &(sb)->s_files, f_u.fu_list)
 
182
+#define au_rt_s_files_loop_break(pos)  do {} while (0)
 
183
+
 
184
+static inline unsigned long au_mapping_nrpages(struct address_space *mapping)
 
185
+{
 
186
+       return mapping->nrpages;
 
187
+}
 
188
+
 
189
+#endif /* LINUX_VERSION_CODE */
 
190
+#endif /* CONFIG_PREEMPT_RT */
 
191
+
 
192
+/* ---------------------------------------------------------------------- */
 
193
+
 
194
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
 
195
 #define I_MUTEX_QUOTA                  0
 
196
 #define lockdep_off()                  do {} while (0)
 
197
@@ -49,7 +185,7 @@
 
198
 /* ---------------------------------------------------------------------- */
 
199
 
 
200
 struct au_rwsem {
 
201
-       struct rw_semaphore     rwsem;
 
202
+       struct au_rw_semaphore  rwsem;
 
203
 #ifdef CONFIG_AUFS_DEBUG
 
204
        atomic_t                rcnt;
 
205
 #endif
 
206
@@ -72,66 +208,66 @@
 
207
 static inline void au_rw_init_nolock(struct au_rwsem *rw)
 
208
 {
 
209
        AuDbgRcntInit(rw);
 
210
-       init_rwsem(&rw->rwsem);
 
211
+       au_init_rwsem(&rw->rwsem);
 
212
 }
 
213
 
 
214
 static inline void au_rw_init_wlock(struct au_rwsem *rw)
 
215
 {
 
216
        au_rw_init_nolock(rw);
 
217
-       down_write(&rw->rwsem);
 
218
+       au_down_write(&rw->rwsem);
 
219
 }
 
220
 
 
221
 static inline void au_rw_init_wlock_nested(struct au_rwsem *rw,
 
222
                                           unsigned int lsc)
 
223
 {
 
224
        au_rw_init_nolock(rw);
 
225
-       down_write_nested(&rw->rwsem, lsc);
 
226
+       au_down_write_nested(&rw->rwsem, lsc);
 
227
 }
 
228
 
 
229
 static inline void au_rw_read_lock(struct au_rwsem *rw)
 
230
 {
 
231
-       down_read(&rw->rwsem);
 
232
+       au_down_read(&rw->rwsem);
 
233
        AuDbgRcntInc(rw);
 
234
 }
 
235
 
 
236
 static inline void au_rw_read_lock_nested(struct au_rwsem *rw, unsigned int lsc)
 
237
 {
 
238
-       down_read_nested(&rw->rwsem, lsc);
 
239
+       au_down_read_nested(&rw->rwsem, lsc);
 
240
        AuDbgRcntInc(rw);
 
241
 }
 
242
 
 
243
 static inline void au_rw_read_unlock(struct au_rwsem *rw)
 
244
 {
 
245
        AuDbgRcntDec(rw);
 
246
-       up_read(&rw->rwsem);
 
247
+       au_up_read(&rw->rwsem);
 
248
 }
 
249
 
 
250
 static inline void au_rw_dgrade_lock(struct au_rwsem *rw)
 
251
 {
 
252
        AuDbgRcntInc(rw);
 
253
-       downgrade_write(&rw->rwsem);
 
254
+       au_downgrade_write(&rw->rwsem);
 
255
 }
 
256
 
 
257
 static inline void au_rw_write_lock(struct au_rwsem *rw)
 
258
 {
 
259
-       down_write(&rw->rwsem);
 
260
+       au_down_write(&rw->rwsem);
 
261
 }
 
262
 
 
263
 static inline void au_rw_write_lock_nested(struct au_rwsem *rw,
 
264
                                           unsigned int lsc)
 
265
 {
 
266
-       down_write_nested(&rw->rwsem, lsc);
 
267
+       au_down_write_nested(&rw->rwsem, lsc);
 
268
 }
 
269
 
 
270
 static inline void au_rw_write_unlock(struct au_rwsem *rw)
 
271
 {
 
272
-       up_write(&rw->rwsem);
 
273
+       au_up_write(&rw->rwsem);
 
274
 }
 
275
 
 
276
 /* why is not _nested version defined */
 
277
 static inline int au_rw_read_trylock(struct au_rwsem *rw)
 
278
 {
 
279
-       int ret = down_read_trylock(&rw->rwsem);
 
280
+       int ret = au_down_read_trylock(&rw->rwsem);
 
281
        if (ret)
 
282
                AuDbgRcntInc(rw);
 
283
        return ret;
 
284
@@ -139,7 +275,7 @@
 
285
 
 
286
 static inline int au_rw_write_trylock(struct au_rwsem *rw)
 
287
 {
 
288
-       return down_write_trylock(&rw->rwsem);
 
289
+       return au_down_write_trylock(&rw->rwsem);
 
290
 }
 
291
 
 
292
 #undef AuDbgRcntInit
 
293
@@ -148,7 +284,7 @@
 
294
 
 
295
 /* to debug easier, do not make them inlined functions */
 
296
 #define AuRwMustNoWaiters(rw)  AuDebugOn(!list_empty(&(rw)->rwsem.wait_list))
 
297
-#define AuRwMustAnyLock(rw)    AuDebugOn(down_write_trylock(&(rw)->rwsem))
 
298
+#define AuRwMustAnyLock(rw)    AuDebugOn(au_down_write_trylock(&(rw)->rwsem))
 
299
 #ifdef CONFIG_AUFS_DEBUG
 
300
 #define AuRwMustReadLock(rw) do { \
 
301
        AuRwMustAnyLock(rw); \