aboutsummaryrefslogtreecommitdiffstats
path: root/net/ceph
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-05-22 12:41:43 -0400
committerAlex Elder <elder@dreamhost.com>2012-06-01 09:37:55 -0400
commit327800bdc2cb9b71f4b458ca07aa9d522668dde0 (patch)
treeb69fe521c9a798dd22cf1d93e7ec599b51707bbd /net/ceph
parent6384bb8b8e88a9c6bf2ae0d9517c2c0199177c34 (diff)
libceph: rename socket callbacks
Change the names of the three socket callback functions to make it more obvious they're specifically associated with a connection's socket (not the ceph connection that uses it). Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Yehuda Sadeh <yehuda@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'net/ceph')
-rw-r--r--net/ceph/messenger.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 07af9948e3f7..545255823de2 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -153,46 +153,46 @@ EXPORT_SYMBOL(ceph_msgr_flush);
153 */ 153 */
154 154
155/* data available on socket, or listen socket received a connect */ 155/* data available on socket, or listen socket received a connect */
156static void ceph_data_ready(struct sock *sk, int count_unused) 156static void ceph_sock_data_ready(struct sock *sk, int count_unused)
157{ 157{
158 struct ceph_connection *con = sk->sk_user_data; 158 struct ceph_connection *con = sk->sk_user_data;
159 159
160 if (sk->sk_state != TCP_CLOSE_WAIT) { 160 if (sk->sk_state != TCP_CLOSE_WAIT) {
161 dout("ceph_data_ready on %p state = %lu, queueing work\n", 161 dout("%s on %p state = %lu, queueing work\n", __func__,
162 con, con->state); 162 con, con->state);
163 queue_con(con); 163 queue_con(con);
164 } 164 }
165} 165}
166 166
167/* socket has buffer space for writing */ 167/* socket has buffer space for writing */
168static void ceph_write_space(struct sock *sk) 168static void ceph_sock_write_space(struct sock *sk)
169{ 169{
170 struct ceph_connection *con = sk->sk_user_data; 170 struct ceph_connection *con = sk->sk_user_data;
171 171
172 /* only queue to workqueue if there is data we want to write, 172 /* only queue to workqueue if there is data we want to write,
173 * and there is sufficient space in the socket buffer to accept 173 * and there is sufficient space in the socket buffer to accept
174 * more data. clear SOCK_NOSPACE so that ceph_write_space() 174 * more data. clear SOCK_NOSPACE so that ceph_sock_write_space()
175 * doesn't get called again until try_write() fills the socket 175 * doesn't get called again until try_write() fills the socket
176 * buffer. See net/ipv4/tcp_input.c:tcp_check_space() 176 * buffer. See net/ipv4/tcp_input.c:tcp_check_space()
177 * and net/core/stream.c:sk_stream_write_space(). 177 * and net/core/stream.c:sk_stream_write_space().
178 */ 178 */
179 if (test_bit(WRITE_PENDING, &con->state)) { 179 if (test_bit(WRITE_PENDING, &con->state)) {
180 if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk)) { 180 if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk)) {
181 dout("ceph_write_space %p queueing write work\n", con); 181 dout("%s %p queueing write work\n", __func__, con);
182 clear_bit(SOCK_NOSPACE, &sk->sk_socket->flags); 182 clear_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
183 queue_con(con); 183 queue_con(con);
184 } 184 }
185 } else { 185 } else {
186 dout("ceph_write_space %p nothing to write\n", con); 186 dout("%s %p nothing to write\n", __func__, con);
187 } 187 }
188} 188}
189 189
190/* socket's state has changed */ 190/* socket's state has changed */
191static void ceph_state_change(struct sock *sk) 191static void ceph_sock_state_change(struct sock *sk)
192{ 192{
193 struct ceph_connection *con = sk->sk_user_data; 193 struct ceph_connection *con = sk->sk_user_data;
194 194
195 dout("ceph_state_change %p state = %lu sk_state = %u\n", 195 dout("%s %p state = %lu sk_state = %u\n", __func__,
196 con, con->state, sk->sk_state); 196 con, con->state, sk->sk_state);
197 197
198 if (test_bit(CLOSED, &con->state)) 198 if (test_bit(CLOSED, &con->state))
@@ -200,9 +200,9 @@ static void ceph_state_change(struct sock *sk)
200 200
201 switch (sk->sk_state) { 201 switch (sk->sk_state) {
202 case TCP_CLOSE: 202 case TCP_CLOSE:
203 dout("ceph_state_change TCP_CLOSE\n"); 203 dout("%s TCP_CLOSE\n", __func__);
204 case TCP_CLOSE_WAIT: 204 case TCP_CLOSE_WAIT:
205 dout("ceph_state_change TCP_CLOSE_WAIT\n"); 205 dout("%s TCP_CLOSE_WAIT\n", __func__);
206 if (test_and_set_bit(SOCK_CLOSED, &con->state) == 0) { 206 if (test_and_set_bit(SOCK_CLOSED, &con->state) == 0) {
207 if (test_bit(CONNECTING, &con->state)) 207 if (test_bit(CONNECTING, &con->state))
208 con->error_msg = "connection failed"; 208 con->error_msg = "connection failed";
@@ -212,7 +212,7 @@ static void ceph_state_change(struct sock *sk)
212 } 212 }
213 break; 213 break;
214 case TCP_ESTABLISHED: 214 case TCP_ESTABLISHED:
215 dout("ceph_state_change TCP_ESTABLISHED\n"); 215 dout("%s TCP_ESTABLISHED\n", __func__);
216 queue_con(con); 216 queue_con(con);
217 break; 217 break;
218 default: /* Everything else is uninteresting */ 218 default: /* Everything else is uninteresting */
@@ -228,9 +228,9 @@ static void set_sock_callbacks(struct socket *sock,
228{ 228{
229 struct sock *sk = sock->sk; 229 struct sock *sk = sock->sk;
230 sk->sk_user_data = con; 230 sk->sk_user_data = con;
231 sk->sk_data_ready = ceph_data_ready; 231 sk->sk_data_ready = ceph_sock_data_ready;
232 sk->sk_write_space = ceph_write_space; 232 sk->sk_write_space = ceph_sock_write_space;
233 sk->sk_state_change = ceph_state_change; 233 sk->sk_state_change = ceph_sock_state_change;
234} 234}
235 235
236 236