diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-11-25 02:19:55 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-01-03 22:57:11 -0500 |
commit | 1a4eeaf2a8c07404e2d1c3ff99b393fd4c207170 (patch) | |
tree | dd67d87c51ac0338432faa5f6e6d28d56d724baa /fs/namespace.c | |
parent | fc7be130c7e91cf693d4bc2d9b11f08a5a4893d0 (diff) |
vfs: move mnt_list to struct mount
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r-- | fs/namespace.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index bbe24defcac7..e15125356ac1 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -202,7 +202,7 @@ static struct mount *alloc_vfsmnt(const char *name) | |||
202 | INIT_LIST_HEAD(&p->mnt_hash); | 202 | INIT_LIST_HEAD(&p->mnt_hash); |
203 | INIT_LIST_HEAD(&p->mnt_child); | 203 | INIT_LIST_HEAD(&p->mnt_child); |
204 | INIT_LIST_HEAD(&p->mnt_mounts); | 204 | INIT_LIST_HEAD(&p->mnt_mounts); |
205 | INIT_LIST_HEAD(&mnt->mnt_list); | 205 | INIT_LIST_HEAD(&p->mnt_list); |
206 | INIT_LIST_HEAD(&p->mnt_expire); | 206 | INIT_LIST_HEAD(&p->mnt_expire); |
207 | INIT_LIST_HEAD(&p->mnt_share); | 207 | INIT_LIST_HEAD(&p->mnt_share); |
208 | INIT_LIST_HEAD(&p->mnt_slave_list); | 208 | INIT_LIST_HEAD(&p->mnt_slave_list); |
@@ -618,8 +618,8 @@ static void commit_tree(struct mount *mnt) | |||
618 | 618 | ||
619 | BUG_ON(parent == mnt); | 619 | BUG_ON(parent == mnt); |
620 | 620 | ||
621 | list_add_tail(&head, &mnt->mnt.mnt_list); | 621 | list_add_tail(&head, &mnt->mnt_list); |
622 | list_for_each_entry(m, &head, mnt.mnt_list) { | 622 | list_for_each_entry(m, &head, mnt_list) { |
623 | m->mnt_ns = n; | 623 | m->mnt_ns = n; |
624 | __mnt_make_longterm(m); | 624 | __mnt_make_longterm(m); |
625 | } | 625 | } |
@@ -987,7 +987,8 @@ static void show_type(struct seq_file *m, struct super_block *sb) | |||
987 | 987 | ||
988 | static int show_vfsmnt(struct seq_file *m, void *v) | 988 | static int show_vfsmnt(struct seq_file *m, void *v) |
989 | { | 989 | { |
990 | struct vfsmount *mnt = list_entry(v, struct vfsmount, mnt_list); | 990 | struct mount *r = list_entry(v, struct mount, mnt_list); |
991 | struct vfsmount *mnt = &r->mnt; | ||
991 | int err = 0; | 992 | int err = 0; |
992 | struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt }; | 993 | struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt }; |
993 | 994 | ||
@@ -1024,8 +1025,8 @@ const struct seq_operations mounts_op = { | |||
1024 | static int show_mountinfo(struct seq_file *m, void *v) | 1025 | static int show_mountinfo(struct seq_file *m, void *v) |
1025 | { | 1026 | { |
1026 | struct proc_mounts *p = m->private; | 1027 | struct proc_mounts *p = m->private; |
1027 | struct vfsmount *mnt = list_entry(v, struct vfsmount, mnt_list); | 1028 | struct mount *r = list_entry(v, struct mount, mnt_list); |
1028 | struct mount *r = real_mount(mnt); | 1029 | struct vfsmount *mnt = &r->mnt; |
1029 | struct super_block *sb = mnt->mnt_sb; | 1030 | struct super_block *sb = mnt->mnt_sb; |
1030 | struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt }; | 1031 | struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt }; |
1031 | struct path root = p->root; | 1032 | struct path root = p->root; |
@@ -1092,7 +1093,8 @@ const struct seq_operations mountinfo_op = { | |||
1092 | 1093 | ||
1093 | static int show_vfsstat(struct seq_file *m, void *v) | 1094 | static int show_vfsstat(struct seq_file *m, void *v) |
1094 | { | 1095 | { |
1095 | struct vfsmount *mnt = list_entry(v, struct vfsmount, mnt_list); | 1096 | struct mount *r = list_entry(v, struct mount, mnt_list); |
1097 | struct vfsmount *mnt = &r->mnt; | ||
1096 | struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt }; | 1098 | struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt }; |
1097 | int err = 0; | 1099 | int err = 0; |
1098 | 1100 | ||
@@ -1235,7 +1237,7 @@ void umount_tree(struct mount *mnt, int propagate, struct list_head *kill) | |||
1235 | 1237 | ||
1236 | list_for_each_entry(p, &tmp_list, mnt_hash) { | 1238 | list_for_each_entry(p, &tmp_list, mnt_hash) { |
1237 | list_del_init(&p->mnt_expire); | 1239 | list_del_init(&p->mnt_expire); |
1238 | list_del_init(&p->mnt.mnt_list); | 1240 | list_del_init(&p->mnt_list); |
1239 | __touch_mnt_namespace(p->mnt_ns); | 1241 | __touch_mnt_namespace(p->mnt_ns); |
1240 | p->mnt_ns = NULL; | 1242 | p->mnt_ns = NULL; |
1241 | __mnt_make_shortterm(p); | 1243 | __mnt_make_shortterm(p); |
@@ -1331,7 +1333,7 @@ static int do_umount(struct mount *mnt, int flags) | |||
1331 | 1333 | ||
1332 | retval = -EBUSY; | 1334 | retval = -EBUSY; |
1333 | if (flags & MNT_DETACH || !propagate_mount_busy(mnt, 2)) { | 1335 | if (flags & MNT_DETACH || !propagate_mount_busy(mnt, 2)) { |
1334 | if (!list_empty(&mnt->mnt.mnt_list)) | 1336 | if (!list_empty(&mnt->mnt_list)) |
1335 | umount_tree(mnt, 1, &umount_list); | 1337 | umount_tree(mnt, 1, &umount_list); |
1336 | retval = 0; | 1338 | retval = 0; |
1337 | } | 1339 | } |
@@ -1451,7 +1453,7 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry, | |||
1451 | if (!q) | 1453 | if (!q) |
1452 | goto Enomem; | 1454 | goto Enomem; |
1453 | br_write_lock(vfsmount_lock); | 1455 | br_write_lock(vfsmount_lock); |
1454 | list_add_tail(&q->mnt.mnt_list, &res->mnt.mnt_list); | 1456 | list_add_tail(&q->mnt_list, &res->mnt_list); |
1455 | attach_mnt(q, &path); | 1457 | attach_mnt(q, &path); |
1456 | br_write_unlock(vfsmount_lock); | 1458 | br_write_unlock(vfsmount_lock); |
1457 | } | 1459 | } |
@@ -1492,12 +1494,12 @@ void drop_collected_mounts(struct vfsmount *mnt) | |||
1492 | int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg, | 1494 | int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg, |
1493 | struct vfsmount *root) | 1495 | struct vfsmount *root) |
1494 | { | 1496 | { |
1495 | struct vfsmount *mnt; | 1497 | struct mount *mnt; |
1496 | int res = f(root, arg); | 1498 | int res = f(root, arg); |
1497 | if (res) | 1499 | if (res) |
1498 | return res; | 1500 | return res; |
1499 | list_for_each_entry(mnt, &root->mnt_list, mnt_list) { | 1501 | list_for_each_entry(mnt, &real_mount(root)->mnt_list, mnt_list) { |
1500 | res = f(mnt, arg); | 1502 | res = f(&mnt->mnt, arg); |
1501 | if (res) | 1503 | if (res) |
1502 | return res; | 1504 | return res; |
1503 | } | 1505 | } |
@@ -2415,7 +2417,7 @@ static struct mnt_namespace *dup_mnt_ns(struct mnt_namespace *mnt_ns, | |||
2415 | } | 2417 | } |
2416 | new_ns->root = &new->mnt; | 2418 | new_ns->root = &new->mnt; |
2417 | br_write_lock(vfsmount_lock); | 2419 | br_write_lock(vfsmount_lock); |
2418 | list_add_tail(&new_ns->list, &new_ns->root->mnt_list); | 2420 | list_add_tail(&new_ns->list, &new->mnt_list); |
2419 | br_write_unlock(vfsmount_lock); | 2421 | br_write_unlock(vfsmount_lock); |
2420 | 2422 | ||
2421 | /* | 2423 | /* |
@@ -2476,18 +2478,17 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns, | |||
2476 | * create_mnt_ns - creates a private namespace and adds a root filesystem | 2478 | * create_mnt_ns - creates a private namespace and adds a root filesystem |
2477 | * @mnt: pointer to the new root filesystem mountpoint | 2479 | * @mnt: pointer to the new root filesystem mountpoint |
2478 | */ | 2480 | */ |
2479 | static struct mnt_namespace *create_mnt_ns(struct vfsmount *mnt) | 2481 | static struct mnt_namespace *create_mnt_ns(struct vfsmount *m) |
2480 | { | 2482 | { |
2481 | struct mnt_namespace *new_ns; | 2483 | struct mnt_namespace *new_ns = alloc_mnt_ns(); |
2482 | |||
2483 | new_ns = alloc_mnt_ns(); | ||
2484 | if (!IS_ERR(new_ns)) { | 2484 | if (!IS_ERR(new_ns)) { |
2485 | real_mount(mnt)->mnt_ns = new_ns; | 2485 | struct mount *mnt = real_mount(m); |
2486 | __mnt_make_longterm(real_mount(mnt)); | 2486 | mnt->mnt_ns = new_ns; |
2487 | new_ns->root = mnt; | 2487 | __mnt_make_longterm(mnt); |
2488 | list_add(&new_ns->list, &new_ns->root->mnt_list); | 2488 | new_ns->root = m; |
2489 | list_add(&new_ns->list, &mnt->mnt_list); | ||
2489 | } else { | 2490 | } else { |
2490 | mntput(mnt); | 2491 | mntput(m); |
2491 | } | 2492 | } |
2492 | return new_ns; | 2493 | return new_ns; |
2493 | } | 2494 | } |