Skip to content

Commit

Permalink
GFS2: gfs2_create_inode(): don't bother with d_splice_alias()
Browse files Browse the repository at this point in the history
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: Al Viro <[email protected]>
Signed-off-by: Steven Whitehouse <[email protected]>
  • Loading branch information
Al Viro authored and swhiteho committed Nov 20, 2014
1 parent 571a4b5 commit 44bb31b
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions fs/gfs2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_sbd *sdp = GFS2_SB(&dip->i_inode);
struct gfs2_glock *io_gl;
struct dentry *d;
int error, free_vfs_inode = 0;
u32 aflags = 0;
unsigned blocks = 1;
Expand Down Expand Up @@ -629,22 +628,13 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
inode = ERR_PTR(-EISDIR);
goto fail_gunlock;
}
d = d_splice_alias(inode, dentry);
error = PTR_ERR(d);
if (IS_ERR(d)) {
inode = ERR_CAST(d);
goto fail_gunlock;
}
d_instantiate(dentry, inode);
error = 0;
if (file) {
if (S_ISREG(inode->i_mode)) {
WARN_ON(d != NULL);
if (S_ISREG(inode->i_mode))
error = finish_open(file, dentry, gfs2_open_common, opened);
} else {
error = finish_no_open(file, d);
}
} else {
dput(d);
else
error = finish_no_open(file, NULL);
}
gfs2_glock_dq_uninit(ghs);
return error;
Expand Down

0 comments on commit 44bb31b

Please sign in to comment.