diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2011-01-10 15:22:21 -0500 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2011-01-11 10:58:07 -0500 |
commit | af7542fc8ac678ce69dbd5c9643c52897b47c66f (patch) | |
tree | 247edbefbae61ea7fcb6d396856149fd1d4b4c1c /fs/9p | |
parent | 53c06f4e0a4621bb40c8be6ff701e07f6226143d (diff) |
fs/9p: Simplify the .L create operation
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p')
-rw-r--r-- | fs/9p/vfs_inode_dotl.c | 75 |
1 files changed, 28 insertions, 47 deletions
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index daf2f0665a6f..b6f3977545f7 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c | |||
@@ -196,60 +196,41 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode, | |||
196 | err); | 196 | err); |
197 | goto error; | 197 | goto error; |
198 | } | 198 | } |
199 | /* instantiate inode and assign the unopened fid to the dentry */ | ||
200 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE || | ||
201 | (nd && nd->flags & LOOKUP_OPEN)) { | ||
202 | fid = p9_client_walk(dfid, 1, &name, 1); | ||
203 | if (IS_ERR(fid)) { | ||
204 | err = PTR_ERR(fid); | ||
205 | P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", | ||
206 | err); | ||
207 | fid = NULL; | ||
208 | goto error; | ||
209 | } | ||
210 | 199 | ||
211 | inode = v9fs_inode_from_fid(v9ses, fid, dir->i_sb); | 200 | /* instantiate inode and assign the unopened fid to the dentry */ |
212 | if (IS_ERR(inode)) { | 201 | fid = p9_client_walk(dfid, 1, &name, 1); |
213 | err = PTR_ERR(inode); | 202 | if (IS_ERR(fid)) { |
214 | P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", | 203 | err = PTR_ERR(fid); |
215 | err); | 204 | P9_DPRINTK(P9_DEBUG_VFS, "p9_clinet_walk failed %d\n", err); |
216 | goto error; | ||
217 | } | ||
218 | d_set_d_op(dentry, &v9fs_cached_dentry_operations); | ||
219 | d_instantiate(dentry, inode); | ||
220 | err = v9fs_fid_add(dentry, fid); | ||
221 | if (err < 0) | ||
222 | goto error; | ||
223 | /* The fid would get clunked via a dput */ | ||
224 | fid = NULL; | 205 | fid = NULL; |
225 | } else { | 206 | goto error; |
226 | /* | 207 | } |
227 | * Not in cached mode. No need to populate | 208 | inode = v9fs_inode_from_fid(v9ses, fid, dir->i_sb); |
228 | * inode with stat. We need to get an inode | 209 | if (IS_ERR(inode)) { |
229 | * so that we can set the acl with dentry | 210 | err = PTR_ERR(inode); |
230 | */ | 211 | P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err); |
231 | inode = v9fs_get_inode(dir->i_sb, mode); | 212 | goto error; |
232 | if (IS_ERR(inode)) { | ||
233 | err = PTR_ERR(inode); | ||
234 | goto error; | ||
235 | } | ||
236 | d_set_d_op(dentry, &v9fs_dentry_operations); | ||
237 | d_instantiate(dentry, inode); | ||
238 | } | 213 | } |
214 | if (v9ses->cache) | ||
215 | dentry->d_op = &v9fs_cached_dentry_operations; | ||
216 | else | ||
217 | dentry->d_op = &v9fs_dentry_operations; | ||
218 | |||
219 | d_instantiate(dentry, inode); | ||
220 | err = v9fs_fid_add(dentry, fid); | ||
221 | if (err < 0) | ||
222 | goto error; | ||
223 | |||
239 | /* Now set the ACL based on the default value */ | 224 | /* Now set the ACL based on the default value */ |
240 | v9fs_set_create_acl(dentry, dacl, pacl); | 225 | v9fs_set_create_acl(dentry, dacl, pacl); |
241 | 226 | ||
242 | /* if we are opening a file, assign the open fid to the file */ | 227 | /* Since we are opening a file, assign the open fid to the file */ |
243 | if (nd && nd->flags & LOOKUP_OPEN) { | 228 | filp = lookup_instantiate_filp(nd, dentry, generic_file_open); |
244 | filp = lookup_instantiate_filp(nd, dentry, generic_file_open); | 229 | if (IS_ERR(filp)) { |
245 | if (IS_ERR(filp)) { | ||
246 | p9_client_clunk(ofid); | ||
247 | return PTR_ERR(filp); | ||
248 | } | ||
249 | filp->private_data = ofid; | ||
250 | } else | ||
251 | p9_client_clunk(ofid); | 230 | p9_client_clunk(ofid); |
252 | 231 | return PTR_ERR(filp); | |
232 | } | ||
233 | filp->private_data = ofid; | ||
253 | return 0; | 234 | return 0; |
254 | 235 | ||
255 | error: | 236 | error: |