vfs: move fsnotify junk to struct mount

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2011-11-25 02:35:16 -05:00
parent 52ba1621de
commit c63181e6b6
6 changed files with 47 additions and 42 deletions

View file

@ -173,54 +173,53 @@ unsigned int mnt_get_count(struct mount *mnt)
static struct mount *alloc_vfsmnt(const char *name)
{
struct mount *p = kmem_cache_zalloc(mnt_cache, GFP_KERNEL);
if (p) {
struct vfsmount *mnt = &p->mnt;
struct mount *mnt = kmem_cache_zalloc(mnt_cache, GFP_KERNEL);
if (mnt) {
int err;
err = mnt_alloc_id(p);
err = mnt_alloc_id(mnt);
if (err)
goto out_free_cache;
if (name) {
p->mnt_devname = kstrdup(name, GFP_KERNEL);
if (!p->mnt_devname)
mnt->mnt_devname = kstrdup(name, GFP_KERNEL);
if (!mnt->mnt_devname)
goto out_free_id;
}
#ifdef CONFIG_SMP
p->mnt_pcp = alloc_percpu(struct mnt_pcp);
if (!p->mnt_pcp)
mnt->mnt_pcp = alloc_percpu(struct mnt_pcp);
if (!mnt->mnt_pcp)
goto out_free_devname;
this_cpu_add(p->mnt_pcp->mnt_count, 1);
this_cpu_add(mnt->mnt_pcp->mnt_count, 1);
#else
p->mnt_count = 1;
p->mnt_writers = 0;
mnt->mnt_count = 1;
mnt->mnt_writers = 0;
#endif
INIT_LIST_HEAD(&p->mnt_hash);
INIT_LIST_HEAD(&p->mnt_child);
INIT_LIST_HEAD(&p->mnt_mounts);
INIT_LIST_HEAD(&p->mnt_list);
INIT_LIST_HEAD(&p->mnt_expire);
INIT_LIST_HEAD(&p->mnt_share);
INIT_LIST_HEAD(&p->mnt_slave_list);
INIT_LIST_HEAD(&p->mnt_slave);
INIT_LIST_HEAD(&mnt->mnt_hash);
INIT_LIST_HEAD(&mnt->mnt_child);
INIT_LIST_HEAD(&mnt->mnt_mounts);
INIT_LIST_HEAD(&mnt->mnt_list);
INIT_LIST_HEAD(&mnt->mnt_expire);
INIT_LIST_HEAD(&mnt->mnt_share);
INIT_LIST_HEAD(&mnt->mnt_slave_list);
INIT_LIST_HEAD(&mnt->mnt_slave);
#ifdef CONFIG_FSNOTIFY
INIT_HLIST_HEAD(&mnt->mnt_fsnotify_marks);
#endif
}
return p;
return mnt;
#ifdef CONFIG_SMP
out_free_devname:
kfree(p->mnt_devname);
kfree(mnt->mnt_devname);
#endif
out_free_id:
mnt_free_id(p);
mnt_free_id(mnt);
out_free_cache:
kmem_cache_free(mnt_cache, p);
kmem_cache_free(mnt_cache, mnt);
return NULL;
}