Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 280163
b: refs/heads/master
c: 7d6fec4
h: refs/heads/master
i:
  280161: e8fb6e4
  280159: 6cfc00c
v: v3
  • Loading branch information
Al Viro committed Jan 4, 2012
1 parent d365d57 commit d1b47cf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dabe0dc194d5d56d379a8994fff47392744b6491
refs/heads/master: 7d6fec45a5131918b51dcd76da52f2ec86a85be6
9 changes: 9 additions & 0 deletions trunk/fs/mount.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#include <linux/mount.h>

struct mount {
struct vfsmount mnt;
};

static inline struct mount *real_mount(struct vfsmount *mnt)
{
return container_of(mnt, struct mount, mnt);
}

static inline int mnt_has_parent(struct vfsmount *mnt)
{
return mnt != mnt->mnt_parent;
Expand Down
18 changes: 10 additions & 8 deletions trunk/fs/namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,9 @@ unsigned int mnt_get_count(struct vfsmount *mnt)

static struct vfsmount *alloc_vfsmnt(const char *name)
{
struct vfsmount *mnt = kmem_cache_zalloc(mnt_cache, GFP_KERNEL);
if (mnt) {
struct mount *p = kmem_cache_zalloc(mnt_cache, GFP_KERNEL);
if (p) {
struct vfsmount *mnt = &p->mnt;
int err;

err = mnt_alloc_id(mnt);
Expand Down Expand Up @@ -210,16 +211,16 @@ static struct vfsmount *alloc_vfsmnt(const char *name)
INIT_HLIST_HEAD(&mnt->mnt_fsnotify_marks);
#endif
}
return mnt;
return &p->mnt;

#ifdef CONFIG_SMP
out_free_devname:
kfree(mnt->mnt_devname);
kfree(p->mnt.mnt_devname);
#endif
out_free_id:
mnt_free_id(mnt);
mnt_free_id(&p->mnt);
out_free_cache:
kmem_cache_free(mnt_cache, mnt);
kmem_cache_free(mnt_cache, p);
return NULL;
}

Expand Down Expand Up @@ -449,12 +450,13 @@ static void __mnt_unmake_readonly(struct vfsmount *mnt)

static void free_vfsmnt(struct vfsmount *mnt)
{
struct mount *p = real_mount(mnt);
kfree(mnt->mnt_devname);
mnt_free_id(mnt);
#ifdef CONFIG_SMP
free_percpu(mnt->mnt_pcp);
#endif
kmem_cache_free(mnt_cache, mnt);
kmem_cache_free(mnt_cache, p);
}

/*
Expand Down Expand Up @@ -2698,7 +2700,7 @@ void __init mnt_init(void)

init_rwsem(&namespace_sem);

mnt_cache = kmem_cache_create("mnt_cache", sizeof(struct vfsmount),
mnt_cache = kmem_cache_create("mnt_cache", sizeof(struct mount),
0, SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL);

mount_hashtable = (struct list_head *)__get_free_page(GFP_ATOMIC);
Expand Down

0 comments on commit d1b47cf

Please sign in to comment.