[PATCH 2/2] cleanup of d_unhashed usage.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 fs/dcache.c |   12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

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) {

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



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux