diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/xprtsock.c | 53 |
1 files changed, 21 insertions, 32 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 5cbb404c4cdf..b49e434c094f 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -1215,6 +1215,23 @@ out: | |||
1215 | read_unlock(&sk->sk_callback_lock); | 1215 | read_unlock(&sk->sk_callback_lock); |
1216 | } | 1216 | } |
1217 | 1217 | ||
1218 | static void xs_write_space(struct sock *sk) | ||
1219 | { | ||
1220 | struct socket *sock; | ||
1221 | struct rpc_xprt *xprt; | ||
1222 | |||
1223 | if (unlikely(!(sock = sk->sk_socket))) | ||
1224 | return; | ||
1225 | clear_bit(SOCK_NOSPACE, &sock->flags); | ||
1226 | |||
1227 | if (unlikely(!(xprt = xprt_from_sock(sk)))) | ||
1228 | return; | ||
1229 | if (test_and_clear_bit(SOCK_ASYNC_NOSPACE, &sock->flags) == 0) | ||
1230 | return; | ||
1231 | |||
1232 | xprt_write_space(xprt); | ||
1233 | } | ||
1234 | |||
1218 | /** | 1235 | /** |
1219 | * xs_udp_write_space - callback invoked when socket buffer space | 1236 | * xs_udp_write_space - callback invoked when socket buffer space |
1220 | * becomes available | 1237 | * becomes available |
@@ -1230,23 +1247,9 @@ static void xs_udp_write_space(struct sock *sk) | |||
1230 | read_lock(&sk->sk_callback_lock); | 1247 | read_lock(&sk->sk_callback_lock); |
1231 | 1248 | ||
1232 | /* from net/core/sock.c:sock_def_write_space */ | 1249 | /* from net/core/sock.c:sock_def_write_space */ |
1233 | if (sock_writeable(sk)) { | 1250 | if (sock_writeable(sk)) |
1234 | struct socket *sock; | 1251 | xs_write_space(sk); |
1235 | struct rpc_xprt *xprt; | ||
1236 | |||
1237 | if (unlikely(!(sock = sk->sk_socket))) | ||
1238 | goto out; | ||
1239 | clear_bit(SOCK_NOSPACE, &sock->flags); | ||
1240 | |||
1241 | if (unlikely(!(xprt = xprt_from_sock(sk)))) | ||
1242 | goto out; | ||
1243 | if (test_and_clear_bit(SOCK_ASYNC_NOSPACE, &sock->flags) == 0) | ||
1244 | goto out; | ||
1245 | |||
1246 | xprt_write_space(xprt); | ||
1247 | } | ||
1248 | 1252 | ||
1249 | out: | ||
1250 | read_unlock(&sk->sk_callback_lock); | 1253 | read_unlock(&sk->sk_callback_lock); |
1251 | } | 1254 | } |
1252 | 1255 | ||
@@ -1265,23 +1268,9 @@ static void xs_tcp_write_space(struct sock *sk) | |||
1265 | read_lock(&sk->sk_callback_lock); | 1268 | read_lock(&sk->sk_callback_lock); |
1266 | 1269 | ||
1267 | /* from net/core/stream.c:sk_stream_write_space */ | 1270 | /* from net/core/stream.c:sk_stream_write_space */ |
1268 | if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk)) { | 1271 | if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk)) |
1269 | struct socket *sock; | 1272 | xs_write_space(sk); |
1270 | struct rpc_xprt *xprt; | ||
1271 | |||
1272 | if (unlikely(!(sock = sk->sk_socket))) | ||
1273 | goto out; | ||
1274 | clear_bit(SOCK_NOSPACE, &sock->flags); | ||
1275 | 1273 | ||
1276 | if (unlikely(!(xprt = xprt_from_sock(sk)))) | ||
1277 | goto out; | ||
1278 | if (test_and_clear_bit(SOCK_ASYNC_NOSPACE, &sock->flags) == 0) | ||
1279 | goto out; | ||
1280 | |||
1281 | xprt_write_space(xprt); | ||
1282 | } | ||
1283 | |||
1284 | out: | ||
1285 | read_unlock(&sk->sk_callback_lock); | 1274 | read_unlock(&sk->sk_callback_lock); |
1286 | } | 1275 | } |
1287 | 1276 | ||