Skip to contentSkip to conversation

libceph: move prepare_write_banner()

PATCH In review Alex Elder 2 participants 2 messages Feb 29, 2012 – Mar 2, 2012 Ceph common code (libceph)

lore
Share & tools
lore

Alex Elder

author
#0 lore raw

PATCH 1/1 libceph: move prepare_write_banner()

One of the arguments to prepare_write_connect() indicates whether it is being called immediately after a call to prepare_write_banner(). Move the prepare_write_banner() call inside prepare_write_connect(), and reinterpret (and rename) the "after_banner" argument so it indicates that prepare_write_connect() should *make* the call rather than should know it has already been made.

This was split out from the next patch to highlight this change in logic.

---
 net/ceph/messenger.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
net/ceph/messenger.c +4 -3
index c410c55..2404a5a 100644
@@ -672,7 +672,7 @@ static void prepare_write_banner(struct ceph_messenger *msgr,
 
 static int prepare_write_connect(struct ceph_messenger *msgr,
 				 struct ceph_connection *con,
-				 int after_banner)
+				 int include_banner)
 {
 	unsigned global_seq = get_global_seq(con->msgr, 0);
 	int proto;
@@ -701,7 +701,9 @@ static int prepare_write_connect(struct ceph_messenger *msgr,
 	con->out_connect.protocol_version = cpu_to_le32(proto);
 	con->out_connect.flags = 0;
 
-	if (!after_banner) {
+	if (include_banner)
+		prepare_write_banner(msgr, con);
+	else {
 		con->out_kvec_left = 0;
 		con->out_kvec_bytes = 0;
 	}
@@ -1842,7 +1844,6 @@ more:
 
 	/* open the socket first? */
 	if (con->sock == NULL) {
-		prepare_write_banner(msgr, con);
 		prepare_write_connect(msgr, con, 1);
 		prepare_read_banner(con);
 		set_bit(CONNECTING, &con->state);
Signature · 1 line
1.7.5.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 58 lines · Alex Elder

One of the arguments to prepare_write_connect() indicates whether it is being called immediately after a call to prepare_write_banner(). Move the prepare_write_banner() call inside prepare_write_connect(), and reinterpret (and rename) the "after_banner" argument so it indicates that prepare_write_connect() should *make* the call rather than should know it has already been made.

This was split out from the next patch to highlight this change in logic.

---
 net/ceph/messenger.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
net/ceph/messenger.c +1 -1
index c410c55..2404a5a 100644
@@ -672,7 +672,7 @@ static void prepare_write_banner(struct ceph_messenger
 *msgr,
 
 static int prepare_write_connect(struct ceph_messenger *msgr,
 				 struct ceph_connection *con,
-				 int after_banner)
+				 int include_banner)
 {
 	unsigned global_seq = get_global_seq(con->msgr, 0);
net/ceph/messenger.c +3 -1
 	int proto;
@@ -701,7 +701,9 @@ static int prepare_write_connect(struct ceph_messenger
 *msgr,
 	con->out_connect.protocol_version = cpu_to_le32(proto);
 	con->out_connect.flags = 0;
 
-	if (!after_banner) {
+	if (include_banner)
+		prepare_write_banner(msgr, con);
+	else {
 		con->out_kvec_left = 0;
 		con->out_kvec_bytes = 0;
net/ceph/messenger.c +0 -1
 	}
@@ -1842,7 +1844,6 @@ more:
 
 	/* open the socket first? */
 	if (con->sock == NULL) {
-		prepare_write_banner(msgr, con);
 		prepare_write_connect(msgr, con, 1);
 		prepare_read_banner(con);
 		set_bit(CONNECTING, &con->state);
Signature · 6 lines
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html