From: David Sterba <dsterba@suse.cz>
Date: Mon, 2 May 2011 13:29:25 +0000 (+0200)
Subject: btrfs: Document a mutex lock/unlock sequence
X-Git-Tag: firefly_0821_release~7613^2~914^2~38^2~5
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8cc33e5c19bf01c7617608669be8c1b4f663eb2f;p=firefly-linux-kernel-4.4.55.git

btrfs: Document a mutex lock/unlock sequence
---

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index a160f11465f8..fba1348cb2a0 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -756,6 +756,10 @@ again:
 
 			btrfs_release_path(path);
 
+			/*
+			 * Mutex was contended, block until it's released and try
+			 * again
+			 */
 			mutex_lock(&head->mutex);
 			mutex_unlock(&head->mutex);
 			btrfs_put_delayed_ref(&head->node);
@@ -2297,6 +2301,10 @@ again:
 				atomic_inc(&ref->refs);
 
 				spin_unlock(&delayed_refs->lock);
+				/*
+				 * Mutex was contended, block until it's
+				 * released and try again
+				 */
 				mutex_lock(&head->mutex);
 				mutex_unlock(&head->mutex);
 
@@ -2363,6 +2371,10 @@ static noinline int check_delayed_ref(struct btrfs_trans_handle *trans,
 
 		btrfs_release_path(path);
 
+		/*
+		 * Mutex was contended, block until it's released and let
+		 * caller try again
+		 */
 		mutex_lock(&head->mutex);
 		mutex_unlock(&head->mutex);
 		btrfs_put_delayed_ref(&head->node);