if (sk->sk_forward_alloc < copy && !sk_stream_mem_schedule(sk, copy, 0)) 
if (!sk_stream_wmem_schedule(sk, copy)) 
static ssize_t do_tcp_sendpages(struct sock *sk, struct page **pages, int poffset,			 size_t psize, int flags){	struct tcp_sock *tp = tcp_sk(sk);	int mss_now, size_goal;	int err;	ssize_t copied;	long timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT);	/* Wait for a connection to finish. */	if ((1 << sk->sk_state) & ~(TCPF_ESTABLISHED | TCPF_CLOSE_WAIT))		if ((err = sk_stream_wait_connect(sk, &timeo)) != 0)			goto out_err;	clear_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);	mss_now = tcp_current_mss(sk, !(flags&MSG_OOB));	size_goal = tp->xmit_size_goal;	copied = 0;	err = -EPIPE;	if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))		goto do_error;	while (psize > 0) {		struct sk_buff *skb = sk->sk_write_queue.prev;		struct page *page = pages[poffset / PAGE_SIZE];		int copy, i, can_coalesce;		int offset = poffset % PAGE_SIZE;		int size = min_t(size_t, psize, PAGE_SIZE - offset);		if (!sk->sk_send_head || (copy = size_goal - skb->len) <= 0) {new_segment:			if (!sk_stream_memory_free(sk))				goto wait_for_sndbuf;			skb = sk_stream_alloc_pskb(sk, 0, 0,						   sk->sk_allocation);			if (!skb)				goto wait_for_memory;			skb_entail(sk, tp, skb);			copy = size_goal;		}		if (copy > size)			copy = size;		i = skb_shinfo(skb)->nr_frags;		can_coalesce = skb_can_coalesce(skb, i, page, offset);		if (!can_coalesce && i >= MAX_SKB_FRAGS) {			tcp_mark_push(tp, skb);			goto new_segment;		}		if (sk->sk_forward_alloc < copy &&		    !sk_stream_mem_schedule(sk, copy, 0))			goto wait_for_memory;				if (can_coalesce) {			skb_shinfo(skb)->frags[i - 1].size += copy;		} else {			get_page(page);			skb_fill_page_desc(skb, i, page, offset, copy);		}		skb->len += copy;		skb->data_len += copy;		skb->truesize += copy;		sk->sk_wmem_queued += copy;		sk->sk_forward_alloc -= copy;		skb->ip_summed = CHECKSUM_HW;		tp->write_seq += copy;		TCP_SKB_CB(skb)->end_seq += copy;		skb_shinfo(skb)->tso_segs = 0;		if (!copied)			TCP_SKB_CB(skb)->flags &= ~TCPCB_FLAG_PSH;		copied += copy;		poffset += copy;		if (!(psize -= copy))			goto out;		if (skb->len < mss_now || (flags & MSG_OOB))			continue;		if (forced_push(tp)) {			tcp_mark_push(tp, skb);			__tcp_push_pending_frames(sk, tp, mss_now, TCP_NAGLE_PUSH);		} else if (skb == sk->sk_send_head)			tcp_push_one(sk, mss_now);		continue;wait_for_sndbuf:		set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);wait_for_memory:		if (copied)			tcp_push(sk, tp, flags & ~MSG_MORE, mss_now, TCP_NAGLE_PUSH);		if ((err = sk_stream_wait_memory(sk, &timeo)) != 0)			goto do_error;		mss_now = tcp_current_mss(sk, !(flags&MSG_OOB));		size_goal = tp->xmit_size_goal;	}out:	if (copied)		tcp_push(sk, tp, flags, mss_now, tp->nonagle);	return copied;do_error:	if (copied)		goto out;out_err:	return sk_stream_error(sk, flags, err);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/d80d99d643090c3cf2b1f9fb3fadd1256f7e384f/tcp.c/clean/net/ipv4/tcp.c