diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-03-06 20:42:16 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-03-14 00:15:51 -0400 |
commit | f7380af04bac0ecee88c10dba037749b14d26e7d (patch) | |
tree | f15842957eeb5980d43a611e155a5eb63d7ceaf5 | |
parent | 949a852e46dda07caaa0ff02e181f55d24e3ebf8 (diff) |
ceph: don't bother with d_rehash() in splice_dentry()
d_splice_alias() guarantees that it'll be always hashed
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/ceph/inode.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index fb4ba2e4e2a5..05dd66fe23a2 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -975,13 +975,8 @@ out_unlock: | |||
975 | /* | 975 | /* |
976 | * splice a dentry to an inode. | 976 | * splice a dentry to an inode. |
977 | * caller must hold directory i_mutex for this to be safe. | 977 | * caller must hold directory i_mutex for this to be safe. |
978 | * | ||
979 | * we will only rehash the resulting dentry if @prehash is | ||
980 | * true; @prehash will be set to false (for the benefit of | ||
981 | * the caller) if we fail. | ||
982 | */ | 978 | */ |
983 | static struct dentry *splice_dentry(struct dentry *dn, struct inode *in, | 979 | static struct dentry *splice_dentry(struct dentry *dn, struct inode *in) |
984 | bool *prehash) | ||
985 | { | 980 | { |
986 | struct dentry *realdn; | 981 | struct dentry *realdn; |
987 | 982 | ||
@@ -994,8 +989,6 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in, | |||
994 | if (IS_ERR(realdn)) { | 989 | if (IS_ERR(realdn)) { |
995 | pr_err("splice_dentry error %ld %p inode %p ino %llx.%llx\n", | 990 | pr_err("splice_dentry error %ld %p inode %p ino %llx.%llx\n", |
996 | PTR_ERR(realdn), dn, in, ceph_vinop(in)); | 991 | PTR_ERR(realdn), dn, in, ceph_vinop(in)); |
997 | if (prehash) | ||
998 | *prehash = false; /* don't rehash on error */ | ||
999 | dn = realdn; /* note realdn contains the error */ | 992 | dn = realdn; /* note realdn contains the error */ |
1000 | goto out; | 993 | goto out; |
1001 | } else if (realdn) { | 994 | } else if (realdn) { |
@@ -1011,8 +1004,6 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in, | |||
1011 | dout("dn %p attached to %p ino %llx.%llx\n", | 1004 | dout("dn %p attached to %p ino %llx.%llx\n", |
1012 | dn, d_inode(dn), ceph_vinop(d_inode(dn))); | 1005 | dn, d_inode(dn), ceph_vinop(d_inode(dn))); |
1013 | } | 1006 | } |
1014 | if ((!prehash || *prehash) && d_unhashed(dn)) | ||
1015 | d_rehash(dn); | ||
1016 | out: | 1007 | out: |
1017 | return dn; | 1008 | return dn; |
1018 | } | 1009 | } |
@@ -1260,7 +1251,7 @@ retry_lookup: | |||
1260 | if (d_really_is_negative(dn)) { | 1251 | if (d_really_is_negative(dn)) { |
1261 | ceph_dir_clear_ordered(dir); | 1252 | ceph_dir_clear_ordered(dir); |
1262 | ihold(in); | 1253 | ihold(in); |
1263 | dn = splice_dentry(dn, in, &have_lease); | 1254 | dn = splice_dentry(dn, in); |
1264 | if (IS_ERR(dn)) { | 1255 | if (IS_ERR(dn)) { |
1265 | err = PTR_ERR(dn); | 1256 | err = PTR_ERR(dn); |
1266 | goto done; | 1257 | goto done; |
@@ -1290,7 +1281,7 @@ retry_lookup: | |||
1290 | dout(" linking snapped dir %p to dn %p\n", in, dn); | 1281 | dout(" linking snapped dir %p to dn %p\n", in, dn); |
1291 | ceph_dir_clear_ordered(dir); | 1282 | ceph_dir_clear_ordered(dir); |
1292 | ihold(in); | 1283 | ihold(in); |
1293 | dn = splice_dentry(dn, in, NULL); | 1284 | dn = splice_dentry(dn, in); |
1294 | if (IS_ERR(dn)) { | 1285 | if (IS_ERR(dn)) { |
1295 | err = PTR_ERR(dn); | 1286 | err = PTR_ERR(dn); |
1296 | goto done; | 1287 | goto done; |
@@ -1501,7 +1492,7 @@ retry_lookup: | |||
1501 | } | 1492 | } |
1502 | 1493 | ||
1503 | if (d_really_is_negative(dn)) { | 1494 | if (d_really_is_negative(dn)) { |
1504 | struct dentry *realdn = splice_dentry(dn, in, NULL); | 1495 | struct dentry *realdn = splice_dentry(dn, in); |
1505 | if (IS_ERR(realdn)) { | 1496 | if (IS_ERR(realdn)) { |
1506 | err = PTR_ERR(realdn); | 1497 | err = PTR_ERR(realdn); |
1507 | d_drop(dn); | 1498 | d_drop(dn); |