]> git.hungrycats.org Git - linux/commitdiff
Make sock_writeable (used mostly by datagram
authorDavid S. Miller <davem@nuts.ninka.net>
Sun, 10 Mar 2002 22:10:37 +0000 (14:10 -0800)
committerDavid S. Miller <davem@nuts.ninka.net>
Sun, 10 Mar 2002 22:10:37 +0000 (14:10 -0800)
protocols) more reasonable.  Kill all references
to SOCK_MIN_WRITE_SPACE and kill its definition.
Replace with appropriate sock_writeable calls.

include/net/sock.h
net/irda/af_irda.c
net/sunrpc/xprt.c

index 4c5d7c257d7507e79c57f682521c91747413854d..d50815f55ff35e066ff6366d7dfbce6cb9386bcf 100644 (file)
@@ -750,16 +750,13 @@ static inline void sk_wake_async(struct sock *sk, int how, int band)
 
 #define SOCK_MIN_SNDBUF 2048
 #define SOCK_MIN_RCVBUF 256
-/* Must be less or equal SOCK_MIN_SNDBUF */
-#define SOCK_MIN_WRITE_SPACE   SOCK_MIN_SNDBUF
 
 /*
  *     Default write policy as shown to user space via poll/select/SIGIO
- *     Kernel internally doesn't use the MIN_WRITE_SPACE threshold.
  */
 static inline int sock_writeable(struct sock *sk) 
 {
-       return sock_wspace(sk) >= SOCK_MIN_WRITE_SPACE;
+       return atomic_read(&sk->wmem_alloc) < (sk->sndbuf / 2);
 }
 
 static inline int gfp_any(void)
index 7ac7c5249732b9a9f10b84afe64a17cb46195407..2110b9b3a558efe8e589370270c4f6b89dbb78ae 100644 (file)
@@ -1700,7 +1700,7 @@ static unsigned int irda_poll(struct file * file, struct socket *sock,
 
                if (sk->state == TCP_ESTABLISHED) {
                        if ((self->tx_flow == FLOW_START) && 
-                           (sk->sndbuf - (int)atomic_read(&sk->wmem_alloc) >= SOCK_MIN_WRITE_SPACE))
+                           sock_writeable(sk))
                        {
                                mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
                        }
@@ -1708,13 +1708,13 @@ static unsigned int irda_poll(struct file * file, struct socket *sock,
                break;
        case SOCK_SEQPACKET:
                if ((self->tx_flow == FLOW_START) && 
-                   (sk->sndbuf - (int)atomic_read(&sk->wmem_alloc) >= SOCK_MIN_WRITE_SPACE))
+                   sock_writeable(sk))
                {       
                        mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
                }
                break;
        case SOCK_DGRAM:
-               if (sk->sndbuf - (int)atomic_read(&sk->wmem_alloc) >= SOCK_MIN_WRITE_SPACE)
+               if (sock_writeable(sk))
                        mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
                break;
        default:
index 3c429ef6ca93adbf43bd46ac51bfd2fbc0c85413..0751536f78280d51f08b3d329719c3451ceec0af 100644 (file)
@@ -67,9 +67,6 @@
 
 #include <asm/uaccess.h>
 
-/* Following value should be > 32k + RPC overhead */
-#define XPRT_MIN_WRITE_SPACE (35000 + SOCK_MIN_WRITE_SPACE)
-
 extern spinlock_t rpc_queue_lock;
 
 /*
@@ -1099,9 +1096,8 @@ udp_write_space(struct sock *sk)
        if (xprt->shutdown)
                return;
 
-
-       /* Wait until we have enough socket memory */
-       if (sock_wspace(sk) < min_t(int, sk->sndbuf,XPRT_MIN_WRITE_SPACE))
+       /* Wait until we have enough socket memory. */
+       if (sock_writeable(sk))
                return;
 
        if (!xprt_test_and_set_wspace(xprt)) {