History

libceph: start separating connection flags from state

A ceph_connection holds a mixture of connection state (as in "state machine" state) and connection flags in a single "state" field. To make the distinction more clear, define a new "flags" field and use it rather than the "state" field to hold Boolean flag values.

Alex Elder committed 14 years ago

Commit 928443c1 parent 15d98822 files · +37 −31Browse files

Showing the changes to include/linux/ceph (1 of 2 files). Show all

Unified · Split

include/linux/ceph/messenger.h+12−6
@@ -103,20 +103,25 @@ struct ceph_msg_pos { · 102 unmodified lines
103103 #define MAX_DELAY_INTERVAL (5 * 60 * HZ)
104104
105105 /*
106− * ceph_connection state bit flags
106+ * ceph_connection flag bits
107107 */
108+
108109 #define LOSSYTX 0 /* we can close channel or drop messages on errors */
109−#define CONNECTING 1
110−#define NEGOTIATING 2
111110 #define KEEPALIVE_PENDING 3
112111 #define WRITE_PENDING 4 /* we have data ready to send */
112+#define SOCK_CLOSED 11 /* socket state changed to closed */
113+#define BACKOFF 15
114+
115+/*
116+ * ceph_connection states
117+ */
118+#define CONNECTING 1
119+#define NEGOTIATING 2
113120 #define STANDBY 8 /* no outgoing messages, socket closed. we keep
114121 * the ceph_connection around to maintain shared
115122 * state with the peer. */
116123 #define CLOSED 10 /* we've closed the connection */
117−#define SOCK_CLOSED 11 /* socket state changed to closed */
118124 #define OPENING 13 /* open connection w/ (possibly new) peer */
119−#define BACKOFF 15
120125
121126 /*
122127 * A single connection with another host.
@@ -133,7 +138,8 @@ struct ceph_connection { · 10 unmodified lines
133138
134139 struct ceph_messenger *msgr;
135140 struct socket *sock;
136− unsigned long state; /* connection state (see flags above) */
141+ unsigned long flags;
142+ unsigned long state;
137143 const char *error_msg; /* error message, if any */
138144
139145 struct ceph_entity_addr peer_addr; /* peer address */