提交 1b8e5564 编写于 作者: A Al Viro

vfs: the first spoils - mnt_hash moved

taken out of struct vfsmount into struct mount
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 d5e50f74
#include <linux/mount.h> #include <linux/mount.h>
struct mount { struct mount {
struct list_head mnt_hash;
struct vfsmount mnt; struct vfsmount mnt;
}; };
......
...@@ -199,7 +199,7 @@ static struct mount *alloc_vfsmnt(const char *name) ...@@ -199,7 +199,7 @@ static struct mount *alloc_vfsmnt(const char *name)
mnt->mnt_writers = 0; mnt->mnt_writers = 0;
#endif #endif
INIT_LIST_HEAD(&p->mnt.mnt_hash); INIT_LIST_HEAD(&p->mnt_hash);
INIT_LIST_HEAD(&mnt->mnt_child); INIT_LIST_HEAD(&mnt->mnt_child);
INIT_LIST_HEAD(&mnt->mnt_mounts); INIT_LIST_HEAD(&mnt->mnt_mounts);
INIT_LIST_HEAD(&mnt->mnt_list); INIT_LIST_HEAD(&mnt->mnt_list);
...@@ -475,7 +475,7 @@ struct mount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry, ...@@ -475,7 +475,7 @@ struct mount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry,
p = NULL; p = NULL;
if (tmp == head) if (tmp == head)
break; break;
p = list_entry(tmp, struct mount, mnt.mnt_hash); p = list_entry(tmp, struct mount, mnt_hash);
if (p->mnt.mnt_parent == mnt && p->mnt.mnt_mountpoint == dentry) { if (p->mnt.mnt_parent == mnt && p->mnt.mnt_mountpoint == dentry) {
found = p; found = p;
break; break;
...@@ -542,7 +542,7 @@ static void dentry_reset_mounted(struct dentry *dentry) ...@@ -542,7 +542,7 @@ static void dentry_reset_mounted(struct dentry *dentry)
for (u = 0; u < HASH_SIZE; u++) { for (u = 0; u < HASH_SIZE; u++) {
struct mount *p; struct mount *p;
list_for_each_entry(p, &mount_hashtable[u], mnt.mnt_hash) { list_for_each_entry(p, &mount_hashtable[u], mnt_hash) {
if (p->mnt.mnt_mountpoint == dentry) if (p->mnt.mnt_mountpoint == dentry)
return; return;
} }
...@@ -562,7 +562,7 @@ static void detach_mnt(struct mount *mnt, struct path *old_path) ...@@ -562,7 +562,7 @@ static void detach_mnt(struct mount *mnt, struct path *old_path)
mnt->mnt.mnt_parent = &mnt->mnt; mnt->mnt.mnt_parent = &mnt->mnt;
mnt->mnt.mnt_mountpoint = mnt->mnt.mnt_root; mnt->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.mnt_hash); list_del_init(&mnt->mnt_hash);
dentry_reset_mounted(old_path->dentry); dentry_reset_mounted(old_path->dentry);
} }
...@@ -585,7 +585,7 @@ void mnt_set_mountpoint(struct vfsmount *mnt, struct dentry *dentry, ...@@ -585,7 +585,7 @@ void mnt_set_mountpoint(struct vfsmount *mnt, struct dentry *dentry,
static void attach_mnt(struct mount *mnt, struct path *path) static void attach_mnt(struct mount *mnt, struct path *path)
{ {
mnt_set_mountpoint(path->mnt, path->dentry, &mnt->mnt); mnt_set_mountpoint(path->mnt, path->dentry, &mnt->mnt);
list_add_tail(&mnt->mnt.mnt_hash, mount_hashtable + list_add_tail(&mnt->mnt_hash, mount_hashtable +
hash(path->mnt, path->dentry)); hash(path->mnt, path->dentry));
list_add_tail(&mnt->mnt.mnt_child, &path->mnt->mnt_mounts); list_add_tail(&mnt->mnt.mnt_child, &path->mnt->mnt_mounts);
} }
...@@ -625,7 +625,7 @@ static void commit_tree(struct mount *mnt) ...@@ -625,7 +625,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.mnt_hash, mount_hashtable + list_add_tail(&mnt->mnt_hash, mount_hashtable +
hash(parent, mnt->mnt.mnt_mountpoint)); hash(parent, mnt->mnt.mnt_mountpoint));
list_add_tail(&mnt->mnt.mnt_child, &parent->mnt_mounts); list_add_tail(&mnt->mnt.mnt_child, &parent->mnt_mounts);
touch_mnt_namespace(n); touch_mnt_namespace(n);
...@@ -1193,8 +1193,8 @@ void release_mounts(struct list_head *head) ...@@ -1193,8 +1193,8 @@ void release_mounts(struct list_head *head)
{ {
struct mount *mnt; struct mount *mnt;
while (!list_empty(head)) { while (!list_empty(head)) {
mnt = list_first_entry(head, struct mount, mnt.mnt_hash); mnt = list_first_entry(head, struct mount, mnt_hash);
list_del_init(&mnt->mnt.mnt_hash); list_del_init(&mnt->mnt_hash);
if (mnt_has_parent(&mnt->mnt)) { if (mnt_has_parent(&mnt->mnt)) {
struct dentry *dentry; struct dentry *dentry;
struct vfsmount *m; struct vfsmount *m;
...@@ -1223,12 +1223,12 @@ void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill) ...@@ -1223,12 +1223,12 @@ void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill)
struct mount *p; struct mount *p;
for (p = real_mount(mnt); p; p = next_mnt(p, mnt)) for (p = real_mount(mnt); p; p = next_mnt(p, mnt))
list_move(&p->mnt.mnt_hash, &tmp_list); list_move(&p->mnt_hash, &tmp_list);
if (propagate) if (propagate)
propagate_umount(&tmp_list); propagate_umount(&tmp_list);
list_for_each_entry(p, &tmp_list, mnt.mnt_hash) { list_for_each_entry(p, &tmp_list, mnt_hash) {
list_del_init(&p->mnt.mnt_expire); list_del_init(&p->mnt.mnt_expire);
list_del_init(&p->mnt.mnt_list); list_del_init(&p->mnt.mnt_list);
__touch_mnt_namespace(p->mnt.mnt_ns); __touch_mnt_namespace(p->mnt.mnt_ns);
...@@ -1620,8 +1620,8 @@ static int attach_recursive_mnt(struct mount *source_mnt, ...@@ -1620,8 +1620,8 @@ static int attach_recursive_mnt(struct mount *source_mnt,
commit_tree(source_mnt); commit_tree(source_mnt);
} }
list_for_each_entry_safe(child, p, &tree_list, mnt.mnt_hash) { list_for_each_entry_safe(child, p, &tree_list, mnt_hash) {
list_del_init(&child->mnt.mnt_hash); list_del_init(&child->mnt_hash);
commit_tree(child); commit_tree(child);
} }
br_write_unlock(vfsmount_lock); br_write_unlock(vfsmount_lock);
......
...@@ -247,13 +247,13 @@ int propagate_mnt(struct vfsmount *dest_mnt, struct dentry *dest_dentry, ...@@ -247,13 +247,13 @@ int propagate_mnt(struct vfsmount *dest_mnt, struct dentry *dest_dentry,
if (is_subdir(dest_dentry, m->mnt_root)) { if (is_subdir(dest_dentry, m->mnt_root)) {
mnt_set_mountpoint(m, dest_dentry, &child->mnt); mnt_set_mountpoint(m, dest_dentry, &child->mnt);
list_add_tail(&child->mnt.mnt_hash, tree_list); list_add_tail(&child->mnt_hash, tree_list);
} else { } else {
/* /*
* This can happen if the parent mount was bind mounted * This can happen if the parent mount was bind mounted
* on some subdirectory of a shared/slave mount. * on some subdirectory of a shared/slave mount.
*/ */
list_add_tail(&child->mnt.mnt_hash, &tmp_list); list_add_tail(&child->mnt_hash, &tmp_list);
} }
prev_dest_mnt = m; prev_dest_mnt = m;
prev_src_mnt = &child->mnt; prev_src_mnt = &child->mnt;
...@@ -261,7 +261,7 @@ int propagate_mnt(struct vfsmount *dest_mnt, struct dentry *dest_dentry, ...@@ -261,7 +261,7 @@ int propagate_mnt(struct vfsmount *dest_mnt, struct dentry *dest_dentry,
out: out:
br_write_lock(vfsmount_lock); br_write_lock(vfsmount_lock);
while (!list_empty(&tmp_list)) { while (!list_empty(&tmp_list)) {
child = list_first_entry(&tmp_list, struct mount, mnt.mnt_hash); child = list_first_entry(&tmp_list, struct mount, mnt_hash);
umount_tree(&child->mnt, 0, &umount_list); umount_tree(&child->mnt, 0, &umount_list);
} }
br_write_unlock(vfsmount_lock); br_write_unlock(vfsmount_lock);
...@@ -337,7 +337,7 @@ static void __propagate_umount(struct mount *mnt) ...@@ -337,7 +337,7 @@ static void __propagate_umount(struct mount *mnt)
* other children * other children
*/ */
if (child && list_empty(&child->mnt.mnt_mounts)) if (child && list_empty(&child->mnt.mnt_mounts))
list_move_tail(&child->mnt.mnt_hash, &mnt->mnt.mnt_hash); list_move_tail(&child->mnt_hash, &mnt->mnt_hash);
} }
} }
...@@ -352,7 +352,7 @@ int propagate_umount(struct list_head *list) ...@@ -352,7 +352,7 @@ int propagate_umount(struct list_head *list)
{ {
struct mount *mnt; struct mount *mnt;
list_for_each_entry(mnt, list, mnt.mnt_hash) list_for_each_entry(mnt, list, mnt_hash)
__propagate_umount(mnt); __propagate_umount(mnt);
return 0; return 0;
} }
...@@ -53,7 +53,6 @@ struct mnt_pcp { ...@@ -53,7 +53,6 @@ struct mnt_pcp {
}; };
struct vfsmount { struct vfsmount {
struct list_head mnt_hash;
struct vfsmount *mnt_parent; /* fs we are mounted on */ struct vfsmount *mnt_parent; /* fs we are mounted on */
struct dentry *mnt_mountpoint; /* dentry of mountpoint */ 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 */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册