aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-11-24 22:25:07 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-01-03 22:57:05 -0500
commita73324da7af4052e1d1ddec6a5980f552420e58b (patch)
tree65c119bf3bb852c4298aeb24b906dc3a5be7520a /fs
parent0714a533805a0f8ebfc6fdb6bda9f129b8c7c6d7 (diff)
vfs: move mnt_mountpoint to struct mount
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/dcache.c2
-rw-r--r--fs/mount.h1
-rw-r--r--fs/namei.c4
-rw-r--r--fs/namespace.c35
-rw-r--r--fs/pnode.c4
5 files changed, 23 insertions, 23 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 98b48753f77b..24790041ea76 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2464,7 +2464,7 @@ static int prepend_path(const struct path *path,
2464 /* Global root? */ 2464 /* Global root? */
2465 if (!mnt_has_parent(mnt)) 2465 if (!mnt_has_parent(mnt))
2466 goto global_root; 2466 goto global_root;
2467 dentry = mnt->mnt.mnt_mountpoint; 2467 dentry = mnt->mnt_mountpoint;
2468 mnt = mnt->mnt_parent; 2468 mnt = mnt->mnt_parent;
2469 vfsmnt = &mnt->mnt; 2469 vfsmnt = &mnt->mnt;
2470 continue; 2470 continue;
diff --git a/fs/mount.h b/fs/mount.h
index 201dd616e6c4..853738f5897f 100644
--- a/fs/mount.h
+++ b/fs/mount.h
@@ -3,6 +3,7 @@
3struct mount { 3struct mount {
4 struct list_head mnt_hash; 4 struct list_head mnt_hash;
5 struct mount *mnt_parent; 5 struct mount *mnt_parent;
6 struct dentry *mnt_mountpoint;
6 struct vfsmount mnt; 7 struct vfsmount mnt;
7}; 8};
8 9
diff --git a/fs/namei.c b/fs/namei.c
index 2e9110a37c0e..87363aab43f0 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -684,7 +684,7 @@ static int follow_up_rcu(struct path *path)
684 parent = mnt->mnt_parent; 684 parent = mnt->mnt_parent;
685 if (&parent->mnt == path->mnt) 685 if (&parent->mnt == path->mnt)
686 return 0; 686 return 0;
687 mountpoint = mnt->mnt.mnt_mountpoint; 687 mountpoint = mnt->mnt_mountpoint;
688 path->dentry = mountpoint; 688 path->dentry = mountpoint;
689 path->mnt = &parent->mnt; 689 path->mnt = &parent->mnt;
690 return 1; 690 return 1;
@@ -703,7 +703,7 @@ int follow_up(struct path *path)
703 return 0; 703 return 0;
704 } 704 }
705 mntget(&parent->mnt); 705 mntget(&parent->mnt);
706 mountpoint = dget(mnt->mnt.mnt_mountpoint); 706 mountpoint = dget(mnt->mnt_mountpoint);
707 br_read_unlock(vfsmount_lock); 707 br_read_unlock(vfsmount_lock);
708 dput(path->dentry); 708 dput(path->dentry);
709 path->dentry = mountpoint; 709 path->dentry = mountpoint;
diff --git a/fs/namespace.c b/fs/namespace.c
index 5e700c6df579..ec798e77b726 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -476,7 +476,7 @@ struct mount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry,
476 if (tmp == head) 476 if (tmp == head)
477 break; 477 break;
478 p = list_entry(tmp, struct mount, mnt_hash); 478 p = list_entry(tmp, struct mount, mnt_hash);
479 if (&p->mnt_parent->mnt == mnt && p->mnt.mnt_mountpoint == dentry) { 479 if (&p->mnt_parent->mnt == mnt && p->mnt_mountpoint == dentry) {
480 found = p; 480 found = p;
481 break; 481 break;
482 } 482 }
@@ -543,7 +543,7 @@ static void dentry_reset_mounted(struct dentry *dentry)
543 struct mount *p; 543 struct mount *p;
544 544
545 list_for_each_entry(p, &mount_hashtable[u], mnt_hash) { 545 list_for_each_entry(p, &mount_hashtable[u], mnt_hash) {
546 if (p->mnt.mnt_mountpoint == dentry) 546 if (p->mnt_mountpoint == dentry)
547 return; 547 return;
548 } 548 }
549 } 549 }
@@ -557,10 +557,10 @@ static void dentry_reset_mounted(struct dentry *dentry)
557 */ 557 */
558static void detach_mnt(struct mount *mnt, struct path *old_path) 558static void detach_mnt(struct mount *mnt, struct path *old_path)
559{ 559{
560 old_path->dentry = mnt->mnt.mnt_mountpoint; 560 old_path->dentry = mnt->mnt_mountpoint;
561 old_path->mnt = &mnt->mnt_parent->mnt; 561 old_path->mnt = &mnt->mnt_parent->mnt;
562 mnt->mnt_parent = mnt; 562 mnt->mnt_parent = mnt;
563 mnt->mnt.mnt_mountpoint = mnt->mnt.mnt_root; 563 mnt->mnt_mountpoint = mnt->mnt.mnt_root;
564 list_del_init(&mnt->mnt.mnt_child); 564 list_del_init(&mnt->mnt.mnt_child);
565 list_del_init(&mnt->mnt_hash); 565 list_del_init(&mnt->mnt_hash);
566 dentry_reset_mounted(old_path->dentry); 566 dentry_reset_mounted(old_path->dentry);
@@ -573,7 +573,7 @@ void mnt_set_mountpoint(struct vfsmount *mnt, struct dentry *dentry,
573 struct mount *child_mnt) 573 struct mount *child_mnt)
574{ 574{
575 child_mnt->mnt_parent = real_mount(mntget(mnt)); 575 child_mnt->mnt_parent = real_mount(mntget(mnt));
576 child_mnt->mnt.mnt_mountpoint = dget(dentry); 576 child_mnt->mnt_mountpoint = dget(dentry);
577 spin_lock(&dentry->d_lock); 577 spin_lock(&dentry->d_lock);
578 dentry->d_flags |= DCACHE_MOUNTED; 578 dentry->d_flags |= DCACHE_MOUNTED;
579 spin_unlock(&dentry->d_lock); 579 spin_unlock(&dentry->d_lock);
@@ -626,7 +626,7 @@ static void commit_tree(struct mount *mnt)
626 list_splice(&head, n->list.prev); 626 list_splice(&head, n->list.prev);
627 627
628 list_add_tail(&mnt->mnt_hash, mount_hashtable + 628 list_add_tail(&mnt->mnt_hash, mount_hashtable +
629 hash(&parent->mnt, mnt->mnt.mnt_mountpoint)); 629 hash(&parent->mnt, mnt->mnt_mountpoint));
630 list_add_tail(&mnt->mnt.mnt_child, &parent->mnt.mnt_mounts); 630 list_add_tail(&mnt->mnt.mnt_child, &parent->mnt.mnt_mounts);
631 touch_mnt_namespace(n); 631 touch_mnt_namespace(n);
632} 632}
@@ -681,7 +681,7 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void
681 681
682 mnt->mnt.mnt_root = root; 682 mnt->mnt.mnt_root = root;
683 mnt->mnt.mnt_sb = root->d_sb; 683 mnt->mnt.mnt_sb = root->d_sb;
684 mnt->mnt.mnt_mountpoint = mnt->mnt.mnt_root; 684 mnt->mnt_mountpoint = mnt->mnt.mnt_root;
685 mnt->mnt_parent = mnt; 685 mnt->mnt_parent = mnt;
686 return &mnt->mnt; 686 return &mnt->mnt;
687} 687}
@@ -709,7 +709,7 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
709 atomic_inc(&sb->s_active); 709 atomic_inc(&sb->s_active);
710 mnt->mnt.mnt_sb = sb; 710 mnt->mnt.mnt_sb = sb;
711 mnt->mnt.mnt_root = dget(root); 711 mnt->mnt.mnt_root = dget(root);
712 mnt->mnt.mnt_mountpoint = mnt->mnt.mnt_root; 712 mnt->mnt_mountpoint = mnt->mnt.mnt_root;
713 mnt->mnt_parent = mnt; 713 mnt->mnt_parent = mnt;
714 714
715 if (flag & CL_SLAVE) { 715 if (flag & CL_SLAVE) {
@@ -1201,9 +1201,9 @@ void release_mounts(struct list_head *head)
1201 struct vfsmount *m; 1201 struct vfsmount *m;
1202 1202
1203 br_write_lock(vfsmount_lock); 1203 br_write_lock(vfsmount_lock);
1204 dentry = mnt->mnt.mnt_mountpoint; 1204 dentry = mnt->mnt_mountpoint;
1205 m = &mnt->mnt_parent->mnt; 1205 m = &mnt->mnt_parent->mnt;
1206 mnt->mnt.mnt_mountpoint = mnt->mnt.mnt_root; 1206 mnt->mnt_mountpoint = mnt->mnt.mnt_root;
1207 mnt->mnt_parent = mnt; 1207 mnt->mnt_parent = mnt;
1208 m->mnt_ghosts--; 1208 m->mnt_ghosts--;
1209 br_write_unlock(vfsmount_lock); 1209 br_write_unlock(vfsmount_lock);
@@ -1238,7 +1238,7 @@ void umount_tree(struct mount *mnt, int propagate, struct list_head *kill)
1238 list_del_init(&p->mnt.mnt_child); 1238 list_del_init(&p->mnt.mnt_child);
1239 if (mnt_has_parent(p)) { 1239 if (mnt_has_parent(p)) {
1240 p->mnt_parent->mnt.mnt_ghosts++; 1240 p->mnt_parent->mnt.mnt_ghosts++;
1241 dentry_reset_mounted(p->mnt.mnt_mountpoint); 1241 dentry_reset_mounted(p->mnt_mountpoint);
1242 } 1242 }
1243 change_mnt_propagation(p, MS_PRIVATE); 1243 change_mnt_propagation(p, MS_PRIVATE);
1244 } 1244 }
@@ -1412,8 +1412,7 @@ static int mount_is_safe(struct path *path)
1412struct mount *copy_tree(struct mount *mnt, struct dentry *dentry, 1412struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
1413 int flag) 1413 int flag)
1414{ 1414{
1415 struct mount *res, *p, *q; 1415 struct mount *res, *p, *q, *r;
1416 struct vfsmount *r;
1417 struct path path; 1416 struct path path;
1418 1417
1419 if (!(flag & CL_COPY_ALL) && IS_MNT_UNBINDABLE(&mnt->mnt)) 1418 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 res = q = clone_mnt(mnt, dentry, flag); 1421 res = q = clone_mnt(mnt, dentry, flag);
1423 if (!q) 1422 if (!q)
1424 goto Enomem; 1423 goto Enomem;
1425 q->mnt.mnt_mountpoint = mnt->mnt.mnt_mountpoint; 1424 q->mnt_mountpoint = mnt->mnt_mountpoint;
1426 1425
1427 p = mnt; 1426 p = mnt;
1428 list_for_each_entry(r, &mnt->mnt.mnt_mounts, mnt_child) { 1427 list_for_each_entry(r, &mnt->mnt.mnt_mounts, mnt.mnt_child) {
1429 struct mount *s; 1428 struct mount *s;
1430 if (!is_subdir(r->mnt_mountpoint, dentry)) 1429 if (!is_subdir(r->mnt_mountpoint, dentry))
1431 continue; 1430 continue;
1432 1431
1433 for (s = real_mount(r); s; s = next_mnt(s, r)) { 1432 for (s = r; s; s = next_mnt(s, &r->mnt)) {
1434 if (!(flag & CL_COPY_ALL) && IS_MNT_UNBINDABLE(&s->mnt)) { 1433 if (!(flag & CL_COPY_ALL) && IS_MNT_UNBINDABLE(&s->mnt)) {
1435 s = skip_mnt_tree(s); 1434 s = skip_mnt_tree(s);
1436 continue; 1435 continue;
@@ -1441,7 +1440,7 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
1441 } 1440 }
1442 p = s; 1441 p = s;
1443 path.mnt = &q->mnt; 1442 path.mnt = &q->mnt;
1444 path.dentry = p->mnt.mnt_mountpoint; 1443 path.dentry = p->mnt_mountpoint;
1445 q = clone_mnt(p, p->mnt.mnt_root, flag); 1444 q = clone_mnt(p, p->mnt.mnt_root, flag);
1446 if (!q) 1445 if (!q)
1447 goto Enomem; 1446 goto Enomem;
@@ -2564,7 +2563,7 @@ bool is_path_reachable(struct mount *mnt, struct dentry *dentry,
2564 const struct path *root) 2563 const struct path *root)
2565{ 2564{
2566 while (&mnt->mnt != root->mnt && mnt_has_parent(mnt)) { 2565 while (&mnt->mnt != root->mnt && mnt_has_parent(mnt)) {
2567 dentry = mnt->mnt.mnt_mountpoint; 2566 dentry = mnt->mnt_mountpoint;
2568 mnt = mnt->mnt_parent; 2567 mnt = mnt->mnt_parent;
2569 } 2568 }
2570 return &mnt->mnt == root->mnt && is_subdir(dentry, root->dentry); 2569 return &mnt->mnt == root->mnt && is_subdir(dentry, root->dentry);
diff --git a/fs/pnode.c b/fs/pnode.c
index 7fddc671f729..bd280200bd37 100644
--- a/fs/pnode.c
+++ b/fs/pnode.c
@@ -308,7 +308,7 @@ int propagate_mount_busy(struct mount *mnt, int refcnt)
308 308
309 for (m = propagation_next(&parent->mnt, &parent->mnt); m; 309 for (m = propagation_next(&parent->mnt, &parent->mnt); m;
310 m = propagation_next(m, &parent->mnt)) { 310 m = propagation_next(m, &parent->mnt)) {
311 child = __lookup_mnt(m, mnt->mnt.mnt_mountpoint, 0); 311 child = __lookup_mnt(m, mnt->mnt_mountpoint, 0);
312 if (child && list_empty(&child->mnt.mnt_mounts) && 312 if (child && list_empty(&child->mnt.mnt_mounts) &&
313 (ret = do_refcount_check(child, 1))) 313 (ret = do_refcount_check(child, 1)))
314 break; 314 break;
@@ -331,7 +331,7 @@ static void __propagate_umount(struct mount *mnt)
331 m = propagation_next(m, &parent->mnt)) { 331 m = propagation_next(m, &parent->mnt)) {
332 332
333 struct mount *child = __lookup_mnt(m, 333 struct mount *child = __lookup_mnt(m,
334 mnt->mnt.mnt_mountpoint, 0); 334 mnt->mnt_mountpoint, 0);
335 /* 335 /*
336 * umount the child only if the child has no 336 * umount the child only if the child has no
337 * other children 337 * other children