diff options
author | Al Viro <viro@ZenIV.linux.org.uk> | 2014-11-19 14:35:24 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2014-11-20 05:17:39 -0500 |
commit | 44bb31bac555b0faf2e7068f3a953d5b23883dc9 (patch) | |
tree | 6ee0d8138074d1a363f08365b323c5367af1aae2 /fs/gfs2 | |
parent | 571a4b57975aaaf50479a59882f1d44ae2737084 (diff) |
GFS2: 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: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/inode.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index f41b2fd12416..9e8545bbc55c 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -596,7 +596,6 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, | |||
596 | struct gfs2_inode *dip = GFS2_I(dir), *ip; | 596 | struct gfs2_inode *dip = GFS2_I(dir), *ip; |
597 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); | 597 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); |
598 | struct gfs2_glock *io_gl; | 598 | struct gfs2_glock *io_gl; |
599 | struct dentry *d; | ||
600 | int error, free_vfs_inode = 0; | 599 | int error, free_vfs_inode = 0; |
601 | u32 aflags = 0; | 600 | u32 aflags = 0; |
602 | unsigned blocks = 1; | 601 | unsigned blocks = 1; |
@@ -629,22 +628,13 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, | |||
629 | inode = ERR_PTR(-EISDIR); | 628 | inode = ERR_PTR(-EISDIR); |
630 | goto fail_gunlock; | 629 | goto fail_gunlock; |
631 | } | 630 | } |
632 | d = d_splice_alias(inode, dentry); | 631 | d_instantiate(dentry, inode); |
633 | error = PTR_ERR(d); | ||
634 | if (IS_ERR(d)) { | ||
635 | inode = ERR_CAST(d); | ||
636 | goto fail_gunlock; | ||
637 | } | ||
638 | error = 0; | 632 | error = 0; |
639 | if (file) { | 633 | if (file) { |
640 | if (S_ISREG(inode->i_mode)) { | 634 | if (S_ISREG(inode->i_mode)) |
641 | WARN_ON(d != NULL); | ||
642 | error = finish_open(file, dentry, gfs2_open_common, opened); | 635 | error = finish_open(file, dentry, gfs2_open_common, opened); |
643 | } else { | 636 | else |
644 | error = finish_no_open(file, d); | 637 | error = finish_no_open(file, NULL); |
645 | } | ||
646 | } else { | ||
647 | dput(d); | ||
648 | } | 638 | } |
649 | gfs2_glock_dq_uninit(ghs); | 639 | gfs2_glock_dq_uninit(ghs); |
650 | return error; | 640 | return error; |