Skip to contentSkip to conversation

auto-fs: Change how dentry's d_lock and d_count fields are accessed

PATCH Superseded Waiman Long 1 participant 1 message Jul 3, 2013

Subsystems (2)

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 8/25 auto-fs: Change how dentry's d_lock and d_count fields are accessed

Because of the changes made in dcache.h header file, files that use the d_lock and d_count fields of the dentry structure need to be changed accordingly. All the d_lock's spin_lock() and spin_unlock() calls are replaced by the corresponding d_lock() and d_unlock() calls. References to d_count are replaced by the d_ret_count() calls. There is no change in logic and everything should just work.

---
 fs/autofs4/autofs_i.h |   24 ++++++++++++------------
 fs/autofs4/expire.c   |   48 ++++++++++++++++++++++++------------------------
 fs/autofs4/root.c     |   14 +++++++-------
 3 files changed, 43 insertions(+), 43 deletions(-)
fs/autofs4/autofs_i.h +12 -12
index 3f1128b..dc7df32 100644
@@ -198,9 +198,9 @@ static inline void __managed_dentry_set_automount(struct dentry *dentry)
 
 static inline void managed_dentry_set_automount(struct dentry *dentry)
 {
-	spin_lock(&dentry->d_lock);
+	d_lock(dentry);
 	__managed_dentry_set_automount(dentry);
-	spin_unlock(&dentry->d_lock);
+	d_unlock(dentry);
 }
 
 static inline void __managed_dentry_clear_automount(struct dentry *dentry)
@@ -210,9 +210,9 @@ static inline void __managed_dentry_clear_automount(struct dentry *dentry)
 
 static inline void managed_dentry_clear_automount(struct dentry *dentry)
 {
-	spin_lock(&dentry->d_lock);
+	d_lock(dentry);
 	__managed_dentry_clear_automount(dentry);
-	spin_unlock(&dentry->d_lock);
+	d_unlock(dentry);
 }
 
 static inline void __managed_dentry_set_transit(struct dentry *dentry)
@@ -222,9 +222,9 @@ static inline void __managed_dentry_set_transit(struct dentry *dentry)
 
 static inline void managed_dentry_set_transit(struct dentry *dentry)
 {
-	spin_lock(&dentry->d_lock);
+	d_lock(dentry);
 	__managed_dentry_set_transit(dentry);
-	spin_unlock(&dentry->d_lock);
+	d_unlock(dentry);
 }
 
 static inline void __managed_dentry_clear_transit(struct dentry *dentry)
@@ -234,9 +234,9 @@ static inline void __managed_dentry_clear_transit(struct dentry *dentry)
 
 static inline void managed_dentry_clear_transit(struct dentry *dentry)
 {
-	spin_lock(&dentry->d_lock);
+	d_lock(dentry);
 	__managed_dentry_clear_transit(dentry);
-	spin_unlock(&dentry->d_lock);
+	d_unlock(dentry);
 }
 
 static inline void __managed_dentry_set_managed(struct dentry *dentry)
@@ -246,9 +246,9 @@ static inline void __managed_dentry_set_managed(struct dentry *dentry)
 
 static inline void managed_dentry_set_managed(struct dentry *dentry)
 {
-	spin_lock(&dentry->d_lock);
+	d_lock(dentry);
 	__managed_dentry_set_managed(dentry);
-	spin_unlock(&dentry->d_lock);
+	d_unlock(dentry);
 }
 
 static inline void __managed_dentry_clear_managed(struct dentry *dentry)
@@ -258,9 +258,9 @@ static inline void __managed_dentry_clear_managed(struct dentry *dentry)
 
 static inline void managed_dentry_clear_managed(struct dentry *dentry)
 {
-	spin_lock(&dentry->d_lock);
+	d_lock(dentry);
 	__managed_dentry_clear_managed(dentry);
-	spin_unlock(&dentry->d_lock);
+	d_unlock(dentry);
 }
 
 /* Initializing function */
fs/autofs4/expire.c +24 -24

129 lines not on this page · raw message

fs/autofs4/root.c +7 -7
index 085da86..e33a0f6 100644
@@ -176,10 +176,10 @@ static struct dentry *autofs4_lookup_active(struct dentry *dentry)
 		ino = list_entry(p, struct autofs_info, active);
 		active = ino->dentry;
 
-		spin_lock(&active->d_lock);
+		d_lock(active);
 
 		/* Already gone? */
-		if (active->d_count == 0)
+		if (d_ret_count(active) == 0)
 			goto next;
 
 		qstr = &active->d_name;
@@ -196,12 +196,12 @@ static struct dentry *autofs4_lookup_active(struct dentry *dentry)
 
 		if (d_unhashed(active)) {
 			dget_dlock(active);
-			spin_unlock(&active->d_lock);
+			d_unlock(active);
 			spin_unlock(&sbi->lookup_lock);
 			return active;
 		}
 next:
-		spin_unlock(&active->d_lock);
+		d_unlock(active);
 	}
 	spin_unlock(&sbi->lookup_lock);
 
@@ -228,7 +228,7 @@ static struct dentry *autofs4_lookup_expiring(struct dentry *dentry)
 		ino = list_entry(p, struct autofs_info, expiring);
 		expiring = ino->dentry;
 
-		spin_lock(&expiring->d_lock);
+		d_lock(expiring);
 
 		/* Bad luck, we've already been dentry_iput */
 		if (!expiring->d_inode)
@@ -248,12 +248,12 @@ static struct dentry *autofs4_lookup_expiring(struct dentry *dentry)
 
 		if (d_unhashed(expiring)) {
 			dget_dlock(expiring);
-			spin_unlock(&expiring->d_lock);
+			d_unlock(expiring);
 			spin_unlock(&sbi->lookup_lock);
 			return expiring;
 		}
 next:
-		spin_unlock(&expiring->d_lock);
+		d_unlock(expiring);
 	}
 	spin_unlock(&sbi->lookup_lock);
 
Signature · 1 line
1.7.1