提交 f7380af0 编写于 作者: A Al Viro

ceph: don't bother with d_rehash() in splice_dentry()

d_splice_alias() guarantees that it'll be always hashed
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 949a852e
...@@ -975,13 +975,8 @@ static void update_dentry_lease(struct dentry *dentry, ...@@ -975,13 +975,8 @@ static void update_dentry_lease(struct dentry *dentry,
/* /*
* splice a dentry to an inode. * splice a dentry to an inode.
* caller must hold directory i_mutex for this to be safe. * caller must hold directory i_mutex for this to be safe.
*
* we will only rehash the resulting dentry if @prehash is
* true; @prehash will be set to false (for the benefit of
* the caller) if we fail.
*/ */
static struct dentry *splice_dentry(struct dentry *dn, struct inode *in, static struct dentry *splice_dentry(struct dentry *dn, struct inode *in)
bool *prehash)
{ {
struct dentry *realdn; struct dentry *realdn;
...@@ -994,8 +989,6 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in, ...@@ -994,8 +989,6 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in,
if (IS_ERR(realdn)) { if (IS_ERR(realdn)) {
pr_err("splice_dentry error %ld %p inode %p ino %llx.%llx\n", pr_err("splice_dentry error %ld %p inode %p ino %llx.%llx\n",
PTR_ERR(realdn), dn, in, ceph_vinop(in)); PTR_ERR(realdn), dn, in, ceph_vinop(in));
if (prehash)
*prehash = false; /* don't rehash on error */
dn = realdn; /* note realdn contains the error */ dn = realdn; /* note realdn contains the error */
goto out; goto out;
} else if (realdn) { } else if (realdn) {
...@@ -1011,8 +1004,6 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in, ...@@ -1011,8 +1004,6 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in,
dout("dn %p attached to %p ino %llx.%llx\n", dout("dn %p attached to %p ino %llx.%llx\n",
dn, d_inode(dn), ceph_vinop(d_inode(dn))); dn, d_inode(dn), ceph_vinop(d_inode(dn)));
} }
if ((!prehash || *prehash) && d_unhashed(dn))
d_rehash(dn);
out: out:
return dn; return dn;
} }
...@@ -1260,7 +1251,7 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, ...@@ -1260,7 +1251,7 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req,
if (d_really_is_negative(dn)) { if (d_really_is_negative(dn)) {
ceph_dir_clear_ordered(dir); ceph_dir_clear_ordered(dir);
ihold(in); ihold(in);
dn = splice_dentry(dn, in, &have_lease); dn = splice_dentry(dn, in);
if (IS_ERR(dn)) { if (IS_ERR(dn)) {
err = PTR_ERR(dn); err = PTR_ERR(dn);
goto done; goto done;
...@@ -1290,7 +1281,7 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, ...@@ -1290,7 +1281,7 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req,
dout(" linking snapped dir %p to dn %p\n", in, dn); dout(" linking snapped dir %p to dn %p\n", in, dn);
ceph_dir_clear_ordered(dir); ceph_dir_clear_ordered(dir);
ihold(in); ihold(in);
dn = splice_dentry(dn, in, NULL); dn = splice_dentry(dn, in);
if (IS_ERR(dn)) { if (IS_ERR(dn)) {
err = PTR_ERR(dn); err = PTR_ERR(dn);
goto done; goto done;
...@@ -1501,7 +1492,7 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req, ...@@ -1501,7 +1492,7 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req,
} }
if (d_really_is_negative(dn)) { if (d_really_is_negative(dn)) {
struct dentry *realdn = splice_dentry(dn, in, NULL); struct dentry *realdn = splice_dentry(dn, in);
if (IS_ERR(realdn)) { if (IS_ERR(realdn)) {
err = PTR_ERR(realdn); err = PTR_ERR(realdn);
d_drop(dn); d_drop(dn);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册