diff options
author | Jan Blunck <jblunck@suse.de> | 2008-02-14 22:34:32 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-15 00:13:33 -0500 |
commit | 4ac9137858e08a19f29feac4e1f4df7c268b0ba5 (patch) | |
tree | f5b5d84fd12fcc2b0ba0e7ce1a79ff381ad8f5dd /fs/nfs/namespace.c | |
parent | c5e725f33b733a77de622e91b6ba5645fcf070be (diff) |
Embed a struct path into struct nameidata instead of nd->{dentry,mnt}
This is the central patch of a cleanup series. In most cases there is no good
reason why someone would want to use a dentry for itself. This series reflects
that fact and embeds a struct path into nameidata.
Together with the other patches of this series
- it enforced the correct order of getting/releasing the reference count on
<dentry,vfsmount> pairs
- it prepares the VFS for stacking support since it is essential to have a
struct path in every place where the stack can be traversed
- it reduces the overall code size:
without patch series:
text data bss dec hex filename
5321639 858418 715768 6895825 6938d1 vmlinux
with patch series:
text data bss dec hex filename
5320026 858418 715768 6894212 693284 vmlinux
This patch:
Switch from nd->{dentry,mnt} to nd->path.{dentry,mnt} everywhere.
[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: fix cifs]
[akpm@linux-foundation.org: fix smack]
Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/nfs/namespace.c')
-rw-r--r-- | fs/nfs/namespace.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index be4ce1c3a3d8..3b6d83dc98a7 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c | |||
@@ -107,38 +107,40 @@ static void * nfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd) | |||
107 | 107 | ||
108 | BUG_ON(IS_ROOT(dentry)); | 108 | BUG_ON(IS_ROOT(dentry)); |
109 | dprintk("%s: enter\n", __FUNCTION__); | 109 | dprintk("%s: enter\n", __FUNCTION__); |
110 | dput(nd->dentry); | 110 | dput(nd->path.dentry); |
111 | nd->dentry = dget(dentry); | 111 | nd->path.dentry = dget(dentry); |
112 | 112 | ||
113 | /* Look it up again */ | 113 | /* Look it up again */ |
114 | parent = dget_parent(nd->dentry); | 114 | parent = dget_parent(nd->path.dentry); |
115 | err = server->nfs_client->rpc_ops->lookup(parent->d_inode, | 115 | err = server->nfs_client->rpc_ops->lookup(parent->d_inode, |
116 | &nd->dentry->d_name, | 116 | &nd->path.dentry->d_name, |
117 | &fh, &fattr); | 117 | &fh, &fattr); |
118 | dput(parent); | 118 | dput(parent); |
119 | if (err != 0) | 119 | if (err != 0) |
120 | goto out_err; | 120 | goto out_err; |
121 | 121 | ||
122 | if (fattr.valid & NFS_ATTR_FATTR_V4_REFERRAL) | 122 | if (fattr.valid & NFS_ATTR_FATTR_V4_REFERRAL) |
123 | mnt = nfs_do_refmount(nd->mnt, nd->dentry); | 123 | mnt = nfs_do_refmount(nd->path.mnt, nd->path.dentry); |
124 | else | 124 | else |
125 | mnt = nfs_do_submount(nd->mnt, nd->dentry, &fh, &fattr); | 125 | mnt = nfs_do_submount(nd->path.mnt, nd->path.dentry, &fh, |
126 | &fattr); | ||
126 | err = PTR_ERR(mnt); | 127 | err = PTR_ERR(mnt); |
127 | if (IS_ERR(mnt)) | 128 | if (IS_ERR(mnt)) |
128 | goto out_err; | 129 | goto out_err; |
129 | 130 | ||
130 | mntget(mnt); | 131 | mntget(mnt); |
131 | err = do_add_mount(mnt, nd, nd->mnt->mnt_flags|MNT_SHRINKABLE, &nfs_automount_list); | 132 | err = do_add_mount(mnt, nd, nd->path.mnt->mnt_flags|MNT_SHRINKABLE, |
133 | &nfs_automount_list); | ||
132 | if (err < 0) { | 134 | if (err < 0) { |
133 | mntput(mnt); | 135 | mntput(mnt); |
134 | if (err == -EBUSY) | 136 | if (err == -EBUSY) |
135 | goto out_follow; | 137 | goto out_follow; |
136 | goto out_err; | 138 | goto out_err; |
137 | } | 139 | } |
138 | mntput(nd->mnt); | 140 | mntput(nd->path.mnt); |
139 | dput(nd->dentry); | 141 | dput(nd->path.dentry); |
140 | nd->mnt = mnt; | 142 | nd->path.mnt = mnt; |
141 | nd->dentry = dget(mnt->mnt_root); | 143 | nd->path.dentry = dget(mnt->mnt_root); |
142 | schedule_delayed_work(&nfs_automount_task, nfs_mountpoint_expiry_timeout); | 144 | schedule_delayed_work(&nfs_automount_task, nfs_mountpoint_expiry_timeout); |
143 | out: | 145 | out: |
144 | dprintk("%s: done, returned %d\n", __FUNCTION__, err); | 146 | dprintk("%s: done, returned %d\n", __FUNCTION__, err); |
@@ -149,7 +151,8 @@ out_err: | |||
149 | path_release(nd); | 151 | path_release(nd); |
150 | goto out; | 152 | goto out; |
151 | out_follow: | 153 | out_follow: |
152 | while(d_mountpoint(nd->dentry) && follow_down(&nd->mnt, &nd->dentry)) | 154 | while (d_mountpoint(nd->path.dentry) && |
155 | follow_down(&nd->path.mnt, &nd->path.dentry)) | ||
153 | ; | 156 | ; |
154 | err = 0; | 157 | err = 0; |
155 | goto out; | 158 | goto out; |