aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namespace.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-11-23 12:14:10 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-01-03 22:56:57 -0500
commit7d6fec45a5131918b51dcd76da52f2ec86a85be6 (patch)
tree82af862264cfa176a37c7d9f915806346c8df0bc /fs/namespace.c
parentdabe0dc194d5d56d379a8994fff47392744b6491 (diff)
vfs: start hiding vfsmount guts series
Almost all fields of struct vfsmount are used only by core VFS (and a fairly small part of it, at that). The plan: embed struct vfsmount into struct mount, making the latter visible only to core parts of VFS. Then move fields from vfsmount to mount, eventually leaving only mnt_root/mnt_sb/mnt_flags in struct vfsmount. Filesystem code still gets pointers to struct vfsmount and remains unchanged; all such pointers go to struct vfsmount embedded into the instances of struct mount allocated by fs/namespace.c. When fs/namespace.c et.al. get a pointer to vfsmount, they turn it into pointer to mount (using container_of) and work with that. This is the first part of series; struct mount is introduced, allocation switched to using it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index 86b4f6406470..dda47fee6fdf 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -173,8 +173,9 @@ unsigned int mnt_get_count(struct vfsmount *mnt)
173 173
174static struct vfsmount *alloc_vfsmnt(const char *name) 174static struct vfsmount *alloc_vfsmnt(const char *name)
175{ 175{
176 struct vfsmount *mnt = kmem_cache_zalloc(mnt_cache, GFP_KERNEL); 176 struct mount *p = kmem_cache_zalloc(mnt_cache, GFP_KERNEL);
177 if (mnt) { 177 if (p) {
178 struct vfsmount *mnt = &p->mnt;
178 int err; 179 int err;
179 180
180 err = mnt_alloc_id(mnt); 181 err = mnt_alloc_id(mnt);
@@ -210,16 +211,16 @@ static struct vfsmount *alloc_vfsmnt(const char *name)
210 INIT_HLIST_HEAD(&mnt->mnt_fsnotify_marks); 211 INIT_HLIST_HEAD(&mnt->mnt_fsnotify_marks);
211#endif 212#endif
212 } 213 }
213 return mnt; 214 return &p->mnt;
214 215
215#ifdef CONFIG_SMP 216#ifdef CONFIG_SMP
216out_free_devname: 217out_free_devname:
217 kfree(mnt->mnt_devname); 218 kfree(p->mnt.mnt_devname);
218#endif 219#endif
219out_free_id: 220out_free_id:
220 mnt_free_id(mnt); 221 mnt_free_id(&p->mnt);
221out_free_cache: 222out_free_cache:
222 kmem_cache_free(mnt_cache, mnt); 223 kmem_cache_free(mnt_cache, p);
223 return NULL; 224 return NULL;
224} 225}
225 226
@@ -449,12 +450,13 @@ static void __mnt_unmake_readonly(struct vfsmount *mnt)
449 450
450static void free_vfsmnt(struct vfsmount *mnt) 451static void free_vfsmnt(struct vfsmount *mnt)
451{ 452{
453 struct mount *p = real_mount(mnt);
452 kfree(mnt->mnt_devname); 454 kfree(mnt->mnt_devname);
453 mnt_free_id(mnt); 455 mnt_free_id(mnt);
454#ifdef CONFIG_SMP 456#ifdef CONFIG_SMP
455 free_percpu(mnt->mnt_pcp); 457 free_percpu(mnt->mnt_pcp);
456#endif 458#endif
457 kmem_cache_free(mnt_cache, mnt); 459 kmem_cache_free(mnt_cache, p);
458} 460}
459 461
460/* 462/*
@@ -2698,7 +2700,7 @@ void __init mnt_init(void)
2698 2700
2699 init_rwsem(&namespace_sem); 2701 init_rwsem(&namespace_sem);
2700 2702
2701 mnt_cache = kmem_cache_create("mnt_cache", sizeof(struct vfsmount), 2703 mnt_cache = kmem_cache_create("mnt_cache", sizeof(struct mount),
2702 0, SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL); 2704 0, SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL);
2703 2705
2704 mount_hashtable = (struct list_head *)__get_free_page(GFP_ATOMIC); 2706 mount_hashtable = (struct list_head *)__get_free_page(GFP_ATOMIC);