[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    ceph: kill ceph_get_dentry_parent_inode()
From:       "Linux Kernel Mailing List" <linux-kernel () vger ! kernel ! org>
Date:       2016-03-26 23:04:44
Message-ID: 20160326230445.031A8660FBB () gitolite ! kernel ! org
[Download RAW message or body]

Web:        https://git.kernel.org/torvalds/c/641235d8f823574961d225bdbfaef299842aa38c
Commit:     641235d8f823574961d225bdbfaef299842aa38c
Parent:     315f24088048a51eed341c53be66ea477a3c7d16
Refname:    refs/heads/master
Author:     Yan, Zheng <zyan@redhat.com>
AuthorDate: Wed Mar 16 16:40:23 2016 +0800
Committer:  Ilya Dryomov <idryomov@gmail.com>
CommitDate: Fri Mar 25 18:51:55 2016 +0100

    ceph: kill ceph_get_dentry_parent_inode()
    
    use vfs helper dget_parent() instead
    
    Signed-off-by: Yan, Zheng <zyan@redhat.com>
---
 fs/ceph/dir.c   | 24 +++++-------------------
 fs/ceph/super.h |  1 -
 2 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index b9f50a3..c37820b 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -68,23 +68,6 @@ out_unlock:
 	return 0;
 }
 
-struct inode *ceph_get_dentry_parent_inode(struct dentry *dentry)
-{
-	struct inode *inode = NULL;
-
-	if (!dentry)
-		return NULL;
-
-	spin_lock(&dentry->d_lock);
-	if (!IS_ROOT(dentry)) {
-		inode = d_inode(dentry->d_parent);
-		ihold(inode);
-	}
-	spin_unlock(&dentry->d_lock);
-	return inode;
-}
-
-
 /*
  * for readdir, we encode the directory frag and offset within that
  * frag into f_pos.
@@ -1100,6 +1083,7 @@ static int dir_lease_is_valid(struct inode *dir, struct dentry *dentry)
 static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
 {
 	int valid = 0;
+	struct dentry *parent;
 	struct inode *dir;
 
 	if (flags & LOOKUP_RCU)
@@ -1108,7 +1092,8 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
 	dout("d_revalidate %p '%pd' inode %p offset %lld\n", dentry,
 	     dentry, d_inode(dentry), ceph_dentry(dentry)->offset);
 
-	dir = ceph_get_dentry_parent_inode(dentry);
+	parent = dget_parent(dentry);
+	dir = d_inode(parent);
 
 	/* always trust cached snapped dentries, snapdir dentry */
 	if (ceph_snap(dir) != CEPH_NOSNAP) {
@@ -1132,7 +1117,8 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
 	} else {
 		ceph_dir_clear_complete(dir);
 	}
-	iput(dir);
+
+	dput(parent);
 	return valid;
 }
 
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index 2d48138..e705c4d 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -957,7 +957,6 @@ extern void ceph_dentry_lru_touch(struct dentry *dn);
 extern void ceph_dentry_lru_del(struct dentry *dn);
 extern void ceph_invalidate_dentry_lease(struct dentry *dentry);
 extern unsigned ceph_dentry_hash(struct inode *dir, struct dentry *dn);
-extern struct inode *ceph_get_dentry_parent_inode(struct dentry *dentry);
 extern void ceph_readdir_cache_release(struct ceph_readdir_cache_control *ctl);
 
 /*
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic