aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/dir.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-10-28 22:05:13 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2016-10-28 22:05:13 -0400
commitad5cb123fd0e4d929b36f0f9bbdec14cb6229ad7 (patch)
tree4c4e25e960aa1ce5bc6e9b667db9d25e88007ded /fs/ceph/dir.c
parentceph: unify dentry_operations instances (diff)
downloadlinux-dev-ad5cb123fd0e4d929b36f0f9bbdec14cb6229ad7.tar.xz
linux-dev-ad5cb123fd0e4d929b36f0f9bbdec14cb6229ad7.zip
ceph: switch to use of ->d_init()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ceph/dir.c')
-rw-r--r--fs/ceph/dir.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 80f5339d097b..c23eb0e9348c 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -32,33 +32,19 @@ const struct dentry_operations ceph_dentry_ops;
/*
* Initialize ceph dentry state.
*/
-int ceph_init_dentry(struct dentry *dentry)
+static int ceph_d_init(struct dentry *dentry)
{
struct ceph_dentry_info *di;
- if (dentry->d_fsdata)
- return 0;
-
di = kmem_cache_zalloc(ceph_dentry_cachep, GFP_KERNEL);
if (!di)
return -ENOMEM; /* oh well */
- spin_lock(&dentry->d_lock);
- if (dentry->d_fsdata) {
- /* lost a race */
- kmem_cache_free(ceph_dentry_cachep, di);
- goto out_unlock;
- }
-
di->dentry = dentry;
di->lease_session = NULL;
di->time = jiffies;
- /* avoid reordering d_fsdata setup so that the check above is safe */
- smp_mb();
dentry->d_fsdata = di;
ceph_dentry_lru_add(dentry);
-out_unlock:
- spin_unlock(&dentry->d_lock);
return 0;
}
@@ -730,10 +716,6 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry,
if (dentry->d_name.len > NAME_MAX)
return ERR_PTR(-ENAMETOOLONG);
- err = ceph_init_dentry(dentry);
- if (err < 0)
- return ERR_PTR(err);
-
/* can we conclude ENOENT locally? */
if (d_really_is_negative(dentry)) {
struct ceph_inode_info *ci = ceph_inode(dir);
@@ -1503,4 +1485,5 @@ const struct dentry_operations ceph_dentry_ops = {
.d_revalidate = ceph_d_revalidate,
.d_release = ceph_d_release,
.d_prune = ceph_d_prune,
+ .d_init = ceph_d_init,
};