Commit 81295ce6 authored by Al Viro's avatar Al Viro

gfs2_create_inode(): don't bother with d_splice_alias()

dentry is always hashed and negative, inode - non-error, non-NULL and
non-directory.  In such conditions d_splice_alias() is equivalent to
"d_instantiate(dentry, inode) and return NULL", which simplifies the
downstream code and is consistent with the "have to create a new object"
case.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 986cdb86
...@@ -596,7 +596,6 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, ...@@ -596,7 +596,6 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
struct gfs2_inode *dip = GFS2_I(dir), *ip; struct gfs2_inode *dip = GFS2_I(dir), *ip;
struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
struct gfs2_glock *io_gl; struct gfs2_glock *io_gl;
struct dentry *d;
int error, free_vfs_inode = 0; int error, free_vfs_inode = 0;
u32 aflags = 0; u32 aflags = 0;
unsigned blocks = 1; unsigned blocks = 1;
...@@ -629,22 +628,13 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, ...@@ -629,22 +628,13 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
inode = ERR_PTR(-EISDIR); inode = ERR_PTR(-EISDIR);
goto fail_gunlock; goto fail_gunlock;
} }
d = d_splice_alias(inode, dentry); d_instantiate(dentry, inode);
error = PTR_ERR(d);
if (IS_ERR(d)) {
inode = ERR_CAST(d);
goto fail_gunlock;
}
error = 0; error = 0;
if (file) { if (file) {
if (S_ISREG(inode->i_mode)) { if (S_ISREG(inode->i_mode))
WARN_ON(d != NULL);
error = finish_open(file, dentry, gfs2_open_common, opened); error = finish_open(file, dentry, gfs2_open_common, opened);
} else { else
error = finish_no_open(file, d); error = finish_no_open(file, NULL);
}
} else {
dput(d);
} }
gfs2_glock_dq_uninit(ghs); gfs2_glock_dq_uninit(ghs);
return error; return error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment