From: Al Viro <viro@ZenIV.linux.org.uk>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 2/3] gfs2_create_inode(): don't bother with d_splice_alias()
Date: Wed, 19 Nov 2014 19:35:24 +0000 [thread overview]
Message-ID: <20141119193524.GA7996@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20141119193404.GY7996@ZenIV.linux.org.uk>
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>
---
fs/gfs2/inode.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 310e248..ce0cf9a 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,
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;
@@ -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;
--
1.7.10.4
next prev parent reply other threads:[~2014-11-19 19:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-19 19:34 [Cluster-devel] [gfs2 patches in vfs.git] Al Viro
2014-11-19 19:34 ` [Cluster-devel] [PATCH 1/3] gfs2: bugger off early if O_CREAT open finds a directory Al Viro
2014-11-19 20:33 ` Bob Peterson
2014-11-19 20:42 ` Al Viro
2014-11-19 20:46 ` Bob Peterson
2014-11-19 19:35 ` Al Viro [this message]
2014-11-19 19:35 ` [Cluster-devel] [PATCH 3/3] gfs2_atomic_open(): simplify the use of finish_no_open() Al Viro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141119193524.GA7996@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.