diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2010-06-06 18:43:19 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-08-09 16:48:08 -0400 |
commit | 52b209f7b848a28987ed133dc2b48f304b1dc6b8 (patch) | |
tree | 219c337db2c9910c4029977d327b6cfbd5c91d0f /fs | |
parent | 601d2c38b93130d387091c28d13abea40924e518 (diff) |
get rid of hostfs_read_inode()
There are only two call sites; in one (hostfs_iget()) it's actually
a no-op and in another (fill_super()) it's easier to expand the
damn thing and use what we know about its arguments to simplify
it.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/hostfs/hostfs_kern.c | 69 |
1 files changed, 16 insertions, 53 deletions
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 7e6750499b8b..25d79298a98e 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -204,50 +204,11 @@ static char *follow_link(char *link) | |||
204 | return ERR_PTR(n); | 204 | return ERR_PTR(n); |
205 | } | 205 | } |
206 | 206 | ||
207 | static int hostfs_read_inode(struct inode *ino) | ||
208 | { | ||
209 | char *name; | ||
210 | int err = 0; | ||
211 | |||
212 | /* | ||
213 | * Unfortunately, we are called from iget() when we don't have a dentry | ||
214 | * allocated yet. | ||
215 | */ | ||
216 | if (list_empty(&ino->i_dentry)) | ||
217 | goto out; | ||
218 | |||
219 | err = -ENOMEM; | ||
220 | name = inode_name(ino, 0); | ||
221 | if (name == NULL) | ||
222 | goto out; | ||
223 | |||
224 | if (file_type(name, NULL, NULL) == OS_TYPE_SYMLINK) { | ||
225 | name = follow_link(name); | ||
226 | if (IS_ERR(name)) { | ||
227 | err = PTR_ERR(name); | ||
228 | goto out; | ||
229 | } | ||
230 | } | ||
231 | |||
232 | err = read_name(ino, name); | ||
233 | kfree(name); | ||
234 | out: | ||
235 | return err; | ||
236 | } | ||
237 | |||
238 | static struct inode *hostfs_iget(struct super_block *sb) | 207 | static struct inode *hostfs_iget(struct super_block *sb) |
239 | { | 208 | { |
240 | struct inode *inode; | 209 | struct inode *inode = new_inode(sb); |
241 | long ret; | ||
242 | |||
243 | inode = new_inode(sb); | ||
244 | if (!inode) | 210 | if (!inode) |
245 | return ERR_PTR(-ENOMEM); | 211 | return ERR_PTR(-ENOMEM); |
246 | ret = hostfs_read_inode(inode); | ||
247 | if (ret < 0) { | ||
248 | iput(inode); | ||
249 | return ERR_PTR(ret); | ||
250 | } | ||
251 | return inode; | 212 | return inode; |
252 | } | 213 | } |
253 | 214 | ||
@@ -979,13 +940,23 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) | |||
979 | 940 | ||
980 | sprintf(host_root_path, "%s/%s", root_ino, req_root); | 941 | sprintf(host_root_path, "%s/%s", root_ino, req_root); |
981 | 942 | ||
982 | root_inode = hostfs_iget(sb); | 943 | root_inode = new_inode(sb); |
983 | if (IS_ERR(root_inode)) { | 944 | if (!root_inode) |
984 | err = PTR_ERR(root_inode); | ||
985 | goto out; | 945 | goto out; |
986 | } | ||
987 | 946 | ||
988 | err = init_inode(root_inode, NULL); | 947 | root_inode->i_op = &hostfs_dir_iops; |
948 | root_inode->i_fop = &hostfs_dir_fops; | ||
949 | |||
950 | if (file_type(host_root_path, NULL, NULL) == OS_TYPE_SYMLINK) { | ||
951 | char *name = follow_link(host_root_path); | ||
952 | if (IS_ERR(name)) | ||
953 | err = PTR_ERR(name); | ||
954 | else | ||
955 | err = read_name(root_inode, name); | ||
956 | kfree(name); | ||
957 | } else { | ||
958 | err = read_name(root_inode, host_root_path); | ||
959 | } | ||
989 | if (err) | 960 | if (err) |
990 | goto out_put; | 961 | goto out_put; |
991 | 962 | ||
@@ -994,14 +965,6 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) | |||
994 | if (sb->s_root == NULL) | 965 | if (sb->s_root == NULL) |
995 | goto out_put; | 966 | goto out_put; |
996 | 967 | ||
997 | err = hostfs_read_inode(root_inode); | ||
998 | if (err) { | ||
999 | /* No iput in this case because the dput does that for us */ | ||
1000 | dput(sb->s_root); | ||
1001 | sb->s_root = NULL; | ||
1002 | goto out; | ||
1003 | } | ||
1004 | |||
1005 | return 0; | 968 | return 0; |
1006 | 969 | ||
1007 | out_put: | 970 | out_put: |