diff options
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-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 fbc8725c20cb..d40ff50887aa 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -1280,6 +1280,23 @@ out: | |||
1280 | read_unlock(&sk->sk_callback_lock); | 1280 | read_unlock(&sk->sk_callback_lock); |
1281 | } | 1281 | } |
1282 | 1282 | ||
1283 | static void xs_write_space(struct sock *sk) | ||
1284 | { | ||
1285 | struct socket *sock; | ||
1286 | struct rpc_xprt *xprt; | ||
1287 | |||
1288 | if (unlikely(!(sock = sk->sk_socket))) | ||
1289 | return; | ||
1290 | clear_bit(SOCK_NOSPACE, &sock->flags); | ||
1291 | |||
1292 | if (unlikely(!(xprt = xprt_from_sock(sk)))) | ||
1293 | return; | ||
1294 | if (test_and_clear_bit(SOCK_ASYNC_NOSPACE, &sock->flags) == 0) | ||
1295 | return; | ||
1296 | |||
1297 | xprt_write_space(xprt); | ||
1298 | } | ||
1299 | |||
1283 | /** | 1300 | /** |
1284 | * xs_udp_write_space - callback invoked when socket buffer space | 1301 | * xs_udp_write_space - callback invoked when socket buffer space |
1285 | * becomes available | 1302 | * becomes available |
@@ -1295,23 +1312,9 @@ static void xs_udp_write_space(struct sock *sk) | |||
1295 | read_lock(&sk->sk_callback_lock); | 1312 | read_lock(&sk->sk_callback_lock); |
1296 | 1313 | ||
1297 | /* from net/core/sock.c:sock_def_write_space */ | 1314 | /* from net/core/sock.c:sock_def_write_space */ |
1298 | if (sock_writeable(sk)) { | 1315 | if (sock_writeable(sk)) |
1299 | struct socket *sock; | 1316 | xs_write_space(sk); |
1300 | struct rpc_xprt *xprt; | ||
1301 | 1317 | ||
1302 | if (unlikely(!(sock = sk->sk_socket))) | ||
1303 | goto out; | ||
1304 | clear_bit(SOCK_NOSPACE, &sock->flags); | ||
1305 | |||
1306 | if (unlikely(!(xprt = xprt_from_sock(sk)))) | ||
1307 | goto out; | ||
1308 | if (test_and_clear_bit(SOCK_ASYNC_NOSPACE, &sock->flags) == 0) | ||
1309 | goto out; | ||
1310 | |||
1311 | xprt_write_space(xprt); | ||
1312 | } | ||
1313 | |||
1314 | out: | ||
1315 | read_unlock(&sk->sk_callback_lock); | 1318 | read_unlock(&sk->sk_callback_lock); |
1316 | } | 1319 | } |
1317 | 1320 | ||
@@ -1330,23 +1333,9 @@ static void xs_tcp_write_space(struct sock *sk) | |||
1330 | read_lock(&sk->sk_callback_lock); | 1333 | read_lock(&sk->sk_callback_lock); |
1331 | 1334 | ||
1332 | /* from net/core/stream.c:sk_stream_write_space */ | 1335 | /* from net/core/stream.c:sk_stream_write_space */ |
1333 | if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk)) { | 1336 | if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk)) |
1334 | struct socket *sock; | 1337 | xs_write_space(sk); |
1335 | struct rpc_xprt *xprt; | ||
1336 | |||
1337 | if (unlikely(!(sock = sk->sk_socket))) | ||
1338 | goto out; | ||
1339 | clear_bit(SOCK_NOSPACE, &sock->flags); | ||
1340 | 1338 | ||
1341 | if (unlikely(!(xprt = xprt_from_sock(sk)))) | ||
1342 | goto out; | ||
1343 | if (test_and_clear_bit(SOCK_ASYNC_NOSPACE, &sock->flags) == 0) | ||
1344 | goto out; | ||
1345 | |||
1346 | xprt_write_space(xprt); | ||
1347 | } | ||
1348 | |||
1349 | out: | ||
1350 | read_unlock(&sk->sk_callback_lock); | 1339 | read_unlock(&sk->sk_callback_lock); |
1351 | } | 1340 | } |
1352 | 1341 | ||