diff mbox

[2/7] messenger: add some clarifying comments

Message ID 1430154795-17123-3-git-send-email-elder@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Elder April 27, 2015, 5:13 p.m. UTC
In con_sock_closed() we test *and* clear the socket closed connection
flag.  It's not immediately obvious why the flag needs to be cleared.
Add a comment so that's a little clearer.

Similarly, we only want to do backoff processing once each time the
backoff flag is set.  Add a comment about that as well.

Signed-off-by: Alex Elder <elder@linaro.org>
---
 net/ceph/messenger.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox

Patch

diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 9dfdb20..37b0fa7 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -2733,6 +2733,10 @@  static void cancel_con(struct ceph_connection *con)
 
 static bool con_sock_closed(struct ceph_connection *con)
 {
+	/*
+	 * We want to handle the event of the socket being
+	 * closed once, so clear the flag in case it is set.
+	 */
 	if (!con_flag_test_and_clear(con, CON_FLAG_SOCK_CLOSED))
 		return false;
 
@@ -2764,6 +2768,11 @@  static bool con_backoff(struct ceph_connection *con)
 {
 	int ret;
 
+	/*
+	 * See if we need to back off.  We only want to do this
+	 * processing once each time the flag is set, so clear the
+	 * flag after it's tested.
+	 */
 	if (!con_flag_test_and_clear(con, CON_FLAG_BACKOFF))
 		return false;