30
struct kmem_cache *aufs_cachep[AuCache_Last];
33
struct kmem_cache *au_cachep[AuCache_Last];
31
34
static int __init create_cache(void)
35
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
36
#define Args(type, sz) (type), (sz), 0, SLAB_RECLAIM_ACCOUNT, NULL
38
#define Args(type, sz) (type), (sz), 0, SLAB_RECLAIM_ACCOUNT, NULL, NULL
40
#define CacheX(type, extra) \
41
kmem_cache_create(Args(#type, sizeof(struct type) + extra))
42
#define Cache(type) CacheX(type, 0)
45
aufs_cachep[AuCache_DINFO] = Cache(aufs_dinfo);
46
if (aufs_cachep[AuCache_DINFO])
47
aufs_cachep[AuCache_ICNTNR] = Cache(aufs_icntnr);
48
if (aufs_cachep[AuCache_ICNTNR])
49
aufs_cachep[AuCache_FINFO] = Cache(aufs_finfo);
50
//aufs_cachep[AuCache_FINFO] = NULL;
51
if (aufs_cachep[AuCache_FINFO])
52
aufs_cachep[AuCache_VDIR] = Cache(aufs_vdir);
53
if (aufs_cachep[AuCache_VDIR]) {
54
aufs_cachep[AuCache_DEHSTR] = Cache(aufs_dehstr);
55
p = aufs_cachep[AuCache_DEHSTR];
58
#ifdef CONFIG_AUFS_HINOTIFY
59
AuDebugOn(!au_hin_nignore);
61
aufs_cachep[AuCache_HINOTIFY]
62
= CacheX(aufs_hinotify,
63
sizeof(atomic_t) * au_hin_nignore);
64
p = aufs_cachep[AuCache_HINOTIFY];
36
au_cachep[AuCache_DINFO] = AuCache(au_dinfo);
37
if (au_cachep[AuCache_DINFO])
38
au_cachep[AuCache_ICNTNR] = AuCache(aufs_icntnr);
39
if (au_cachep[AuCache_ICNTNR])
40
au_cachep[AuCache_FINFO] = AuCache(au_finfo);
41
//au_cachep[AuCache_FINFO] = NULL;
42
if (au_cachep[AuCache_FINFO])
43
au_cachep[AuCache_VDIR] = AuCache(au_vdir);
44
if (au_cachep[AuCache_VDIR])
45
au_cachep[AuCache_DEHSTR] = AuCache(au_vdir_dehstr);
46
if (au_cachep[AuCache_DEHSTR])
77
52
static void destroy_cache(void)
80
55
for (i = 0; i < AuCache_Last; i++)
82
kmem_cache_destroy(aufs_cachep[i]);
57
kmem_cache_destroy(au_cachep[i]);
85
62
/* ---------------------------------------------------------------------- */
87
#ifdef CONFIG_AUFS_HINOTIFY
88
/* the size of an array for ignore counter */
92
/* super_blocks list is not exported */
93
DEFINE_MUTEX(au_sbilist_mtx);
94
LIST_HEAD(au_sbilist);
96
64
char au_esc_chars[0x20 + 3]; /* 0x01-0x20, backslash, del, and NULL */
97
65
int au_dir_roflags;
100
#include <linux/security.h>
101
#include "dbg_dlgt.c"
103
#define dbg_dlgt_init() 0
104
#define dbg_dlgt_fin() do {} while (0)
108
68
* functions for module interface.
121
81
MODULE_PARM_DESC(brs, "use <sysfs>/fs/aufs/sbi_*/brN");
122
82
module_param_named(brs, sysaufs_brs, int, S_IRUGO);
125
char *aufs_sysrq_key = "a";
126
MODULE_PARM_DESC(sysrq, "MagicSysRq key for " AUFS_NAME);
127
module_param_named(sysrq, aufs_sysrq_key, charp, S_IRUGO);
84
/* ---------------------------------------------------------------------- */
130
86
static int __init aufs_init(void)
135
#ifdef CONFIG_AUFS_DEBUG
137
aufs_bindex_t bindex = -1;
138
AuDebugOn(bindex >= 0);
141
struct aufs_destr destr;
143
AuDebugOn(destr.len < NAME_MAX);
146
#ifdef CONFIG_4KSTACKS
147
AuWarn("CONFIG_4KSTACKS is defined.\n");
149
#if 0 // verbose debug
152
struct aufs_branch *br;
153
struct aufs_dinfo *di;
154
struct aufs_finfo *fi;
155
struct aufs_iinfo *ii;
156
struct aufs_hinode *hi;
157
struct aufs_sbinfo *si;
158
struct aufs_destr *destr;
161
struct aufs_vdir *vd;
166
"id %d, perm %d, mnt %d, count %d, "
167
"wh_sem %d, wh %d, run %d, plink %d, gen %d} %d\n",
168
offsetof(typeof(*u.br), br_xino),
169
offsetof(typeof(*u.br), br_id),
170
offsetof(typeof(*u.br), br_perm),
171
offsetof(typeof(*u.br), br_mnt),
172
offsetof(typeof(*u.br), br_count),
173
offsetof(typeof(*u.br), br_wh_rwsem),
174
offsetof(typeof(*u.br), br_wh),
175
offsetof(typeof(*u.br), br_wh_running),
176
offsetof(typeof(*u.br), br_plink),
177
offsetof(typeof(*u.br), br_generation),
179
pr_info("di{gen %d, rwsem %d, bstart %d, bend %d, bwh %d, "
180
"bdiropq %d, hdentry %d} %d\n",
181
offsetof(typeof(*u.di), di_generation),
182
offsetof(typeof(*u.di), di_rwsem),
183
offsetof(typeof(*u.di), di_bstart),
184
offsetof(typeof(*u.di), di_bend),
185
offsetof(typeof(*u.di), di_bwh),
186
offsetof(typeof(*u.di), di_bdiropq),
187
offsetof(typeof(*u.di), di_hdentry),
189
pr_info("fi{gen %d, rwsem %d, hfile %d, bstart %d, bend %d, "
190
"h_vm_ops %d, vdir_cach %d} %d\n",
191
offsetof(typeof(*u.fi), fi_generation),
192
offsetof(typeof(*u.fi), fi_rwsem),
193
offsetof(typeof(*u.fi), fi_hfile),
194
offsetof(typeof(*u.fi), fi_bstart),
195
offsetof(typeof(*u.fi), fi_bend),
196
offsetof(typeof(*u.fi), fi_h_vm_ops),
197
offsetof(typeof(*u.fi), fi_vdir_cache),
199
pr_info("ii{gen %d, hsb %d, "
200
"rwsem %d, bstart %d, bend %d, hinode %d, vdir %d} "
202
offsetof(typeof(*u.ii), ii_generation),
203
offsetof(typeof(*u.ii), ii_hsb1),
204
offsetof(typeof(*u.ii), ii_rwsem),
205
offsetof(typeof(*u.ii), ii_bstart),
206
offsetof(typeof(*u.ii), ii_bend),
207
offsetof(typeof(*u.ii), ii_hinode),
208
offsetof(typeof(*u.ii), ii_vdir),
210
pr_info("hi{inode %d, id %d, notify %d, wh %d} %d\n",
211
offsetof(typeof(*u.hi), hi_inode),
212
offsetof(typeof(*u.hi), hi_id),
213
offsetof(typeof(*u.hi), hi_notify),
214
offsetof(typeof(*u.hi), hi_whdentry),
216
pr_info("si{nwt %d, rwsem %d, gen %d, "
217
"bend %d, last id %d, br %d, "
219
"xread %d, xwrite %d, xib %d, xmtx %d, buf %d, "
220
"xlast %d, xnext %d, "
223
"pl_lock %d, pl %d, "
227
offsetof(typeof(*u.si), si_nowait),
228
offsetof(typeof(*u.si), si_rwsem),
229
offsetof(typeof(*u.si), si_generation),
230
offsetof(typeof(*u.si), si_bend),
231
offsetof(typeof(*u.si), si_last_br_id),
232
offsetof(typeof(*u.si), si_branch),
233
offsetof(typeof(*u.si), au_si_flags),
234
offsetof(typeof(*u.si), si_xread),
235
offsetof(typeof(*u.si), si_xwrite),
236
offsetof(typeof(*u.si), si_xib),
237
offsetof(typeof(*u.si), si_xib_mtx),
238
offsetof(typeof(*u.si), si_xib_buf),
239
offsetof(typeof(*u.si), si_xib_last_pindex),
240
offsetof(typeof(*u.si), si_xib_next_bit),
241
offsetof(typeof(*u.si), si_rdcache),
242
offsetof(typeof(*u.si), si_dirwh),
243
offsetof(typeof(*u.si), si_plink_lock),
244
offsetof(typeof(*u.si), si_plink),
245
offsetof(typeof(*u.si), si_list),
246
offsetof(typeof(*u.si), si_mnt),
247
offsetof(typeof(*u.si), si_sysaufs),
249
pr_info("destr{len %d, name %d} %d\n",
250
offsetof(typeof(*u.destr), len),
251
offsetof(typeof(*u.destr), name),
253
pr_info("de{ino %d, type %d, str %d} %d\n",
254
offsetof(typeof(*u.de), de_ino),
255
offsetof(typeof(*u.de), de_type),
256
offsetof(typeof(*u.de), de_str),
258
pr_info("wh{hash %d, bindex %d, str %d} %d\n",
259
offsetof(typeof(*u.wh), wh_hash),
260
offsetof(typeof(*u.wh), wh_bindex),
261
offsetof(typeof(*u.wh), wh_str),
263
pr_info("vd{deblk %d, nblk %d, last %d, ver %d, jiffy %d} %d\n",
264
offsetof(typeof(*u.vd), vd_deblk),
265
offsetof(typeof(*u.vd), vd_nblk),
266
offsetof(typeof(*u.vd), vd_last),
267
offsetof(typeof(*u.vd), vd_version),
268
offsetof(typeof(*u.vd), vd_jiffy),
272
#endif /* CONFIG_AUFS_DEBUG */
275
94
for (i = 1; i <= ' '; i++)