aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/sock.h4
-rw-r--r--net/ceph/messenger.c2
-rw-r--r--net/core/stream.c2
-rw-r--r--net/dccp/proto.c4
-rw-r--r--net/ipv4/tcp.c4
-rw-r--r--net/sunrpc/svcsock.c2
-rw-r--r--net/sunrpc/xprtsock.c2
7 files changed, 12 insertions, 8 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index e0473f61693f..d0b5fdee50a2 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1088,6 +1088,10 @@ static inline struct cg_proto *parent_cg_proto(struct proto *proto,
1088} 1088}
1089#endif 1089#endif
1090 1090
1091static inline bool sk_stream_is_writeable(const struct sock *sk)
1092{
1093 return sk_stream_wspace(sk) >= sk_stream_min_wspace(sk);
1094}
1091 1095
1092static inline bool sk_has_memory_pressure(const struct sock *sk) 1096static inline bool sk_has_memory_pressure(const struct sock *sk)
1093{ 1097{
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index eb0a46a49bd4..3be308e14302 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -409,7 +409,7 @@ static void ceph_sock_write_space(struct sock *sk)
409 * and net/core/stream.c:sk_stream_write_space(). 409 * and net/core/stream.c:sk_stream_write_space().
410 */ 410 */
411 if (con_flag_test(con, CON_FLAG_WRITE_PENDING)) { 411 if (con_flag_test(con, CON_FLAG_WRITE_PENDING)) {
412 if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk)) { 412 if (sk_stream_is_writeable(sk)) {
413 dout("%s %p queueing write work\n", __func__, con); 413 dout("%s %p queueing write work\n", __func__, con);
414 clear_bit(SOCK_NOSPACE, &sk->sk_socket->flags); 414 clear_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
415 queue_con(con); 415 queue_con(con);
diff --git a/net/core/stream.c b/net/core/stream.c
index f5df85dcd20b..512f0a24269b 100644
--- a/net/core/stream.c
+++ b/net/core/stream.c
@@ -30,7 +30,7 @@ void sk_stream_write_space(struct sock *sk)
30 struct socket *sock = sk->sk_socket; 30 struct socket *sock = sk->sk_socket;
31 struct socket_wq *wq; 31 struct socket_wq *wq;
32 32
33 if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk) && sock) { 33 if (sk_stream_is_writeable(sk) && sock) {
34 clear_bit(SOCK_NOSPACE, &sock->flags); 34 clear_bit(SOCK_NOSPACE, &sock->flags);
35 35
36 rcu_read_lock(); 36 rcu_read_lock();
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index 6c7c78b83940..ba64750f0387 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -336,7 +336,7 @@ unsigned int dccp_poll(struct file *file, struct socket *sock,
336 mask |= POLLIN | POLLRDNORM; 336 mask |= POLLIN | POLLRDNORM;
337 337
338 if (!(sk->sk_shutdown & SEND_SHUTDOWN)) { 338 if (!(sk->sk_shutdown & SEND_SHUTDOWN)) {
339 if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk)) { 339 if (sk_stream_is_writeable(sk)) {
340 mask |= POLLOUT | POLLWRNORM; 340 mask |= POLLOUT | POLLWRNORM;
341 } else { /* send SIGIO later */ 341 } else { /* send SIGIO later */
342 set_bit(SOCK_ASYNC_NOSPACE, 342 set_bit(SOCK_ASYNC_NOSPACE,
@@ -347,7 +347,7 @@ unsigned int dccp_poll(struct file *file, struct socket *sock,
347 * wspace test but before the flags are set, 347 * wspace test but before the flags are set,
348 * IO signal will be lost. 348 * IO signal will be lost.
349 */ 349 */
350 if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk)) 350 if (sk_stream_is_writeable(sk))
351 mask |= POLLOUT | POLLWRNORM; 351 mask |= POLLOUT | POLLWRNORM;
352 } 352 }
353 } 353 }
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 5423223e93c2..5eca9060bb8e 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -499,7 +499,7 @@ unsigned int tcp_poll(struct file *file, struct socket *sock, poll_table *wait)
499 mask |= POLLIN | POLLRDNORM; 499 mask |= POLLIN | POLLRDNORM;
500 500
501 if (!(sk->sk_shutdown & SEND_SHUTDOWN)) { 501 if (!(sk->sk_shutdown & SEND_SHUTDOWN)) {
502 if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk)) { 502 if (sk_stream_is_writeable(sk)) {
503 mask |= POLLOUT | POLLWRNORM; 503 mask |= POLLOUT | POLLWRNORM;
504 } else { /* send SIGIO later */ 504 } else { /* send SIGIO later */
505 set_bit(SOCK_ASYNC_NOSPACE, 505 set_bit(SOCK_ASYNC_NOSPACE,
@@ -510,7 +510,7 @@ unsigned int tcp_poll(struct file *file, struct socket *sock, poll_table *wait)
510 * wspace test but before the flags are set, 510 * wspace test but before the flags are set,
511 * IO signal will be lost. 511 * IO signal will be lost.
512 */ 512 */
513 if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk)) 513 if (sk_stream_is_writeable(sk))
514 mask |= POLLOUT | POLLWRNORM; 514 mask |= POLLOUT | POLLWRNORM;
515 } 515 }
516 } else 516 } else
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 305374d4fb98..0da6785ec15a 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -442,7 +442,7 @@ static void svc_tcp_write_space(struct sock *sk)
442{ 442{
443 struct socket *sock = sk->sk_socket; 443 struct socket *sock = sk->sk_socket;
444 444
445 if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk) && sock) 445 if (sk_stream_is_writeable(sk) && sock)
446 clear_bit(SOCK_NOSPACE, &sock->flags); 446 clear_bit(SOCK_NOSPACE, &sock->flags);
447 svc_write_space(sk); 447 svc_write_space(sk);
448} 448}
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index ddf0602603bd..d6656d7768f4 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1602,7 +1602,7 @@ static void xs_tcp_write_space(struct sock *sk)
1602 read_lock_bh(&sk->sk_callback_lock); 1602 read_lock_bh(&sk->sk_callback_lock);
1603 1603
1604 /* from net/core/stream.c:sk_stream_write_space */ 1604 /* from net/core/stream.c:sk_stream_write_space */
1605 if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk)) 1605 if (sk_stream_is_writeable(sk))
1606 xs_write_space(sk); 1606 xs_write_space(sk);
1607 1607
1608 read_unlock_bh(&sk->sk_callback_lock); 1608 read_unlock_bh(&sk->sk_callback_lock);