Skip to content

Commit 44c53ac

Browse files
committed
fs/9p: convert mkdir to use get_new_inode
mkdir had different code paths for inode creation, cache used the get_new_inode_from_fid helper, but non-cached used v9fs_get_inode. Collapsed into a single implementation across both as there should be no difference. Signed-off-by: Eric Van Hensbergen <[email protected]>
1 parent fe1371d commit 44c53ac

File tree

1 file changed

+10
-25
lines changed

1 file changed

+10
-25
lines changed

fs/9p/vfs_inode_dotl.c

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -402,32 +402,17 @@ static int v9fs_vfs_mkdir_dotl(struct mnt_idmap *idmap,
402402
}
403403

404404
/* instantiate inode and assign the unopened fid to the dentry */
405-
if (v9ses->cache & (CACHE_META|CACHE_LOOSE)) {
406-
inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
407-
if (IS_ERR(inode)) {
408-
err = PTR_ERR(inode);
409-
p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n",
410-
err);
411-
goto error;
412-
}
413-
v9fs_fid_add(dentry, &fid);
414-
v9fs_set_create_acl(inode, fid, dacl, pacl);
415-
d_instantiate(dentry, inode);
416-
err = 0;
417-
} else {
418-
/*
419-
* Not in cached mode. No need to populate
420-
* inode with stat. We need to get an inode
421-
* so that we can set the acl with dentry
422-
*/
423-
inode = v9fs_get_inode(dir->i_sb, mode, 0);
424-
if (IS_ERR(inode)) {
425-
err = PTR_ERR(inode);
426-
goto error;
427-
}
428-
v9fs_set_create_acl(inode, fid, dacl, pacl);
429-
d_instantiate(dentry, inode);
405+
inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
406+
if (IS_ERR(inode)) {
407+
err = PTR_ERR(inode);
408+
p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n",
409+
err);
410+
goto error;
430411
}
412+
v9fs_fid_add(dentry, &fid);
413+
v9fs_set_create_acl(inode, fid, dacl, pacl);
414+
d_instantiate(dentry, inode);
415+
err = 0;
431416
inc_nlink(dir);
432417
v9fs_invalidate_inode_attr(dir);
433418
error:

0 commit comments

Comments
 (0)