Commit a73324da authored by Al Viro's avatar Al Viro

vfs: move mnt_mountpoint to struct mount

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 0714a533
...@@ -2464,7 +2464,7 @@ static int prepend_path(const struct path *path, ...@@ -2464,7 +2464,7 @@ static int prepend_path(const struct path *path,
/* Global root? */ /* Global root? */
if (!mnt_has_parent(mnt)) if (!mnt_has_parent(mnt))
goto global_root; goto global_root;
dentry = mnt->mnt.mnt_mountpoint; dentry = mnt->mnt_mountpoint;
mnt = mnt->mnt_parent; mnt = mnt->mnt_parent;
vfsmnt = &mnt->mnt; vfsmnt = &mnt->mnt;
continue; continue;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
struct mount { struct mount {
struct list_head mnt_hash; struct list_head mnt_hash;
struct mount *mnt_parent; struct mount *mnt_parent;
struct dentry *mnt_mountpoint;
struct vfsmount mnt; struct vfsmount mnt;
}; };
......
...@@ -684,7 +684,7 @@ static int follow_up_rcu(struct path *path) ...@@ -684,7 +684,7 @@ static int follow_up_rcu(struct path *path)
parent = mnt->mnt_parent; parent = mnt->mnt_parent;
if (&parent->mnt == path->mnt) if (&parent->mnt == path->mnt)
return 0; return 0;
mountpoint = mnt->mnt.mnt_mountpoint; mountpoint = mnt->mnt_mountpoint;
path->dentry = mountpoint; path->dentry = mountpoint;
path->mnt = &parent->mnt; path->mnt = &parent->mnt;
return 1; return 1;
...@@ -703,7 +703,7 @@ int follow_up(struct path *path) ...@@ -703,7 +703,7 @@ int follow_up(struct path *path)
return 0; return 0;
} }
mntget(&parent->mnt); mntget(&parent->mnt);
mountpoint = dget(mnt->mnt.mnt_mountpoint); mountpoint = dget(mnt->mnt_mountpoint);
br_read_unlock(vfsmount_lock); br_read_unlock(vfsmount_lock);
dput(path->dentry); dput(path->dentry);
path->dentry = mountpoint; path->dentry = mountpoint;
......
...@@ -476,7 +476,7 @@ struct mount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry, ...@@ -476,7 +476,7 @@ struct mount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry,
if (tmp == head) if (tmp == head)
break; break;
p = list_entry(tmp, struct mount, mnt_hash); p = list_entry(tmp, struct mount, mnt_hash);
if (&p->mnt_parent->mnt == mnt && p->mnt.mnt_mountpoint == dentry) { if (&p->mnt_parent->mnt == mnt && p->mnt_mountpoint == dentry) {
found = p; found = p;
break; break;
} }
...@@ -543,7 +543,7 @@ static void dentry_reset_mounted(struct dentry *dentry) ...@@ -543,7 +543,7 @@ static void dentry_reset_mounted(struct dentry *dentry)
struct mount *p; struct mount *p;
list_for_each_entry(p, &mount_hashtable[u], mnt_hash) { list_for_each_entry(p, &mount_hashtable[u], mnt_hash) {
if (p->mnt.mnt_mountpoint == dentry) if (p->mnt_mountpoint == dentry)
return; return;
} }
} }
...@@ -557,10 +557,10 @@ static void dentry_reset_mounted(struct dentry *dentry) ...@@ -557,10 +557,10 @@ static void dentry_reset_mounted(struct dentry *dentry)
*/ */
static void detach_mnt(struct mount *mnt, struct path *old_path) static void detach_mnt(struct mount *mnt, struct path *old_path)
{ {
old_path->dentry = mnt->mnt.mnt_mountpoint; old_path->dentry = mnt->mnt_mountpoint;
old_path->mnt = &mnt->mnt_parent->mnt; old_path->mnt = &mnt->mnt_parent->mnt;
mnt->mnt_parent = mnt; mnt->mnt_parent = mnt;
mnt->mnt.mnt_mountpoint = mnt->mnt.mnt_root; mnt->mnt_mountpoint = mnt->mnt.mnt_root;
list_del_init(&mnt->mnt.mnt_child); list_del_init(&mnt->mnt.mnt_child);
list_del_init(&mnt->mnt_hash); list_del_init(&mnt->mnt_hash);
dentry_reset_mounted(old_path->dentry); dentry_reset_mounted(old_path->dentry);
...@@ -573,7 +573,7 @@ void mnt_set_mountpoint(struct vfsmount *mnt, struct dentry *dentry, ...@@ -573,7 +573,7 @@ void mnt_set_mountpoint(struct vfsmount *mnt, struct dentry *dentry,
struct mount *child_mnt) struct mount *child_mnt)
{ {
child_mnt->mnt_parent = real_mount(mntget(mnt)); child_mnt->mnt_parent = real_mount(mntget(mnt));
child_mnt->mnt.mnt_mountpoint = dget(dentry); child_mnt->mnt_mountpoint = dget(dentry);
spin_lock(&dentry->d_lock); spin_lock(&dentry->d_lock);
dentry->d_flags |= DCACHE_MOUNTED; dentry->d_flags |= DCACHE_MOUNTED;
spin_unlock(&dentry->d_lock); spin_unlock(&dentry->d_lock);
...@@ -626,7 +626,7 @@ static void commit_tree(struct mount *mnt) ...@@ -626,7 +626,7 @@ static void commit_tree(struct mount *mnt)
list_splice(&head, n->list.prev); list_splice(&head, n->list.prev);
list_add_tail(&mnt->mnt_hash, mount_hashtable + list_add_tail(&mnt->mnt_hash, mount_hashtable +
hash(&parent->mnt, mnt->mnt.mnt_mountpoint)); hash(&parent->mnt, mnt->mnt_mountpoint));
list_add_tail(&mnt->mnt.mnt_child, &parent->mnt.mnt_mounts); list_add_tail(&mnt->mnt.mnt_child, &parent->mnt.mnt_mounts);
touch_mnt_namespace(n); touch_mnt_namespace(n);
} }
...@@ -681,7 +681,7 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void ...@@ -681,7 +681,7 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void
mnt->mnt.mnt_root = root; mnt->mnt.mnt_root = root;
mnt->mnt.mnt_sb = root->d_sb; mnt->mnt.mnt_sb = root->d_sb;
mnt->mnt.mnt_mountpoint = mnt->mnt.mnt_root; mnt->mnt_mountpoint = mnt->mnt.mnt_root;
mnt->mnt_parent = mnt; mnt->mnt_parent = mnt;
return &mnt->mnt; return &mnt->mnt;
} }
...@@ -709,7 +709,7 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root, ...@@ -709,7 +709,7 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
atomic_inc(&sb->s_active); atomic_inc(&sb->s_active);
mnt->mnt.mnt_sb = sb; mnt->mnt.mnt_sb = sb;
mnt->mnt.mnt_root = dget(root); mnt->mnt.mnt_root = dget(root);
mnt->mnt.mnt_mountpoint = mnt->mnt.mnt_root; mnt->mnt_mountpoint = mnt->mnt.mnt_root;
mnt->mnt_parent = mnt; mnt->mnt_parent = mnt;
if (flag & CL_SLAVE) { if (flag & CL_SLAVE) {
...@@ -1201,9 +1201,9 @@ void release_mounts(struct list_head *head) ...@@ -1201,9 +1201,9 @@ void release_mounts(struct list_head *head)
struct vfsmount *m; struct vfsmount *m;
br_write_lock(vfsmount_lock); br_write_lock(vfsmount_lock);
dentry = mnt->mnt.mnt_mountpoint; dentry = mnt->mnt_mountpoint;
m = &mnt->mnt_parent->mnt; m = &mnt->mnt_parent->mnt;
mnt->mnt.mnt_mountpoint = mnt->mnt.mnt_root; mnt->mnt_mountpoint = mnt->mnt.mnt_root;
mnt->mnt_parent = mnt; mnt->mnt_parent = mnt;
m->mnt_ghosts--; m->mnt_ghosts--;
br_write_unlock(vfsmount_lock); br_write_unlock(vfsmount_lock);
...@@ -1238,7 +1238,7 @@ void umount_tree(struct mount *mnt, int propagate, struct list_head *kill) ...@@ -1238,7 +1238,7 @@ void umount_tree(struct mount *mnt, int propagate, struct list_head *kill)
list_del_init(&p->mnt.mnt_child); list_del_init(&p->mnt.mnt_child);
if (mnt_has_parent(p)) { if (mnt_has_parent(p)) {
p->mnt_parent->mnt.mnt_ghosts++; p->mnt_parent->mnt.mnt_ghosts++;
dentry_reset_mounted(p->mnt.mnt_mountpoint); dentry_reset_mounted(p->mnt_mountpoint);
} }
change_mnt_propagation(p, MS_PRIVATE); change_mnt_propagation(p, MS_PRIVATE);
} }
...@@ -1412,8 +1412,7 @@ static int mount_is_safe(struct path *path) ...@@ -1412,8 +1412,7 @@ static int mount_is_safe(struct path *path)
struct mount *copy_tree(struct mount *mnt, struct dentry *dentry, struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
int flag) int flag)
{ {
struct mount *res, *p, *q; struct mount *res, *p, *q, *r;
struct vfsmount *r;
struct path path; struct path path;
if (!(flag & CL_COPY_ALL) && IS_MNT_UNBINDABLE(&mnt->mnt)) if (!(flag & CL_COPY_ALL) && IS_MNT_UNBINDABLE(&mnt->mnt))
...@@ -1422,15 +1421,15 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry, ...@@ -1422,15 +1421,15 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
res = q = clone_mnt(mnt, dentry, flag); res = q = clone_mnt(mnt, dentry, flag);
if (!q) if (!q)
goto Enomem; goto Enomem;
q->mnt.mnt_mountpoint = mnt->mnt.mnt_mountpoint; q->mnt_mountpoint = mnt->mnt_mountpoint;
p = mnt; p = mnt;
list_for_each_entry(r, &mnt->mnt.mnt_mounts, mnt_child) { list_for_each_entry(r, &mnt->mnt.mnt_mounts, mnt.mnt_child) {
struct mount *s; struct mount *s;
if (!is_subdir(r->mnt_mountpoint, dentry)) if (!is_subdir(r->mnt_mountpoint, dentry))
continue; continue;
for (s = real_mount(r); s; s = next_mnt(s, r)) { for (s = r; s; s = next_mnt(s, &r->mnt)) {
if (!(flag & CL_COPY_ALL) && IS_MNT_UNBINDABLE(&s->mnt)) { if (!(flag & CL_COPY_ALL) && IS_MNT_UNBINDABLE(&s->mnt)) {
s = skip_mnt_tree(s); s = skip_mnt_tree(s);
continue; continue;
...@@ -1441,7 +1440,7 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry, ...@@ -1441,7 +1440,7 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
} }
p = s; p = s;
path.mnt = &q->mnt; path.mnt = &q->mnt;
path.dentry = p->mnt.mnt_mountpoint; path.dentry = p->mnt_mountpoint;
q = clone_mnt(p, p->mnt.mnt_root, flag); q = clone_mnt(p, p->mnt.mnt_root, flag);
if (!q) if (!q)
goto Enomem; goto Enomem;
...@@ -2564,7 +2563,7 @@ bool is_path_reachable(struct mount *mnt, struct dentry *dentry, ...@@ -2564,7 +2563,7 @@ bool is_path_reachable(struct mount *mnt, struct dentry *dentry,
const struct path *root) const struct path *root)
{ {
while (&mnt->mnt != root->mnt && mnt_has_parent(mnt)) { while (&mnt->mnt != root->mnt && mnt_has_parent(mnt)) {
dentry = mnt->mnt.mnt_mountpoint; dentry = mnt->mnt_mountpoint;
mnt = mnt->mnt_parent; mnt = mnt->mnt_parent;
} }
return &mnt->mnt == root->mnt && is_subdir(dentry, root->dentry); return &mnt->mnt == root->mnt && is_subdir(dentry, root->dentry);
......
...@@ -308,7 +308,7 @@ int propagate_mount_busy(struct mount *mnt, int refcnt) ...@@ -308,7 +308,7 @@ int propagate_mount_busy(struct mount *mnt, int refcnt)
for (m = propagation_next(&parent->mnt, &parent->mnt); m; for (m = propagation_next(&parent->mnt, &parent->mnt); m;
m = propagation_next(m, &parent->mnt)) { m = propagation_next(m, &parent->mnt)) {
child = __lookup_mnt(m, mnt->mnt.mnt_mountpoint, 0); child = __lookup_mnt(m, mnt->mnt_mountpoint, 0);
if (child && list_empty(&child->mnt.mnt_mounts) && if (child && list_empty(&child->mnt.mnt_mounts) &&
(ret = do_refcount_check(child, 1))) (ret = do_refcount_check(child, 1)))
break; break;
...@@ -331,7 +331,7 @@ static void __propagate_umount(struct mount *mnt) ...@@ -331,7 +331,7 @@ static void __propagate_umount(struct mount *mnt)
m = propagation_next(m, &parent->mnt)) { m = propagation_next(m, &parent->mnt)) {
struct mount *child = __lookup_mnt(m, struct mount *child = __lookup_mnt(m,
mnt->mnt.mnt_mountpoint, 0); mnt->mnt_mountpoint, 0);
/* /*
* umount the child only if the child has no * umount the child only if the child has no
* other children * other children
......
...@@ -53,7 +53,6 @@ struct mnt_pcp { ...@@ -53,7 +53,6 @@ struct mnt_pcp {
}; };
struct vfsmount { struct vfsmount {
struct dentry *mnt_mountpoint; /* dentry of mountpoint */
struct dentry *mnt_root; /* root of the mounted tree */ struct dentry *mnt_root; /* root of the mounted tree */
struct super_block *mnt_sb; /* pointer to superblock */ struct super_block *mnt_sb; /* pointer to superblock */
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment