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