diff mbox

[2/2] cleanup of d_unhashed usage.

Message ID 148056591362.28852.5752789726339637370.stgit@alexeys-macbook-pro.local (mailing list archive)
State New, archived
Headers show

Commit Message

Alexey Lyashkov Dec. 1, 2016, 4:18 a.m. UTC
Once a d_unhashed vs d_move race resolved, we don’t need to hold a d_lock while
simple check. Let’s do d_lock less hot.

Signed-off-by: Alexey Lyashkov <alexey.lyashkov@gmail.com>
---
 fs/dcache.c |   12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/dcache.c b/fs/dcache.c
index 0863841..c23effb 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1327,12 +1327,8 @@  int d_set_mounted(struct dentry *dentry)
 	write_seqlock(&rename_lock);
 	for (p = dentry->d_parent; !IS_ROOT(p); p = p->d_parent) {
 		/* Need exclusion wrt. d_invalidate() */
-		spin_lock(&p->d_lock);
-		if (unlikely(d_unhashed(p))) {
-			spin_unlock(&p->d_lock);
+		if (unlikely(d_unhashed(p)))
 			goto out;
-		}
-		spin_unlock(&p->d_lock);
 	}
 	spin_lock(&dentry->d_lock);
 	if (!d_unlinked(dentry)) {
@@ -1510,12 +1506,8 @@  void d_invalidate(struct dentry *dentry)
 	/*
 	 * If it's already been dropped, return OK.
 	 */
-	spin_lock(&dentry->d_lock);
-	if (d_unhashed(dentry)) {
-		spin_unlock(&dentry->d_lock);
+	if (d_unhashed(dentry))
 		return;
-	}
-	spin_unlock(&dentry->d_lock);
 
 	/* Negative dentries can be dropped without further checks */
 	if (!dentry->d_inode) {